a | b | |
---|
| 0 | + | #region Using directives |
---|
| 0 | + | |
---|
| 0 | + | using System; |
---|
| 0 | + | using System.Drawing; |
---|
| 0 | + | using System.Collections; |
---|
| 0 | + | using System.Windows.Forms; |
---|
| 0 | + | using System.Data; |
---|
| 0 | + | using JuiceApps.BO; |
---|
| 0 | + | using System.IO; |
---|
| 0 | + | |
---|
| 0 | + | #endregion |
---|
| 0 | + | |
---|
| 0 | + | namespace JuiceApps |
---|
| 0 | + | { |
---|
| 0 | + | /// <summary> |
---|
| 0 | + | /// Summary description for WorkOrderView. |
---|
| 0 | + | /// </summary> |
---|
| 0 | + | public class WorkOrderView : System.Windows.Forms.Form |
---|
| 0 | + | { |
---|
| 0 | + | #region Instance Variables |
---|
| 0 | + | |
---|
| 0 | + | private Button btnLeft; |
---|
| 0 | + | private Button btnRight; |
---|
| 0 | + | private Panel panel1; |
---|
| 0 | + | private Label lblWON; |
---|
| 0 | + | private Label label2; |
---|
| 0 | + | private Panel pnlMain; |
---|
| 0 | + | private TextBox txtAmount; |
---|
| 0 | + | private Label label15; |
---|
| 0 | + | private TextBox txtMaterials; |
---|
| 0 | + | private Label label14; |
---|
| 0 | + | private TextBox txtComments; |
---|
| 0 | + | private Label label13; |
---|
| 0 | + | private TextBox txtTimeSpent; |
---|
| 0 | + | private Label label12; |
---|
| 0 | + | private Label label11; |
---|
| 0 | + | private Label label18; |
---|
| 0 | + | private Label label10; |
---|
| 0 | + | private TextBox txtCreated; |
---|
| 0 | + | private Label label9; |
---|
| 0 | + | private TextBox txtAssignedTo; |
---|
| 0 | + | private Label label8; |
---|
| 0 | + | private TextBox txtWOType; |
---|
| 0 | + | private Label label7; |
---|
| 0 | + | private TextBox txtMeterSN; |
---|
| 0 | + | private Label label5; |
---|
| 0 | + | private Label label6; |
---|
| 0 | + | private TextBox txtTransformer; |
---|
| 0 | + | private TextBox txtSubstation; |
---|
| 0 | + | private TextBox txtLocID; |
---|
| 0 | + | private Label label4; |
---|
| 0 | + | private TextBox txtName; |
---|
| 0 | + | private Label label3; |
---|
| 0 | + | private VScrollBar vScrollBar1; |
---|
| 0 | + | private Label lblWOCount; |
---|
| 0 | + | |
---|
| 0 | + | private ComboBox cbStatus; |
---|
| 0 | + | private MainMenu mainMenu1; |
---|
| 0 | + | private MenuItem miEditDone; |
---|
| 0 | + | private MenuItem miSave; |
---|
| 0 | + | private ComboBox cbSubstatus; |
---|
| 0 | + | |
---|
| 0 | + | |
---|
| 0 | + | private ComboBox comboBox1; |
---|
| 0 | + | private Label label1; |
---|
| 0 | + | private TextBox txtPeak; |
---|
| 0 | + | private TextBox txtkVA; |
---|
| 0 | + | private TextBox txtkWh; |
---|
| 0 | + | private Label label17; |
---|
| 0 | + | private Label label19; |
---|
| 0 | + | private Label label20; |
---|
| 0 | + | private Label label16; |
---|
| 0 | + | private TextBox txtAverageReading; |
---|
| 0 | + | private Label label21; |
---|
| 0 | + | private TextBox txtAddress; |
---|
| 0 | + | private Label label22; |
---|
| 0 | + | private TextBox txtAccNum; |
---|
| 0 | + | private Label label23; |
---|
| 0 | + | |
---|
| 0 | + | private int currentWorkOrder = 0; |
---|
| 0 | + | private ArrayList doNotEdit; |
---|
| 0 | + | private bool changed = false; |
---|
| 0 | + | private bool editing = false; |
---|
| 0 | + | private MenuItem miBack; |
---|
| 0 | + | private MenuItem menuItem1; |
---|
| 0 | + | private Label label24; |
---|
| 0 | + | private TextBox txtRoute; |
---|
| 0 | + | private TextBox txtModule; |
---|
| 0 | + | private Label label25; |
---|
| 0 | + | private bool newMeter = false; |
---|
| 0 | + | |
---|
| 0 | + | #endregion |
---|
| 0 | + | |
---|
| 0 | + | // Called when a meter serial number is unrecognized (i.e. not in the database) |
---|
| 0 | + | public WorkOrderView(string sn) |
---|
| 0 | + | { |
---|
| 0 | + | newMeter = true; |
---|
| 0 | + | InitializeComponent(); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | // Called when a meter/work order is recognized (i.e. in the database) |
---|
| 0 | + | public WorkOrderView(int current) |
---|
| 0 | + | { |
---|
| 0 | + | currentWorkOrder = current; |
---|
| 0 | + | InitializeComponent(); |
---|
| 0 | + | initData(currentWorkOrder); |
---|
| 0 | + | |
---|
| 0 | + | this.btnRight.Enabled = (currentWorkOrder < Helper.WorkOrders.Count() - 1) ? true : false; |
---|
| 0 | + | this.btnLeft.Enabled = (currentWorkOrder > 0) ? true : false; |
---|
| 0 | + | lblWOCount.Text = String.Format("{0}/{1}", (currentWorkOrder + 1), Helper.WorkOrders.Count()); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | #region Auto-Generated |
---|
| 0 | + | protected override void Dispose(bool disposing) |
---|
| 0 | + | { |
---|
| 0 | + | base.Dispose(disposing); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void InitializeComponent() |
---|
| 0 | + | { |
---|
| 0 | + | this.panel1 = new System.Windows.Forms.Panel(); |
---|
| 0 | + | this.label2 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.lblWOCount = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.lblWON = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.btnLeft = new System.Windows.Forms.Button(); |
---|
| 0 | + | this.btnRight = new System.Windows.Forms.Button(); |
---|
| 0 | + | this.pnlMain = new System.Windows.Forms.Panel(); |
---|
| 0 | + | this.label24 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtRoute = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.txtModule = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label25 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtAccNum = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label23 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label22 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtAverageReading = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label21 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtPeak = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.txtkVA = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.txtkWh = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label17 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label19 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label20 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label16 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.comboBox1 = new System.Windows.Forms.ComboBox(); |
---|
| 0 | + | this.label1 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.cbSubstatus = new System.Windows.Forms.ComboBox(); |
---|
| 0 | + | this.cbStatus = new System.Windows.Forms.ComboBox(); |
---|
| 0 | + | this.txtAmount = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label15 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtMaterials = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label14 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtComments = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label13 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtTimeSpent = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label12 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label11 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label18 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label10 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtCreated = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label9 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtAssignedTo = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label8 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtWOType = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label7 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtMeterSN = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label5 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.label6 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtTransformer = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.txtSubstation = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.txtLocID = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label4 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtName = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.label3 = new System.Windows.Forms.Label(); |
---|
| 0 | + | this.txtAddress = new System.Windows.Forms.TextBox(); |
---|
| 0 | + | this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); |
---|
| 0 | + | this.mainMenu1 = new System.Windows.Forms.MainMenu(); |
---|
| 0 | + | this.miEditDone = new System.Windows.Forms.MenuItem(); |
---|
| 0 | + | this.miSave = new System.Windows.Forms.MenuItem(); |
---|
| 0 | + | this.miBack = new System.Windows.Forms.MenuItem(); |
---|
| 0 | + | this.menuItem1 = new System.Windows.Forms.MenuItem(); |
---|
| 0 | + | // |
---|
| 0 | + | // panel1 |
---|
| 0 | + | // |
---|
| 0 | + | this.panel1.BackColor = System.Drawing.SystemColors.ScrollBar; |
---|
| 0 | + | this.panel1.Controls.Add(this.label2); |
---|
| 0 | + | this.panel1.Controls.Add(this.lblWOCount); |
---|
| 0 | + | this.panel1.Controls.Add(this.lblWON); |
---|
| 0 | + | this.panel1.Controls.Add(this.btnLeft); |
---|
| 0 | + | this.panel1.Controls.Add(this.btnRight); |
---|
| 0 | + | this.panel1.Location = new System.Drawing.Point(0, 0); |
---|
| 0 | + | this.panel1.Size = new System.Drawing.Size(240, 30); |
---|
| 0 | + | // |
---|
| 0 | + | // label2 |
---|
| 0 | + | // |
---|
| 0 | + | this.label2.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold); |
---|
| 0 | + | this.label2.Location = new System.Drawing.Point(102, 0); |
---|
| 0 | + | this.label2.Size = new System.Drawing.Size(17, 30); |
---|
| 0 | + | this.label2.Text = "|"; |
---|
| 0 | + | this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter; |
---|
| 0 | + | // |
---|
| 0 | + | // lblWOCount |
---|
| 0 | + | // |
---|
| 0 | + | this.lblWOCount.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold); |
---|
| 0 | + | this.lblWOCount.Location = new System.Drawing.Point(102, 2); |
---|
| 0 | + | this.lblWOCount.Size = new System.Drawing.Size(107, 30); |
---|
| 0 | + | this.lblWOCount.Text = "0/0"; |
---|
| 0 | + | this.lblWOCount.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // lblWON |
---|
| 0 | + | // |
---|
| 0 | + | this.lblWON.Font = new System.Drawing.Font("Tahoma", 14F, System.Drawing.FontStyle.Bold); |
---|
| 0 | + | this.lblWON.Location = new System.Drawing.Point(32, 2); |
---|
| 0 | + | this.lblWON.Size = new System.Drawing.Size(64, 30); |
---|
| 0 | + | this.lblWON.Text = "000"; |
---|
| 0 | + | // |
---|
| 0 | + | // btnLeft |
---|
| 0 | + | // |
---|
| 0 | + | this.btnLeft.Enabled = false; |
---|
| 0 | + | this.btnLeft.Font = new System.Drawing.Font("Tahoma", 18F, System.Drawing.FontStyle.Bold); |
---|
| 0 | + | this.btnLeft.Location = new System.Drawing.Point(0, 0); |
---|
| 0 | + | this.btnLeft.Size = new System.Drawing.Size(30, 30); |
---|
| 0 | + | this.btnLeft.Text = "<"; |
---|
| 0 | + | this.btnLeft.Click += new System.EventHandler(this.btnLeft_Click); |
---|
| 0 | + | // |
---|
| 0 | + | // btnRight |
---|
| 0 | + | // |
---|
| 0 | + | this.btnRight.Enabled = false; |
---|
| 0 | + | this.btnRight.Font = new System.Drawing.Font("Tahoma", 18F, System.Drawing.FontStyle.Bold); |
---|
| 0 | + | this.btnRight.Location = new System.Drawing.Point(210, 0); |
---|
| 0 | + | this.btnRight.Size = new System.Drawing.Size(30, 30); |
---|
| 0 | + | this.btnRight.Text = ">"; |
---|
| 0 | + | this.btnRight.Click += new System.EventHandler(this.btnRight_Click); |
---|
| 0 | + | // |
---|
| 0 | + | // pnlMain |
---|
| 0 | + | // |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label24); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtRoute); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtModule); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label25); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtAccNum); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label23); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label22); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtAverageReading); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label21); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtPeak); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtkVA); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtkWh); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label17); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label19); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label20); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label16); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.comboBox1); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label1); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.cbSubstatus); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.cbStatus); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtAmount); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label15); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtMaterials); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label14); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtComments); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label13); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtTimeSpent); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label12); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label11); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label18); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label10); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtCreated); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label9); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtAssignedTo); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label8); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtWOType); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label7); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtMeterSN); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label5); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label6); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtTransformer); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtSubstation); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtLocID); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label4); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtName); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.label3); |
---|
| 0 | + | this.pnlMain.Controls.Add(this.txtAddress); |
---|
| 0 | + | this.pnlMain.Location = new System.Drawing.Point(0, 30); |
---|
| 0 | + | this.pnlMain.Size = new System.Drawing.Size(218, 713); |
---|
| 0 | + | // |
---|
| 0 | + | // label24 |
---|
| 0 | + | // |
---|
| 0 | + | this.label24.Enabled = false; |
---|
| 0 | + | this.label24.Location = new System.Drawing.Point(3, 154); |
---|
| 0 | + | this.label24.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label24.Text = "Route:"; |
---|
| 0 | + | this.label24.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtRoute |
---|
| 0 | + | // |
---|
| 0 | + | this.txtRoute.Enabled = false; |
---|
| 0 | + | this.txtRoute.Location = new System.Drawing.Point(90, 153); |
---|
| 0 | + | this.txtRoute.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // txtModule |
---|
| 0 | + | // |
---|
| 0 | + | this.txtModule.Enabled = false; |
---|
| 0 | + | this.txtModule.Location = new System.Drawing.Point(90, 126); |
---|
| 0 | + | this.txtModule.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label25 |
---|
| 0 | + | // |
---|
| 0 | + | this.label25.Enabled = false; |
---|
| 0 | + | this.label25.Location = new System.Drawing.Point(3, 127); |
---|
| 0 | + | this.label25.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label25.Text = "Module:"; |
---|
| 0 | + | this.label25.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtAccNum |
---|
| 0 | + | // |
---|
| 0 | + | this.txtAccNum.Enabled = false; |
---|
| 0 | + | this.txtAccNum.Location = new System.Drawing.Point(90, 3); |
---|
| 0 | + | this.txtAccNum.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label23 |
---|
| 0 | + | // |
---|
| 0 | + | this.label23.Enabled = false; |
---|
| 0 | + | this.label23.Location = new System.Drawing.Point(3, 4); |
---|
| 0 | + | this.label23.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label23.Text = "Acct Num:"; |
---|
| 0 | + | this.label23.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label22 |
---|
| 0 | + | // |
---|
| 0 | + | this.label22.Enabled = false; |
---|
| 0 | + | this.label22.Location = new System.Drawing.Point(3, 58); |
---|
| 0 | + | this.label22.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label22.Text = "Address:"; |
---|
| 0 | + | this.label22.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtAverageReading |
---|
| 0 | + | // |
---|
| 0 | + | this.txtAverageReading.Enabled = false; |
---|
| 0 | + | this.txtAverageReading.Location = new System.Drawing.Point(90, 603); |
---|
| 0 | + | this.txtAverageReading.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label21 |
---|
| 0 | + | // |
---|
| 0 | + | this.label21.Enabled = false; |
---|
| 0 | + | this.label21.Location = new System.Drawing.Point(3, 604); |
---|
| 0 | + | this.label21.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label21.Text = "3 Month Avg:"; |
---|
| 0 | + | this.label21.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtPeak |
---|
| 0 | + | // |
---|
| 0 | + | this.txtPeak.Enabled = false; |
---|
| 0 | + | this.txtPeak.Location = new System.Drawing.Point(90, 684); |
---|
| 0 | + | this.txtPeak.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // txtkVA |
---|
| 0 | + | // |
---|
| 0 | + | this.txtkVA.Enabled = false; |
---|
| 0 | + | this.txtkVA.Location = new System.Drawing.Point(90, 657); |
---|
| 0 | + | this.txtkVA.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // txtkWh |
---|
| 0 | + | // |
---|
| 0 | + | this.txtkWh.Enabled = false; |
---|
| 0 | + | this.txtkWh.Location = new System.Drawing.Point(90, 630); |
---|
| 0 | + | this.txtkWh.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label17 |
---|
| 0 | + | // |
---|
| 0 | + | this.label17.Enabled = false; |
---|
| 0 | + | this.label17.Location = new System.Drawing.Point(3, 695); |
---|
| 0 | + | this.label17.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label17.Text = "Peak:"; |
---|
| 0 | + | this.label17.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label19 |
---|
| 0 | + | // |
---|
| 0 | + | this.label19.Enabled = false; |
---|
| 0 | + | this.label19.Location = new System.Drawing.Point(3, 658); |
---|
| 0 | + | this.label19.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label19.Text = "kVA:"; |
---|
| 0 | + | this.label19.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label20 |
---|
| 0 | + | // |
---|
| 0 | + | this.label20.Enabled = false; |
---|
| 0 | + | this.label20.Location = new System.Drawing.Point(3, 631); |
---|
| 0 | + | this.label20.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label20.Text = "kWh:"; |
---|
| 0 | + | this.label20.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label16 |
---|
| 0 | + | // |
---|
| 0 | + | this.label16.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold); |
---|
| 0 | + | this.label16.Location = new System.Drawing.Point(0, 578); |
---|
| 0 | + | this.label16.Size = new System.Drawing.Size(218, 20); |
---|
| 0 | + | this.label16.Text = "Reading Information"; |
---|
| 0 | + | this.label16.TextAlign = System.Drawing.ContentAlignment.TopCenter; |
---|
| 0 | + | // |
---|
| 0 | + | // comboBox1 |
---|
| 0 | + | // |
---|
| 0 | + | this.comboBox1.Enabled = false; |
---|
| 0 | + | this.comboBox1.Items.Add("Location not found"); |
---|
| 0 | + | this.comboBox1.Items.Add("No access"); |
---|
| 0 | + | this.comboBox1.Items.Add("Abandoned"); |
---|
| 0 | + | this.comboBox1.Items.Add("Meter changed"); |
---|
| 0 | + | this.comboBox1.Items.Add("Meter not found"); |
---|
| 0 | + | this.comboBox1.Items.Add("Module unlocked"); |
---|
| 0 | + | this.comboBox1.Items.Add("Possible fraud"); |
---|
| 0 | + | this.comboBox1.Location = new System.Drawing.Point(90, 422); |
---|
| 0 | + | this.comboBox1.Size = new System.Drawing.Size(128, 22); |
---|
| 0 | + | // |
---|
| 0 | + | // label1 |
---|
| 0 | + | // |
---|
| 0 | + | this.label1.Enabled = false; |
---|
| 0 | + | this.label1.Location = new System.Drawing.Point(3, 424); |
---|
| 0 | + | this.label1.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label1.Text = "Detail:"; |
---|
| 0 | + | this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // cbSubstatus |
---|
| 0 | + | // |
---|
| 0 | + | this.cbSubstatus.Enabled = false; |
---|
| 0 | + | this.cbSubstatus.Items.Add("Failed"); |
---|
| 0 | + | this.cbSubstatus.Items.Add("Extended"); |
---|
| 0 | + | this.cbSubstatus.Items.Add("Invalid"); |
---|
| 0 | + | this.cbSubstatus.Items.Add("Effective"); |
---|
| 0 | + | this.cbSubstatus.Location = new System.Drawing.Point(90, 395); |
---|
| 0 | + | this.cbSubstatus.Size = new System.Drawing.Size(128, 22); |
---|
| 0 | + | // |
---|
| 0 | + | // cbStatus |
---|
| 0 | + | // |
---|
| 0 | + | this.cbStatus.Enabled = false; |
---|
| 0 | + | this.cbStatus.Items.Add("Open"); |
---|
| 0 | + | this.cbStatus.Items.Add("In progress"); |
---|
| 0 | + | this.cbStatus.Items.Add("Failed"); |
---|
| 0 | + | this.cbStatus.Items.Add("Closed"); |
---|
| 0 | + | this.cbStatus.Location = new System.Drawing.Point(90, 368); |
---|
| 0 | + | this.cbStatus.Size = new System.Drawing.Size(128, 22); |
---|
| 0 | + | // |
---|
| 0 | + | // txtAmount |
---|
| 0 | + | // |
---|
| 0 | + | this.txtAmount.Enabled = false; |
---|
| 0 | + | this.txtAmount.Location = new System.Drawing.Point(90, 551); |
---|
| 0 | + | this.txtAmount.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label15 |
---|
| 0 | + | // |
---|
| 0 | + | this.label15.Enabled = false; |
---|
| 0 | + | this.label15.Location = new System.Drawing.Point(3, 552); |
---|
| 0 | + | this.label15.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label15.Text = "$ Amount:"; |
---|
| 0 | + | this.label15.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtMaterials |
---|
| 0 | + | // |
---|
| 0 | + | this.txtMaterials.Enabled = false; |
---|
| 0 | + | this.txtMaterials.Location = new System.Drawing.Point(90, 524); |
---|
| 0 | + | this.txtMaterials.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label14 |
---|
| 0 | + | // |
---|
| 0 | + | this.label14.Enabled = false; |
---|
| 0 | + | this.label14.Location = new System.Drawing.Point(3, 525); |
---|
| 0 | + | this.label14.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label14.Text = "Materials:"; |
---|
| 0 | + | this.label14.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtComments |
---|
| 0 | + | // |
---|
| 0 | + | this.txtComments.Enabled = false; |
---|
| 0 | + | this.txtComments.Location = new System.Drawing.Point(90, 477); |
---|
| 0 | + | this.txtComments.Multiline = true; |
---|
| 0 | + | this.txtComments.Size = new System.Drawing.Size(128, 41); |
---|
| 0 | + | // |
---|
| 0 | + | // label13 |
---|
| 0 | + | // |
---|
| 0 | + | this.label13.Enabled = false; |
---|
| 0 | + | this.label13.Location = new System.Drawing.Point(3, 478); |
---|
| 0 | + | this.label13.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label13.Text = "Comments:"; |
---|
| 0 | + | this.label13.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtTimeSpent |
---|
| 0 | + | // |
---|
| 0 | + | this.txtTimeSpent.Enabled = false; |
---|
| 0 | + | this.txtTimeSpent.Location = new System.Drawing.Point(90, 450); |
---|
| 0 | + | this.txtTimeSpent.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label12 |
---|
| 0 | + | // |
---|
| 0 | + | this.label12.Enabled = false; |
---|
| 0 | + | this.label12.Location = new System.Drawing.Point(3, 451); |
---|
| 0 | + | this.label12.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label12.Text = "Time Spent:"; |
---|
| 0 | + | this.label12.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label11 |
---|
| 0 | + | // |
---|
| 0 | + | this.label11.Enabled = false; |
---|
| 0 | + | this.label11.Location = new System.Drawing.Point(3, 397); |
---|
| 0 | + | this.label11.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label11.Text = "Substatus:"; |
---|
| 0 | + | this.label11.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label18 |
---|
| 0 | + | // |
---|
| 0 | + | this.label18.Enabled = false; |
---|
| 0 | + | this.label18.Location = new System.Drawing.Point(3, 370); |
---|
| 0 | + | this.label18.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label18.Text = "Status:"; |
---|
| 0 | + | this.label18.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label10 |
---|
| 0 | + | // |
---|
| 0 | + | this.label10.Enabled = false; |
---|
| 0 | + | this.label10.Location = new System.Drawing.Point(3, 343); |
---|
| 0 | + | this.label10.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label10.Text = "Created:"; |
---|
| 0 | + | this.label10.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtCreated |
---|
| 0 | + | // |
---|
| 0 | + | this.txtCreated.Enabled = false; |
---|
| 0 | + | this.txtCreated.Location = new System.Drawing.Point(90, 342); |
---|
| 0 | + | this.txtCreated.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label9 |
---|
| 0 | + | // |
---|
| 0 | + | this.label9.Enabled = false; |
---|
| 0 | + | this.label9.Location = new System.Drawing.Point(3, 316); |
---|
| 0 | + | this.label9.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label9.Text = "Assigned To:"; |
---|
| 0 | + | this.label9.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtAssignedTo |
---|
| 0 | + | // |
---|
| 0 | + | this.txtAssignedTo.Enabled = false; |
---|
| 0 | + | this.txtAssignedTo.Location = new System.Drawing.Point(90, 315); |
---|
| 0 | + | this.txtAssignedTo.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label8 |
---|
| 0 | + | // |
---|
| 0 | + | this.label8.Enabled = false; |
---|
| 0 | + | this.label8.Location = new System.Drawing.Point(3, 289); |
---|
| 0 | + | this.label8.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label8.Text = "WO Type:"; |
---|
| 0 | + | this.label8.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtWOType |
---|
| 0 | + | // |
---|
| 0 | + | this.txtWOType.Enabled = false; |
---|
| 0 | + | this.txtWOType.Location = new System.Drawing.Point(90, 288); |
---|
| 0 | + | this.txtWOType.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label7 |
---|
| 0 | + | // |
---|
| 0 | + | this.label7.Enabled = false; |
---|
| 0 | + | this.label7.Location = new System.Drawing.Point(3, 262); |
---|
| 0 | + | this.label7.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label7.Text = "Meter S/N:"; |
---|
| 0 | + | this.label7.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtMeterSN |
---|
| 0 | + | // |
---|
| 0 | + | this.txtMeterSN.Enabled = false; |
---|
| 0 | + | this.txtMeterSN.Location = new System.Drawing.Point(90, 261); |
---|
| 0 | + | this.txtMeterSN.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label5 |
---|
| 0 | + | // |
---|
| 0 | + | this.label5.Enabled = false; |
---|
| 0 | + | this.label5.Location = new System.Drawing.Point(3, 235); |
---|
| 0 | + | this.label5.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label5.Text = "Transformer:"; |
---|
| 0 | + | this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // label6 |
---|
| 0 | + | // |
---|
| 0 | + | this.label6.Enabled = false; |
---|
| 0 | + | this.label6.Location = new System.Drawing.Point(3, 208); |
---|
| 0 | + | this.label6.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label6.Text = "Substation:"; |
---|
| 0 | + | this.label6.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtTransformer |
---|
| 0 | + | // |
---|
| 0 | + | this.txtTransformer.Enabled = false; |
---|
| 0 | + | this.txtTransformer.Location = new System.Drawing.Point(90, 234); |
---|
| 0 | + | this.txtTransformer.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // txtSubstation |
---|
| 0 | + | // |
---|
| 0 | + | this.txtSubstation.Enabled = false; |
---|
| 0 | + | this.txtSubstation.Location = new System.Drawing.Point(90, 207); |
---|
| 0 | + | this.txtSubstation.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // txtLocID |
---|
| 0 | + | // |
---|
| 0 | + | this.txtLocID.Enabled = false; |
---|
| 0 | + | this.txtLocID.Location = new System.Drawing.Point(90, 180); |
---|
| 0 | + | this.txtLocID.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label4 |
---|
| 0 | + | // |
---|
| 0 | + | this.label4.Enabled = false; |
---|
| 0 | + | this.label4.Location = new System.Drawing.Point(3, 181); |
---|
| 0 | + | this.label4.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label4.Text = "Location ID:"; |
---|
| 0 | + | this.label4.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtName |
---|
| 0 | + | // |
---|
| 0 | + | this.txtName.Enabled = false; |
---|
| 0 | + | this.txtName.Location = new System.Drawing.Point(90, 30); |
---|
| 0 | + | this.txtName.Size = new System.Drawing.Size(128, 21); |
---|
| 0 | + | // |
---|
| 0 | + | // label3 |
---|
| 0 | + | // |
---|
| 0 | + | this.label3.Enabled = false; |
---|
| 0 | + | this.label3.Location = new System.Drawing.Point(3, 31); |
---|
| 0 | + | this.label3.Size = new System.Drawing.Size(81, 20); |
---|
| 0 | + | this.label3.Text = "Name:"; |
---|
| 0 | + | this.label3.TextAlign = System.Drawing.ContentAlignment.TopRight; |
---|
| 0 | + | // |
---|
| 0 | + | // txtAddress |
---|
| 0 | + | // |
---|
| 0 | + | this.txtAddress.Enabled = false; |
---|
| 0 | + | this.txtAddress.Location = new System.Drawing.Point(90, 57); |
---|
| 0 | + | this.txtAddress.Multiline = true; |
---|
| 0 | + | this.txtAddress.Size = new System.Drawing.Size(128, 63); |
---|
| 0 | + | // |
---|
| 0 | + | // vScrollBar1 |
---|
| 0 | + | // |
---|
| 0 | + | this.vScrollBar1.LargeChange = 30; |
---|
| 0 | + | this.vScrollBar1.Location = new System.Drawing.Point(221, 29); |
---|
| 0 | + | this.vScrollBar1.Maximum = 475; |
---|
| 0 | + | this.vScrollBar1.Size = new System.Drawing.Size(19, 265); |
---|
| 0 | + | this.vScrollBar1.SmallChange = 15; |
---|
| 0 | + | this.vScrollBar1.ValueChanged += new System.EventHandler(this.vScrollBar1_ValueChanged); |
---|
| 0 | + | // |
---|
| 0 | + | // mainMenu1 |
---|
| 0 | + | // |
---|
| 0 | + | this.mainMenu1.MenuItems.Add(this.miEditDone); |
---|
| 0 | + | this.mainMenu1.MenuItems.Add(this.miSave); |
---|
| 0 | + | this.mainMenu1.MenuItems.Add(this.miBack); |
---|
| 0 | + | this.mainMenu1.MenuItems.Add(this.menuItem1); |
---|
| 0 | + | // |
---|
| 0 | + | // miEditDone |
---|
| 0 | + | // |
---|
| 0 | + | this.miEditDone.Text = "Edit"; |
---|
| 0 | + | this.miEditDone.Click += new System.EventHandler(this.miEditDone_Click); |
---|
| 0 | + | // |
---|
| 0 | + | // miSave |
---|
| 0 | + | // |
---|
| 0 | + | this.miSave.Enabled = false; |
---|
| 0 | + | this.miSave.Text = "Save"; |
---|
| 0 | + | this.miSave.Click += new System.EventHandler(this.miSave_Click); |
---|
| 0 | + | // |
---|
| 0 | + | // miBack |
---|
| 0 | + | // |
---|
| 0 | + | this.miBack.Text = "Back"; |
---|
| 0 | + | this.miBack.Click += new System.EventHandler(this.miBack_Click); |
---|
| 0 | + | // |
---|
| 0 | + | // menuItem1 |
---|
| 0 | + | // |
---|
| 0 | + | this.menuItem1.Text = "Exit"; |
---|
| 0 | + | this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); |
---|
| 0 | + | // |
---|
| 0 | + | // WorkOrderView |
---|
| 0 | + | // |
---|
| 0 | + | this.ClientSize = new System.Drawing.Size(240, 294); |
---|
| 0 | + | this.ControlBox = false; |
---|
| 0 | + | this.Controls.Add(this.panel1); |
---|
| 0 | + | this.Controls.Add(this.vScrollBar1); |
---|
| 0 | + | this.Controls.Add(this.pnlMain); |
---|
| 0 | + | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; |
---|
| 0 | + | this.Location = new System.Drawing.Point(0, 0); |
---|
| 0 | + | this.Menu = this.mainMenu1; |
---|
| 0 | + | this.WindowState = System.Windows.Forms.FormWindowState.Maximized; |
---|
| 0 | + | this.Load += new System.EventHandler(this.WorkOrderView_Load); |
---|
| 0 | + | this.Resize += new System.EventHandler(this.WorkOrderView_Resize); |
---|
| 0 | + | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WorkOrderView_KeyDown); |
---|
| 0 | + | |
---|
| 0 | + | } |
---|
| 0 | + | #endregion |
---|
| 0 | + | |
---|
| 0 | + | private void WorkOrderView_Load(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | // Non-editable fields |
---|
| 0 | + | doNotEdit = new ArrayList(); |
---|
| 0 | + | doNotEdit.Add(this.txtLocID); |
---|
| 0 | + | doNotEdit.Add(this.txtSubstation); |
---|
| 0 | + | doNotEdit.Add(this.txtTransformer); |
---|
| 0 | + | doNotEdit.Add(this.txtMeterSN); |
---|
| 0 | + | doNotEdit.Add(this.txtCreated); |
---|
| 0 | + | doNotEdit.Add(this.txtAverageReading); |
---|
| 0 | + | doNotEdit.Add(this.txtAccNum); |
---|
| 0 | + | doNotEdit.Add(this.txtModule); |
---|
| 0 | + | doNotEdit.Add(this.txtRoute); |
---|
| 0 | + | |
---|
| 0 | + | // Initialize changes to dataChanged event handler |
---|
| 0 | + | foreach (Control c in this.pnlMain.Controls) |
---|
| 0 | + | if (c is TextBox) |
---|
| 0 | + | ((TextBox)c).TextChanged += new EventHandler(dataChanged); |
---|
| 0 | + | else if (c is ComboBox) |
---|
| 0 | + | ((ComboBox)c).SelectedIndexChanged += new EventHandler(dataChanged); |
---|
| 0 | + | |
---|
| 0 | + | if (newMeter) |
---|
| 0 | + | MessageBox.Show("Warning! Meter not found in database! Enter data and click save to add.", "Meter Not Found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void dataChanged(Object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | if (editing) |
---|
| 0 | + | { |
---|
| 0 | + | changed = true; |
---|
| 0 | + | miSave.Enabled = true; |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void vScrollBar1_ValueChanged(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | this.pnlMain.Top = -this.vScrollBar1.Value + 30; |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | public void initData(int index) |
---|
| 0 | + | { |
---|
| 0 | + | if (Helper.FileExists()) |
---|
| 0 | + | { |
---|
| 0 | + | WorkOrder w = Helper.WorkOrders[index]; |
---|
| 0 | + | |
---|
| 0 | + | this.Text = w.Portal; |
---|
| 0 | + | txtAccNum.Text = w.AccountNum.ToString(); |
---|
| 0 | + | lblWON.Text = w.WONum.ToString(); |
---|
| 0 | + | txtAmount.Text = w.Amount.ToString(); |
---|
| 0 | + | txtMaterials.Text = w.MatUsed; |
---|
| 0 | + | txtComments.Text = w.Comments; |
---|
| 0 | + | txtTimeSpent.Text = w.TimeSpent.ToString(); |
---|
| 0 | + | cbSubstatus.SelectedItem = w.Substatus; |
---|
| 0 | + | switch (w.Substatus.ToLower()) |
---|
| 0 | + | { |
---|
| 0 | + | case "failed": |
---|
| 0 | + | cbSubstatus.SelectedIndex = 0; |
---|
| 0 | + | break; |
---|
| 0 | + | case "extended": |
---|
| 0 | + | cbSubstatus.SelectedIndex = 1; |
---|
| 0 | + | break; |
---|
| 0 | + | case "invalid": |
---|
| 0 | + | cbSubstatus.SelectedIndex = 2; |
---|
| 0 | + | break; |
---|
| 0 | + | case "effective": |
---|
| 0 | + | cbSubstatus.SelectedIndex = 3; |
---|
| 0 | + | break; |
---|
| 0 | + | default: |
---|
| 0 | + | cbSubstatus.SelectedIndex = -1; |
---|
| 0 | + | break; |
---|
| 0 | + | } |
---|
| 0 | + | switch (w.Status.ToLower()) |
---|
| 0 | + | { |
---|
| 0 | + | case "open": |
---|
| 0 | + | cbStatus.SelectedIndex = 0; |
---|
| 0 | + | break; |
---|
| 0 | + | case "in progress": |
---|
| 0 | + | cbStatus.SelectedIndex = 1; |
---|
| 0 | + | break; |
---|
| 0 | + | case "failed": |
---|
| 0 | + | cbStatus.SelectedIndex = 2; |
---|
| 0 | + | break; |
---|
| 0 | + | case "closed": |
---|
| 0 | + | cbStatus.SelectedIndex = 3; |
---|
| 0 | + | break; |
---|
| 0 | + | default: |
---|
| 0 | + | cbStatus.SelectedIndex = -1; |
---|
| 0 | + | break; |
---|
| 0 | + | } |
---|
| 0 | + | txtCreated.Text = w.Created.ToString(); |
---|
| 0 | + | txtAssignedTo.Text = w.AssignedTo; |
---|
| 0 | + | txtWOType.Text = w.WOType; |
---|
| 0 | + | txtMeterSN.Text = w.MeterSN.ToString(); |
---|
| 0 | + | txtTransformer.Text = w.Transformer.ToString(); |
---|
| 0 | + | txtSubstation.Text = w.Substation; |
---|
| 0 | + | txtLocID.Text = w.LocID.ToString(); |
---|
| 0 | + | txtName.Text = w.Name; |
---|
| 0 | + | txtAverageReading.Text = w.AverageReading.ToString(); |
---|
| 0 | + | txtkWh.Text = w.kWh.ToString(); |
---|
| 0 | + | txtkVA.Text = w.kVA.ToString(); |
---|
| 0 | + | txtPeak.Text = w.Peak.ToString(); |
---|
| 0 | + | txtAddress.Text = (w.Address1 != String.Empty) ? String.Format("{0} {1}\r\n{2}, {3} {4}", w.Address1, w.Address2, w.City, w.State, w.Zip) : ""; |
---|
| 0 | + | txtModule.Text = w.Module; |
---|
| 0 | + | txtRoute.Text = w.Route; |
---|
| 0 | + | } |
---|
| 0 | + | else |
---|
| 0 | + | MessageBox.Show("File not found!"); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void btnLeft_Click(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | if (!editing) |
---|
| 0 | + | if (currentWorkOrder > 0) |
---|
| 0 | + | { |
---|
| 0 | + | initData(--currentWorkOrder); |
---|
| 0 | + | btnRight.Enabled = true; |
---|
| 0 | + | |
---|
| 0 | + | if ((currentWorkOrder - 1) < 0) |
---|
| 0 | + | btnLeft.Enabled = false; |
---|
| 0 | + | |
---|
| 0 | + | lblWOCount.Text = String.Format("{0}/{1}", (currentWorkOrder + 1), Helper.WorkOrders.Count()); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | this.Focus(); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void btnRight_Click(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | if (!editing) |
---|
| 0 | + | if ((currentWorkOrder + 1) < Helper.WorkOrders.Count()) |
---|
| 0 | + | { |
---|
| 0 | + | initData(++currentWorkOrder); |
---|
| 0 | + | btnLeft.Enabled = true; |
---|
| 0 | + | |
---|
| 0 | + | if ((currentWorkOrder + 1) == Helper.WorkOrders.Count()) |
---|
| 0 | + | btnRight.Enabled = false; |
---|
| 0 | + | |
---|
| 0 | + | lblWOCount.Text = String.Format("{0}/{1}", (currentWorkOrder + 1), Helper.WorkOrders.Count()); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | this.Focus(); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void WorkOrderView_KeyDown(object sender, KeyEventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | if (e.KeyCode == System.Windows.Forms.Keys.Up) |
---|
| 0 | + | { |
---|
| 0 | + | if ((this.vScrollBar1.Value - this.vScrollBar1.SmallChange) <= this.vScrollBar1.Minimum) |
---|
| 0 | + | this.vScrollBar1.Value = this.vScrollBar1.Minimum; |
---|
| 0 | + | else |
---|
| 0 | + | this.vScrollBar1.Value -= this.vScrollBar1.SmallChange; |
---|
| 0 | + | //this.vScrollBar1_ValueChanged(sender, e); |
---|
| 0 | + | } |
---|
| 0 | + | else if (e.KeyCode == System.Windows.Forms.Keys.Down) |
---|
| 0 | + | { |
---|
| 0 | + | if ((this.vScrollBar1.Value + this.vScrollBar1.SmallChange) >= this.vScrollBar1.Maximum) |
---|
| 0 | + | this.vScrollBar1.Value = this.vScrollBar1.Maximum; |
---|
| 0 | + | else |
---|
| 0 | + | this.vScrollBar1.Value += this.vScrollBar1.SmallChange; |
---|
| 0 | + | } |
---|
| 0 | + | else if (e.KeyCode == System.Windows.Forms.Keys.Left) |
---|
| 0 | + | { |
---|
| 0 | + | this.btnLeft_Click(sender, e); |
---|
| 0 | + | } |
---|
| 0 | + | else if (e.KeyCode == System.Windows.Forms.Keys.Right) |
---|
| 0 | + | { |
---|
| 0 | + | this.btnRight_Click(sender, e); |
---|
| 0 | + | } |
---|
| 0 | + | else if (e.KeyCode == (Keys.RButton | Keys.Space)) // Page up button |
---|
| 0 | + | { |
---|
| 0 | + | int factor = (Helper.WorkOrders.Count() / 10); |
---|
| 0 | + | if (factor > 1) |
---|
| 0 | + | { |
---|
| 0 | + | if ((currentWorkOrder + factor) < Helper.WorkOrders.Count()) |
---|
| 0 | + | { |
---|
| 0 | + | currentWorkOrder += factor; |
---|
| 0 | + | initData(currentWorkOrder); |
---|
| 0 | + | } |
---|
| 0 | + | else |
---|
| 0 | + | { |
---|
| 0 | + | currentWorkOrder = Helper.WorkOrders.Count() - 1; |
---|
| 0 | + | initData(currentWorkOrder); |
---|
| 0 | + | btnLeft.Enabled = true; |
---|
| 0 | + | btnRight.Enabled = false; |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | lblWOCount.Text = String.Format("{0}/{1}", (currentWorkOrder + 1), Helper.WorkOrders.Count()); |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | else if (e.KeyCode == (Keys.LButton | Keys.Space)) // Page down button |
---|
| 0 | + | { |
---|
| 0 | + | int factor = (Helper.WorkOrders.Count() / 10); |
---|
| 0 | + | if (factor > 1) |
---|
| 0 | + | { |
---|
| 0 | + | if ((currentWorkOrder - factor) > 0) |
---|
| 0 | + | { |
---|
| 0 | + | currentWorkOrder -= factor; |
---|
| 0 | + | initData(currentWorkOrder); |
---|
| 0 | + | } |
---|
| 0 | + | else |
---|
| 0 | + | { |
---|
| 0 | + | currentWorkOrder = 0; |
---|
| 0 | + | initData(currentWorkOrder); |
---|
| 0 | + | btnRight.Enabled = true; |
---|
| 0 | + | btnLeft.Enabled = false; |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | lblWOCount.Text = String.Format("{0}/{1}", (currentWorkOrder + 1), Helper.WorkOrders.Count()); |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | /// <summary> |
---|
| 0 | + | /// Edit menu button clicked |
---|
| 0 | + | /// </summary> |
---|
| 0 | + | private void miEditDone_Click(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | MenuItem button = (MenuItem)sender; |
---|
| 0 | + | if (button.Text == "Edit") |
---|
| 0 | + | { |
---|
| 0 | + | editing = true; |
---|
| 0 | + | if (newMeter) |
---|
| 0 | + | enableAllControls(); |
---|
| 0 | + | else |
---|
| 0 | + | enableRelevantControls(); |
---|
| 0 | + | button.Text = "Done"; |
---|
| 0 | + | } |
---|
| 0 | + | else if (button.Text == "Done") |
---|
| 0 | + | { |
---|
| 0 | + | if (changed) |
---|
| 0 | + | { |
---|
| 0 | + | DialogResult result = MessageBox.Show("You have unsaved changes. Save them now?", "Unsaved Changes!", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); |
---|
| 0 | + | if (result == DialogResult.Yes) |
---|
| 0 | + | save(); |
---|
| 0 | + | else if (result == DialogResult.No) |
---|
| 0 | + | { |
---|
| 0 | + | initData(currentWorkOrder); |
---|
| 0 | + | changed = false; |
---|
| 0 | + | miSave.Enabled = false; |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | editing = false; |
---|
| 0 | + | disableRelevantControls(); |
---|
| 0 | + | button.Text = "Edit"; |
---|
| 0 | + | this.Focus(); |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | /// <summary> |
---|
| 0 | + | /// Save menu item click |
---|
| 0 | + | /// </summary> |
---|
| 0 | + | private void miSave_Click(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | DialogResult result = MessageBox.Show("Really save changes?", "Save?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); |
---|
| 0 | + | if (result == DialogResult.Yes) |
---|
| 0 | + | save(); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | /// <summary> |
---|
| 0 | + | /// Back menu item click |
---|
| 0 | + | /// </summary> |
---|
| 0 | + | private void miBack_Click(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | this.Dispose(); |
---|
| 0 | + | this.Close(); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | /// <summary> |
---|
| 0 | + | /// Enables editable* controls. |
---|
| 0 | + | /// *Controls not in doNotEdit. |
---|
| 0 | + | /// </summary> |
---|
| 0 | + | private void enableRelevantControls() |
---|
| 0 | + | { |
---|
| 0 | + | bool editable = true; |
---|
| 0 | + | foreach (Control c in this.pnlMain.Controls) |
---|
| 0 | + | { |
---|
| 0 | + | if (c is TextBox) |
---|
| 0 | + | if (((TextBox)c).Equals(this.txtName)) |
---|
| 0 | + | Console.Write("here"); |
---|
| 0 | + | for (int i = 0; i < doNotEdit.Count; i++) |
---|
| 0 | + | if (c.Equals(doNotEdit[i])) |
---|
| 0 | + | editable = false; |
---|
| 0 | + | |
---|
| 0 | + | if (editable) |
---|
| 0 | + | c.Enabled = true; |
---|
| 0 | + | |
---|
| 0 | + | editable = true; |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void enableAllControls() |
---|
| 0 | + | { |
---|
| 0 | + | foreach (Control c in this.pnlMain.Controls) |
---|
| 0 | + | if ((c is TextBox) || (c is ComboBox)) |
---|
| 0 | + | c.Enabled = true; |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void disableRelevantControls() |
---|
| 0 | + | { |
---|
| 0 | + | foreach (Control c in this.pnlMain.Controls) |
---|
| 0 | + | if ((c is TextBox) || (c is ComboBox)) |
---|
| 0 | + | c.Enabled = false; |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void save() |
---|
| 0 | + | { |
---|
| 0 | + | if (newMeter) |
---|
| 0 | + | { |
---|
| 0 | + | WorkOrder wo = new WorkOrder(); |
---|
| 0 | + | wo.WONum = Helper.WorkOrders.Count(); |
---|
| 0 | + | wo.Portal = String.Empty; |
---|
| 0 | + | wo.AccountNum = txtAccNum.Text; |
---|
| 0 | + | wo.Name = txtName.Text; |
---|
| 0 | + | wo.LocID = txtLocID.Text; |
---|
| 0 | + | wo.Substation = txtSubstation.Text; |
---|
| 0 | + | wo.Transformer = txtTransformer.Text; |
---|
| 0 | + | |
---|
| 0 | + | // ========== Begin address parsing |
---|
| 0 | + | string[] addr = txtAddress.Text.Split("\r\n".ToCharArray()); |
---|
| 0 | + | string[] addr0_1 = addr[0].Split(' '); |
---|
| 0 | + | string[] addr2_3_4 = addr[1].Split(' '); |
---|
| 0 | + | wo.Address1 = addr0_1[0]; |
---|
| 0 | + | wo.Address2 = addr0_1[1]; |
---|
| 0 | + | wo.City = addr2_3_4[0]; |
---|
| 0 | + | wo.State = addr2_3_4[1]; |
---|
| 0 | + | wo.Zip = int.Parse(addr2_3_4[2]); |
---|
| 0 | + | // ========== End address parsing |
---|
| 0 | + | |
---|
| 0 | + | wo.Module = txtModule.Text; |
---|
| 0 | + | wo.Route = txtRoute.Text; |
---|
| 0 | + | wo.MeterSN = txtMeterSN.Text; |
---|
| 0 | + | wo.WOType = txtWOType.Text; |
---|
| 0 | + | wo.AssignedTo = txtAssignedTo.Text; |
---|
| 0 | + | wo.AverageReading = 0.0; |
---|
| 0 | + | wo.Created = (txtCreated.Text != String.Empty) ? new DateTime(int.Parse(txtCreated.Text.Substring(0, 4)), |
---|
| 0 | + | int.Parse(txtCreated.Text.Substring(5, 2)), |
---|
| 0 | + | int.Parse(txtCreated.Text.Substring(8, 2))) : new DateTime(); |
---|
| 0 | + | Helper.WorkOrders.Insert(Helper.WorkOrders.Count(), wo); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | int c = Helper.WorkOrders.Count() - 1; |
---|
| 0 | + | Helper.WorkOrders[c].Amount = double.Parse(txtAmount.Text); |
---|
| 0 | + | Helper.WorkOrders[c].MatUsed = txtMaterials.Text; |
---|
| 0 | + | Helper.WorkOrders[c].Comments = txtComments.Text; |
---|
| 0 | + | Helper.WorkOrders[c].TimeSpent = double.Parse(txtTimeSpent.Text); |
---|
| 0 | + | Helper.WorkOrders[c].Substatus = cbSubstatus.SelectedValue.ToString(); |
---|
| 0 | + | Helper.WorkOrders[c].Status = cbStatus.SelectedIndex.ToString(); |
---|
| 0 | + | Helper.WorkOrders[c].Name = txtName.Text; |
---|
| 0 | + | Helper.WorkOrders[c].kWh = (txtkWh.Text != String.Empty) ? int.Parse(txtkWh.Text) : 0; |
---|
| 0 | + | Helper.WorkOrders[c].kVA = (txtkVA.Text != String.Empty) ? int.Parse(txtkVA.Text) : 0; |
---|
| 0 | + | Helper.WorkOrders[c].Peak = (txtPeak.Text != String.Empty) ? int.Parse(txtPeak.Text) : 0; |
---|
| 0 | + | |
---|
| 0 | + | changed = false; |
---|
| 0 | + | miSave.Enabled = false; |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void menuItem1_Click(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | this.Dispose(); |
---|
| 0 | + | this.Close(); |
---|
| 0 | + | Program.Exit(); |
---|
| 0 | + | } |
---|
| 0 | + | |
---|
| 0 | + | private void WorkOrderView_Resize(object sender, EventArgs e) |
---|
| 0 | + | { |
---|
| 0 | + | FormWindowState m = this.WindowState; |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
| 0 | + | } |
---|
... | |
---|