diff --git a/src/KFmaintenance/App.config b/src/KFmaintenance/App.config index dfeedea..299128a 100644 --- a/src/KFmaintenance/App.config +++ b/src/KFmaintenance/App.config @@ -12,10 +12,25 @@ - True + lab-mm - maroon + qmfa6OIQJ4Eg9oTJwiIjFM5i0REQ7hBFWZDXZqeRYwY= + + + + + + + + + + + + True + + + False diff --git a/src/KFmaintenance/Properties/Resources.Designer.cs b/src/KFmaintenance/Properties/Resources.Designer.cs index 66b7fa1..98f7a07 100644 --- a/src/KFmaintenance/Properties/Resources.Designer.cs +++ b/src/KFmaintenance/Properties/Resources.Designer.cs @@ -69,6 +69,24 @@ internal static string AppName { } } + /// + /// Looks up a localized string similar to Chrome driver belum dipilih/tidak ditemukan.. + /// + internal static string ClisDriverNotFoundMessage { + get { + return ResourceManager.GetString("ClisDriverNotFoundMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Tidak ada data untuk diproses.. + /// + internal static string ClisNoDataMessage { + get { + return ResourceManager.GetString("ClisNoDataMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to .... /// diff --git a/src/KFmaintenance/Properties/Resources.resx b/src/KFmaintenance/Properties/Resources.resx index ee80250..89342dd 100644 --- a/src/KFmaintenance/Properties/Resources.resx +++ b/src/KFmaintenance/Properties/Resources.resx @@ -146,4 +146,10 @@ ... + + Chrome driver belum dipilih/tidak ditemukan. + + + Tidak ada data untuk diproses. + \ No newline at end of file diff --git a/src/KFmaintenance/Properties/Settings.Designer.cs b/src/KFmaintenance/Properties/Settings.Designer.cs index dc325af..efaf89c 100644 --- a/src/KFmaintenance/Properties/Settings.Designer.cs +++ b/src/KFmaintenance/Properties/Settings.Designer.cs @@ -25,7 +25,7 @@ public static Settings Default { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] + [global::System.Configuration.DefaultSettingValueAttribute("lab-mm")] public string Cluster { get { return ((string)(this["Cluster"])); @@ -37,7 +37,7 @@ public string Cluster { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("maroon")] + [global::System.Configuration.DefaultSettingValueAttribute("qmfa6OIQJ4Eg9oTJwiIjFM5i0REQ7hBFWZDXZqeRYwY=")] public string Password { get { return ((string)(this["Password"])); @@ -46,5 +46,65 @@ public string Password { this["Password"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string WebdriverPath { + get { + return ((string)(this["WebdriverPath"])); + } + set { + this["WebdriverPath"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ClisUsername { + get { + return ((string)(this["ClisUsername"])); + } + set { + this["ClisUsername"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string ClisPassword { + get { + return ((string)(this["ClisPassword"])); + } + set { + this["ClisPassword"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool ClisSaveCred { + get { + return ((bool)(this["ClisSaveCred"])); + } + set { + this["ClisSaveCred"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool ClisUseHeadless { + get { + return ((bool)(this["ClisUseHeadless"])); + } + set { + this["ClisUseHeadless"] = value; + } + } } } diff --git a/src/KFmaintenance/Properties/Settings.settings b/src/KFmaintenance/Properties/Settings.settings index 82939f0..b67df82 100644 --- a/src/KFmaintenance/Properties/Settings.settings +++ b/src/KFmaintenance/Properties/Settings.settings @@ -3,10 +3,25 @@ - True + lab-mm - maroon + qmfa6OIQJ4Eg9oTJwiIjFM5i0REQ7hBFWZDXZqeRYwY= + + + + + + + + + + + + True + + + False \ No newline at end of file diff --git a/src/KFmaintenance/Views/ClisForm.Designer.cs b/src/KFmaintenance/Views/ClisForm.Designer.cs index 991e60d..d66115d 100644 --- a/src/KFmaintenance/Views/ClisForm.Designer.cs +++ b/src/KFmaintenance/Views/ClisForm.Designer.cs @@ -31,34 +31,45 @@ private void InitializeComponent() this.panel1 = new System.Windows.Forms.Panel(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); + this.ofdChromeDriver = new System.Windows.Forms.OpenFileDialog(); this.flatTabControl1 = new KFlearning.Core.Forms.FlatTabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.chkMasterStudentList = new System.Windows.Forms.CheckBox(); - this.chkLecturerStudentList = new System.Windows.Forms.CheckBox(); - this.chkFinalScore = new System.Windows.Forms.CheckBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.textBox1 = new System.Windows.Forms.TextBox(); + this.chkSaveCred = new System.Windows.Forms.CheckBox(); + this.chkUseHeadless = new System.Windows.Forms.CheckBox(); + this.txtYear = new System.Windows.Forms.TextBox(); + this.txtClass = new System.Windows.Forms.TextBox(); + this.txtChromeDriver = new System.Windows.Forms.TextBox(); + this.cmdOpenChrome = new System.Windows.Forms.LinkLabel(); this.txtPassword = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.txtUsername = new System.Windows.Forms.TextBox(); - this.cmdClassHelp = new System.Windows.Forms.LinkLabel(); this.label4 = new System.Windows.Forms.Label(); this.txtClassId = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); - this.label9 = new System.Windows.Forms.Label(); - this.progressBar1 = new System.Windows.Forms.ProgressBar(); - this.label8 = new System.Windows.Forms.Label(); - this.cmdExecute = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.cmdOpen = new System.Windows.Forms.Button(); + this.cmdOpenExcel = new System.Windows.Forms.Button(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.cmdStop = new System.Windows.Forms.Button(); + this.label11 = new System.Windows.Forms.Label(); + this.lstLog = new System.Windows.Forms.ListBox(); + this.chkMasterStudentList = new System.Windows.Forms.CheckBox(); + this.chkLecturerStudentList = new System.Windows.Forms.CheckBox(); + this.chkFinalScore = new System.Windows.Forms.CheckBox(); + this.lblProgress = new System.Windows.Forms.Label(); + this.cmdExecute = new System.Windows.Forms.Button(); + this.label8 = new System.Windows.Forms.Label(); + this.pgProgress = new System.Windows.Forms.ProgressBar(); + this.ofdExcel = new System.Windows.Forms.OpenFileDialog(); this.panel1.SuspendLayout(); this.flatTabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.tabPage3.SuspendLayout(); this.SuspendLayout(); // // panel1 @@ -70,7 +81,7 @@ private void InitializeComponent() this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(574, 61); + this.panel1.Size = new System.Drawing.Size(622, 61); this.panel1.TabIndex = 15; // // label2 @@ -95,6 +106,11 @@ private void InitializeComponent() this.label1.TabIndex = 1; this.label1.Text = "CLIS Auto-Fill"; // + // ofdChromeDriver + // + this.ofdChromeDriver.Filter = "chromedriver.exe|chromedriver.exe"; + this.ofdChromeDriver.Title = "Pilih chromedriver.exe"; + // // flatTabControl1 // this.flatTabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -102,94 +118,118 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.flatTabControl1.Controls.Add(this.tabPage1); this.flatTabControl1.Controls.Add(this.tabPage2); + this.flatTabControl1.Controls.Add(this.tabPage3); this.flatTabControl1.Font = new System.Drawing.Font("Segoe UI", 9F); this.flatTabControl1.ItemSize = new System.Drawing.Size(120, 40); this.flatTabControl1.Location = new System.Drawing.Point(0, 77); this.flatTabControl1.Name = "flatTabControl1"; this.flatTabControl1.SelectedIndex = 0; - this.flatTabControl1.Size = new System.Drawing.Size(574, 379); + this.flatTabControl1.Size = new System.Drawing.Size(622, 333); this.flatTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.flatTabControl1.TabIndex = 25; // // tabPage1 // this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(70)))), ((int)(((byte)(73))))); - this.tabPage1.Controls.Add(this.chkMasterStudentList); - this.tabPage1.Controls.Add(this.chkLecturerStudentList); - this.tabPage1.Controls.Add(this.chkFinalScore); - this.tabPage1.Controls.Add(this.textBox2); - this.tabPage1.Controls.Add(this.textBox1); + this.tabPage1.Controls.Add(this.chkSaveCred); + this.tabPage1.Controls.Add(this.chkUseHeadless); + this.tabPage1.Controls.Add(this.txtYear); + this.tabPage1.Controls.Add(this.txtClass); + this.tabPage1.Controls.Add(this.txtChromeDriver); + this.tabPage1.Controls.Add(this.cmdOpenChrome); this.tabPage1.Controls.Add(this.txtPassword); + this.tabPage1.Controls.Add(this.label10); this.tabPage1.Controls.Add(this.label7); this.tabPage1.Controls.Add(this.label6); this.tabPage1.Controls.Add(this.label3); this.tabPage1.Controls.Add(this.txtUsername); - this.tabPage1.Controls.Add(this.cmdClassHelp); this.tabPage1.Controls.Add(this.label4); this.tabPage1.Controls.Add(this.txtClassId); this.tabPage1.Controls.Add(this.label5); this.tabPage1.Location = new System.Drawing.Point(4, 44); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(566, 331); + this.tabPage1.Size = new System.Drawing.Size(614, 285); this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Data"; - // - // chkMasterStudentList - // - this.chkMasterStudentList.AutoSize = true; - this.chkMasterStudentList.Location = new System.Drawing.Point(315, 34); - this.chkMasterStudentList.Name = "chkMasterStudentList"; - this.chkMasterStudentList.Size = new System.Drawing.Size(195, 24); - this.chkMasterStudentList.TabIndex = 27; - this.chkMasterStudentList.Text = "Input Master Student List"; - this.chkMasterStudentList.UseVisualStyleBackColor = true; - // - // chkLecturerStudentList - // - this.chkLecturerStudentList.AutoSize = true; - this.chkLecturerStudentList.Location = new System.Drawing.Point(315, 64); - this.chkLecturerStudentList.Name = "chkLecturerStudentList"; - this.chkLecturerStudentList.Size = new System.Drawing.Size(216, 24); - this.chkLecturerStudentList.TabIndex = 28; - this.chkLecturerStudentList.Text = "Input Lecture List of Student"; - this.chkLecturerStudentList.UseVisualStyleBackColor = true; - // - // chkFinalScore - // - this.chkFinalScore.AutoSize = true; - this.chkFinalScore.Location = new System.Drawing.Point(315, 94); - this.chkFinalScore.Name = "chkFinalScore"; - this.chkFinalScore.Size = new System.Drawing.Size(130, 24); - this.chkFinalScore.TabIndex = 29; - this.chkFinalScore.Text = "Input Final Test"; - this.chkFinalScore.UseVisualStyleBackColor = true; - // - // textBox2 - // - this.textBox2.Location = new System.Drawing.Point(29, 218); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(100, 27); - this.textBox2.TabIndex = 26; - // - // textBox1 - // - this.textBox1.Location = new System.Drawing.Point(29, 162); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(70, 27); - this.textBox1.TabIndex = 25; + this.tabPage1.Text = "Akun"; + // + // chkSaveCred + // + this.chkSaveCred.AutoSize = true; + this.chkSaveCred.Checked = true; + this.chkSaveCred.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkSaveCred.Location = new System.Drawing.Point(334, 231); + this.chkSaveCred.Name = "chkSaveCred"; + this.chkSaveCred.Size = new System.Drawing.Size(187, 24); + this.chkSaveCred.TabIndex = 40; + this.chkSaveCred.Text = "Simpan akun dan driver"; + this.chkSaveCred.UseVisualStyleBackColor = true; + // + // chkUseHeadless + // + this.chkUseHeadless.AutoSize = true; + this.chkUseHeadless.Location = new System.Drawing.Point(334, 201); + this.chkUseHeadless.Name = "chkUseHeadless"; + this.chkUseHeadless.Size = new System.Drawing.Size(195, 24); + this.chkUseHeadless.TabIndex = 39; + this.chkUseHeadless.Text = "Gunakan mode Headless"; + this.chkUseHeadless.UseVisualStyleBackColor = true; + // + // txtYear + // + this.txtYear.Location = new System.Drawing.Point(39, 103); + this.txtYear.Name = "txtYear"; + this.txtYear.Size = new System.Drawing.Size(100, 27); + this.txtYear.TabIndex = 26; + // + // txtClass + // + this.txtClass.Location = new System.Drawing.Point(39, 47); + this.txtClass.Name = "txtClass"; + this.txtClass.Size = new System.Drawing.Size(70, 27); + this.txtClass.TabIndex = 25; + // + // txtChromeDriver + // + this.txtChromeDriver.Location = new System.Drawing.Point(334, 159); + this.txtChromeDriver.Name = "txtChromeDriver"; + this.txtChromeDriver.ReadOnly = true; + this.txtChromeDriver.Size = new System.Drawing.Size(193, 27); + this.txtChromeDriver.TabIndex = 37; + // + // cmdOpenChrome + // + this.cmdOpenChrome.AutoSize = true; + this.cmdOpenChrome.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(160)))), ((int)(((byte)(230))))); + this.cmdOpenChrome.Location = new System.Drawing.Point(533, 162); + this.cmdOpenChrome.Name = "cmdOpenChrome"; + this.cmdOpenChrome.Size = new System.Drawing.Size(37, 20); + this.cmdOpenChrome.TabIndex = 38; + this.cmdOpenChrome.TabStop = true; + this.cmdOpenChrome.Text = "Pilih"; + this.cmdOpenChrome.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.cmdOpenChrome_LinkClicked); // // txtPassword // - this.txtPassword.Location = new System.Drawing.Point(26, 96); + this.txtPassword.Location = new System.Drawing.Point(334, 103); this.txtPassword.Name = "txtPassword"; this.txtPassword.Size = new System.Drawing.Size(236, 27); this.txtPassword.TabIndex = 20; + this.txtPassword.UseSystemPasswordChar = true; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(330, 136); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(106, 20); + this.label10.TabIndex = 36; + this.label10.Text = "Chrome driver:"; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(25, 195); + this.label7.Location = new System.Drawing.Point(35, 80); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(115, 20); this.label7.TabIndex = 24; @@ -198,7 +238,7 @@ private void InitializeComponent() // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(25, 139); + this.label6.Location = new System.Drawing.Point(35, 24); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(47, 20); this.label6.TabIndex = 23; @@ -207,7 +247,7 @@ private void InitializeComponent() // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(22, 17); + this.label3.Location = new System.Drawing.Point(330, 24); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(78, 20); this.label3.TabIndex = 16; @@ -215,26 +255,15 @@ private void InitializeComponent() // // txtUsername // - this.txtUsername.Location = new System.Drawing.Point(26, 40); + this.txtUsername.Location = new System.Drawing.Point(334, 47); this.txtUsername.Name = "txtUsername"; this.txtUsername.Size = new System.Drawing.Size(236, 27); this.txtUsername.TabIndex = 19; // - // cmdClassHelp - // - this.cmdClassHelp.AutoSize = true; - this.cmdClassHelp.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(160)))), ((int)(((byte)(230))))); - this.cmdClassHelp.Location = new System.Drawing.Point(196, 251); - this.cmdClassHelp.Name = "cmdClassHelp"; - this.cmdClassHelp.Size = new System.Drawing.Size(69, 20); - this.cmdClassHelp.TabIndex = 22; - this.cmdClassHelp.TabStop = true; - this.cmdClassHelp.Text = "Caranya?"; - // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(22, 73); + this.label4.Location = new System.Drawing.Point(330, 80); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(73, 20); this.label4.TabIndex = 17; @@ -242,7 +271,7 @@ private void InitializeComponent() // // txtClassId // - this.txtClassId.Location = new System.Drawing.Point(29, 274); + this.txtClassId.Location = new System.Drawing.Point(39, 159); this.txtClassId.Name = "txtClassId"; this.txtClassId.Size = new System.Drawing.Size(236, 27); this.txtClassId.TabIndex = 21; @@ -250,7 +279,7 @@ private void InitializeComponent() // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(25, 251); + this.label5.Location = new System.Drawing.Point(35, 136); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(66, 20); this.label5.TabIndex = 18; @@ -259,88 +288,169 @@ private void InitializeComponent() // tabPage2 // this.tabPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(70)))), ((int)(((byte)(73))))); - this.tabPage2.Controls.Add(this.label9); - this.tabPage2.Controls.Add(this.progressBar1); - this.tabPage2.Controls.Add(this.label8); - this.tabPage2.Controls.Add(this.cmdExecute); this.tabPage2.Controls.Add(this.dataGridView1); - this.tabPage2.Controls.Add(this.cmdOpen); + this.tabPage2.Controls.Add(this.cmdOpenExcel); this.tabPage2.Location = new System.Drawing.Point(4, 44); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(566, 331); + this.tabPage2.Size = new System.Drawing.Size(614, 285); this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Proses"; + this.tabPage2.Text = "Data"; // - // label9 + // dataGridView1 // - this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(428, 15); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(38, 20); - this.label9.TabIndex = 23; - this.label9.Text = "Siap"; + this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(16, 64); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowHeadersWidth = 51; + this.dataGridView1.RowTemplate.Height = 24; + this.dataGridView1.Size = new System.Drawing.Size(581, 206); + this.dataGridView1.TabIndex = 20; // - // progressBar1 + // cmdOpenExcel + // + this.cmdOpenExcel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cmdOpenExcel.Location = new System.Drawing.Point(18, 17); + this.cmdOpenExcel.Name = "cmdOpenExcel"; + this.cmdOpenExcel.Size = new System.Drawing.Size(130, 31); + this.cmdOpenExcel.TabIndex = 3; + this.cmdOpenExcel.Text = "Buka Excel"; + this.cmdOpenExcel.UseVisualStyleBackColor = true; + this.cmdOpenExcel.Click += new System.EventHandler(this.cmdOpenExcel_Click); + // + // tabPage3 + // + this.tabPage3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(70)))), ((int)(((byte)(73))))); + this.tabPage3.Controls.Add(this.cmdStop); + this.tabPage3.Controls.Add(this.label11); + this.tabPage3.Controls.Add(this.lstLog); + this.tabPage3.Controls.Add(this.chkMasterStudentList); + this.tabPage3.Controls.Add(this.chkLecturerStudentList); + this.tabPage3.Controls.Add(this.chkFinalScore); + this.tabPage3.Controls.Add(this.lblProgress); + this.tabPage3.Controls.Add(this.cmdExecute); + this.tabPage3.Controls.Add(this.label8); + this.tabPage3.Controls.Add(this.pgProgress); + this.tabPage3.Location = new System.Drawing.Point(4, 44); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(614, 285); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Proses"; + // + // cmdStop + // + this.cmdStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cmdStop.Location = new System.Drawing.Point(134, 203); + this.cmdStop.Name = "cmdStop"; + this.cmdStop.Size = new System.Drawing.Size(90, 33); + this.cmdStop.TabIndex = 41; + this.cmdStop.Text = "Berhenti"; + this.cmdStop.UseVisualStyleBackColor = true; + this.cmdStop.Click += new System.EventHandler(this.cmdStop_Click); + // + // label11 + // + this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(307, 30); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(37, 20); + this.label11.TabIndex = 40; + this.label11.Text = "Log:"; + // + // lstLog + // + this.lstLog.FormattingEnabled = true; + this.lstLog.ItemHeight = 20; + this.lstLog.Location = new System.Drawing.Point(311, 56); + this.lstLog.Name = "lstLog"; + this.lstLog.Size = new System.Drawing.Size(276, 204); + this.lstLog.TabIndex = 39; // - this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar1.Location = new System.Drawing.Point(372, 38); - this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(174, 10); - this.progressBar1.TabIndex = 22; + // chkMasterStudentList // - // label8 + this.chkMasterStudentList.AutoSize = true; + this.chkMasterStudentList.Location = new System.Drawing.Point(29, 26); + this.chkMasterStudentList.Name = "chkMasterStudentList"; + this.chkMasterStudentList.Size = new System.Drawing.Size(195, 24); + this.chkMasterStudentList.TabIndex = 33; + this.chkMasterStudentList.Text = "Input Master Student List"; + this.chkMasterStudentList.UseVisualStyleBackColor = true; // - this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(368, 15); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(54, 20); - this.label8.TabIndex = 21; - this.label8.Text = "Proses:"; + // chkLecturerStudentList + // + this.chkLecturerStudentList.AutoSize = true; + this.chkLecturerStudentList.Location = new System.Drawing.Point(29, 56); + this.chkLecturerStudentList.Name = "chkLecturerStudentList"; + this.chkLecturerStudentList.Size = new System.Drawing.Size(216, 24); + this.chkLecturerStudentList.TabIndex = 34; + this.chkLecturerStudentList.Text = "Input Lecture List of Student"; + this.chkLecturerStudentList.UseVisualStyleBackColor = true; + // + // chkFinalScore + // + this.chkFinalScore.AutoSize = true; + this.chkFinalScore.Location = new System.Drawing.Point(29, 86); + this.chkFinalScore.Name = "chkFinalScore"; + this.chkFinalScore.Size = new System.Drawing.Size(130, 24); + this.chkFinalScore.TabIndex = 35; + this.chkFinalScore.Text = "Input Final Test"; + this.chkFinalScore.UseVisualStyleBackColor = true; + // + // lblProgress + // + this.lblProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblProgress.AutoSize = true; + this.lblProgress.Location = new System.Drawing.Point(85, 136); + this.lblProgress.Name = "lblProgress"; + this.lblProgress.Size = new System.Drawing.Size(38, 20); + this.lblProgress.TabIndex = 23; + this.lblProgress.Text = "Siap"; // // cmdExecute // this.cmdExecute.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(168)))), ((int)(((byte)(109))))); this.cmdExecute.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cmdExecute.Location = new System.Drawing.Point(148, 17); + this.cmdExecute.Location = new System.Drawing.Point(29, 203); this.cmdExecute.Name = "cmdExecute"; - this.cmdExecute.Size = new System.Drawing.Size(99, 31); + this.cmdExecute.Size = new System.Drawing.Size(99, 33); this.cmdExecute.TabIndex = 4; - this.cmdExecute.Text = "EXECUTE"; + this.cmdExecute.Text = "Mulai"; this.cmdExecute.UseVisualStyleBackColor = false; + this.cmdExecute.Click += new System.EventHandler(this.cmdExecute_Click); // - // dataGridView1 + // label8 // - this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Location = new System.Drawing.Point(6, 71); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersWidth = 51; - this.dataGridView1.RowTemplate.Height = 24; - this.dataGridView1.Size = new System.Drawing.Size(554, 254); - this.dataGridView1.TabIndex = 20; + this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(25, 136); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(54, 20); + this.label8.TabIndex = 21; + this.label8.Text = "Proses:"; // - // cmdOpen + // pgProgress // - this.cmdOpen.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.cmdOpen.Location = new System.Drawing.Point(11, 17); - this.cmdOpen.Name = "cmdOpen"; - this.cmdOpen.Size = new System.Drawing.Size(130, 31); - this.cmdOpen.TabIndex = 3; - this.cmdOpen.Text = "Buka Excel"; - this.cmdOpen.UseVisualStyleBackColor = true; - this.cmdOpen.Click += new System.EventHandler(this.cmdOpen_Click); + this.pgProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.pgProgress.Location = new System.Drawing.Point(29, 159); + this.pgProgress.Name = "pgProgress"; + this.pgProgress.Size = new System.Drawing.Size(232, 22); + this.pgProgress.TabIndex = 22; + // + // ofdExcel + // + this.ofdExcel.Filter = "Excel file (xls/xlsx)|*.xls;*.xlsx"; // // ClisForm // this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(70)))), ((int)(((byte)(73))))); - this.ClientSize = new System.Drawing.Size(574, 456); + this.ClientSize = new System.Drawing.Size(622, 410); this.Controls.Add(this.flatTabControl1); this.Controls.Add(this.panel1); this.Font = new System.Drawing.Font("Segoe UI", 9F); @@ -357,8 +467,9 @@ private void InitializeComponent() this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.tabPage3.ResumeLayout(false); + this.tabPage3.PerformLayout(); this.ResumeLayout(false); } @@ -376,20 +487,30 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtPassword; private System.Windows.Forms.TextBox txtUsername; private System.Windows.Forms.Button cmdExecute; - private System.Windows.Forms.Button cmdOpen; - private System.Windows.Forms.LinkLabel cmdClassHelp; + private System.Windows.Forms.Button cmdOpenExcel; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label7; private KFlearning.Core.Forms.FlatTabControl flatTabControl1; private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TextBox txtClass; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.Label lblProgress; + private System.Windows.Forms.ProgressBar pgProgress; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.ListBox lstLog; + private System.Windows.Forms.LinkLabel cmdOpenChrome; + private System.Windows.Forms.TextBox txtChromeDriver; + private System.Windows.Forms.Label label10; private System.Windows.Forms.CheckBox chkMasterStudentList; private System.Windows.Forms.CheckBox chkLecturerStudentList; private System.Windows.Forms.CheckBox chkFinalScore; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.TabPage tabPage2; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.ProgressBar progressBar1; - private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.OpenFileDialog ofdChromeDriver; + private System.Windows.Forms.Button cmdStop; + private System.Windows.Forms.TextBox txtYear; + private System.Windows.Forms.OpenFileDialog ofdExcel; + private System.Windows.Forms.CheckBox chkSaveCred; + private System.Windows.Forms.CheckBox chkUseHeadless; } } \ No newline at end of file diff --git a/src/KFmaintenance/Views/ClisForm.cs b/src/KFmaintenance/Views/ClisForm.cs index 7b198fe..f3bb8c8 100644 --- a/src/KFmaintenance/Views/ClisForm.cs +++ b/src/KFmaintenance/Views/ClisForm.cs @@ -1,48 +1,173 @@ using ExcelDataReader; using KFlearning.Core.CLIS; +using KFmaintenance.Properties; +using KFmaintenance.Services; using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Data; -using System.Drawing; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace KFmaintenance.Views { public partial class ClisForm : Form { - private readonly BindingList _records = new BindingList(); + private readonly IClisService _service = Program.Container.Resolve(); + private readonly BindingList _records = new BindingList(); public ClisForm() { InitializeComponent(); + dataGridView1.ApplyStyle(); dataGridView1.DataSource = _records; + dataGridView1.Columns[1].Width = 300; + + _service.ProgressChanged += Service_ProgressChanged; + _service.ProcessFinished += Service_ProcessFinished; } - - private void cmdOpen_Click(object sender, EventArgs e) + + + #region Private Methods + + private void UpdateMessage(ClisProgressEventArgs e, bool executeEnable, bool stopEnable) { - using (var stream = File.Open("D:\\test.xlsx", FileMode.Open, FileAccess.Read)) + if (InvokeRequired) { - using (var reader = ExcelReaderFactory.CreateReader(stream)) - { - _records.Clear(); + Invoke(new Action(UpdateMessage), e, executeEnable, stopEnable); + return; + } + + pgProgress.Value = e.ProgressPercentage; + lblProgress.Text = e.Step; + lstLog.Items.Add(e.Message); + cmdExecute.Enabled = executeEnable; + cmdStop.Enabled = stopEnable; + } + + protected override void OnLoad(EventArgs e) + { + var settings = Settings.Default; + chkSaveCred.Checked = settings.ClisSaveCred; + if (settings.ClisSaveCred) + { + chkUseHeadless.Checked = settings.ClisUseHeadless; + txtUsername.Text = settings.ClisUsername; + txtPassword.Text = settings.ClisPassword; + txtChromeDriver.Text = settings.WebdriverPath; + } + + base.OnLoad(e); + } + + protected override void OnFormClosing(FormClosingEventArgs e) + { + var settings = Settings.Default; + settings.ClisUseHeadless = chkUseHeadless.Checked; + settings.ClisUsername = txtUsername.Text; + settings.ClisPassword = txtPassword.Text; + settings.WebdriverPath = txtChromeDriver.Text; + + settings.Save(); + base.OnFormClosing(e); + } + + #endregion + + #region Service Event Handler + + private void Service_ProcessFinished(object sender, ClisProgressEventArgs e) + { + UpdateMessage(e, true, false); + } + + private void Service_ProgressChanged(object sender, ClisProgressEventArgs e) + { + UpdateMessage(e, false, true); + } + + #endregion - reader.Read(); // read header - while (reader.Read()) + #region Buttons + + private void cmdOpenChrome_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + if (ofdChromeDriver.ShowDialog() != DialogResult.OK) return; + txtChromeDriver.Text = ofdChromeDriver.FileName; + } + + private void cmdOpenExcel_Click(object sender, EventArgs e) + { + if (ofdExcel.ShowDialog() != DialogResult.OK) return; + + try + { + using (var stream = File.Open(ofdExcel.FileName, FileMode.Open, FileAccess.Read)) + { + using (var reader = ExcelReaderFactory.CreateReader(stream)) { - _records.Add(new StudentRecord + _records.Clear(); + + reader.Read(); // read header + while (reader.Read()) { - Npm = reader.GetString(0), - Name = reader.GetString(1), - Score = reader.GetDouble(2) - }); + _records.Add(new ClisRecord + { + Npm = reader.GetString(0), + Name = reader.GetString(1), + Score = reader.GetDouble(2) + }); + } } } } + catch (Exception ex) + { + MessageBox.Show(ex.Message, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + } } + + private void cmdExecute_Click(object sender, EventArgs e) + { + if (_records.Count == 0) + { + MessageBox.Show(Resources.ClisNoDataMessage, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + if (!File.Exists(txtChromeDriver.Text)) + { + MessageBox.Show(Resources.ClisDriverNotFoundMessage, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + var metadata = new ClisMetadata + { + Username = txtUsername.Text, + Password = txtPassword.Text, + Class = txtClass.Text, + Year = txtYear.Text, + ClassId = txtClassId.Text, + ContinueOnError = true, + Records = _records.ToList() + }; + + _service.WebDriverPath = txtChromeDriver.Text; + _service.ProcessMasterStudent = chkMasterStudentList.Checked; + _service.ProcessLecturerStudent = chkLecturerStudentList.Checked; + _service.ProcessFinalScore = chkFinalScore.Checked; + _service.UseHeadless = chkUseHeadless.Checked; + + cmdExecute.Enabled = false; + cmdStop.Enabled = true; + + _service.Start(metadata); + } + + private void cmdStop_Click(object sender, EventArgs e) + { + cmdStop.Enabled = false; + _service.Stop(); + } + + #endregion } } diff --git a/src/KFmaintenance/Views/ClisForm.resx b/src/KFmaintenance/Views/ClisForm.resx index 1af7de1..759e32d 100644 --- a/src/KFmaintenance/Views/ClisForm.resx +++ b/src/KFmaintenance/Views/ClisForm.resx @@ -117,4 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 191, 17 + \ No newline at end of file