void textBox1_Leave(object sender, EventArgs e) { // get details of the gaz tank btnFinishFix.Enabled = true; btnOpenTank.Enabled = true; bool error = false; using (GazOnDevEntities db=new GazOnDevEntities()) { if(!string.IsNullOrEmpty(textBox1.Text)) { tanktofix = db.Tank_Stocks.FirstOrDefault(x => (x.TankNumber == textBox1.Text) && ((x.TankSystemStatus == "2") || (x.TankSystemStatus == "3") || (x.TankSystemStatus == "1") || (x.TankSystemStatus == "4"))); if (null == tanktofix) { MessageBox.Show("לא קיים מספר צובר כזה שהקלט לשיפוץ"); return; } if (tanktofix.Id < 1) { error = true; } }else { error = false; } if (error) { MessageBox.Show("לא קיים מספר צובר כזה שהקלט לשיפוץ"); } else { if ((tanktofix.TankSystemStatus == "1") || (tanktofix.TankSystemStatus == "4")) { if (tanktofix.TankSystemStatus == "4") { MessageBox.Show("אתה צופה בצובר שיצא מהמלאי נא לא לערוך "); } else { MessageBox.Show("אתה צופה בצובר שקיים במלאי נא לא לערוך "); } btnFinishFix.Enabled = false; btnOpenTank.Enabled = false; } else { btnFinishFix.Enabled = true; btnOpenTank.Enabled = true; } flowLayoutPanel1.Controls.Clear(); txt_Tank_Size.Text = tanktofix.Tank_Size.ToString(); txt_Tank_Size.Enabled = false; txtmanufacture_name.Text = tanktofix.manufacture_name; txtmanufacture_name.Enabled = false; txtYear_of_manufacture.Text= tanktofix.Year_of_manufacture.ToString(); txtYear_of_manufacture.Enabled = false; comboBox1.SelectedIndex =Convert.ToInt32(tanktofix.tankStatus); txtDate1.Text = tanktofix.Datetime; txtorderingName.Text = tanktofix.GazCompanyName; comboBox1.Enabled = false; FillListView(tanktofix.Id); FillUploadLinks(tanktofix.Id); } } }
/// <summary> /// Deprecated Method for adding a new object to the Tank_Stocks EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToTank_Stocks(Tank_Stocks tank_Stocks) { base.AddObject("Tank_Stocks", tank_Stocks); }
void txtTankNymber_Leave(object sender, EventArgs e) { bool error = false; if (!string.IsNullOrEmpty(txtTankNymber.Text)) { using (GazOnDevEntities db = new GazOnDevEntities()) { tanktofix = db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == txtTankNymber.Text); } if (null == tanktofix) { MessageBox.Show("לא קיים מספר צובר כזה "); return; } if (!string.IsNullOrEmpty(tanktofix.invoiceid)) { MessageBox.Show("צובר עם מספר זה מקושר כבר לתעןדת משלוח מס " + tanktofix.invoiceid); return; } if (tanktofix.Id < 1) { error = true; } } else { error = false; } if (error) { MessageBox.Show("לא קיים מספר צובר כזה "); } else { // button1.Enabled = true; if (tanktofix != null) { txtTankDescription.Text = "צובר " + tanktofix.Tank_Size + " גלון מספר " + tanktofix.TankNumber + ""; } } }
private void btnOpenTank_Click(object sender, EventArgs e) { using (GazOnDevEntities db = new GazOnDevEntities()) { if (edit) { db.Attach(newrecord); db.ObjectStateManager.ChangeObjectState(newrecord, EntityState.Modified); }else { newrecord = new Tank_Stocks(); newrecord.TankNumber = txtTankNumber.Text; newrecord.type = comboBox1.SelectedIndex.ToString(); newrecord.Datetime = txtdate1.Text; newrecord.GazCompanyName = txtGazCompanyName.Text; newrecord.GazCompanyAddress = txtGazCompanyAddress.Text; newrecord.GazDistributor = txtGazDistributor.Text; if (!string.IsNullOrEmpty(txtYear_of_manufacture.Text)) { newrecord.Year_of_manufacture = Convert.ToInt32(txtYear_of_manufacture.Text); } newrecord.Date_of_Fix = Date_Of_Fix.Text; newrecord.manufacture_name = txtmanufacture_name.Text; if (!string.IsNullOrEmpty(txt_Tank_Size.Text)) { newrecord.Tank_Size = txt_Tank_Size.Text; } if (!string.IsNullOrEmpty(txtLabel_Number.Text)) { newrecord.Label_Number =Convert.ToInt32(txtLabel_Number.Text); } newrecord.Address_Tank_From = txt_tank_fromAddress.Text; if (!string.IsNullOrEmpty(txtNumberOfZoklokPort.Text)) { newrecord.NumberOfZoklokPort = Convert.ToInt32(txtNumberOfZoklokPort.Text); } newrecord.tankStatus = combotankStatus.SelectedIndex.ToString(); newrecord.TankWithBase_baton = checkBox1.Checked ? true : false; // means that enabled at the stock newrecord.TankSystemStatus = "1"; db.AddToTank_Stocks(newrecord); dbconf.tanknumber = (Convert.ToInt32(dbconf.tanknumber) + 1).ToString(); db.Attach(dbconf); db.ObjectStateManager.ChangeObjectState(dbconf, EntityState.Modified); } if (db.SaveChanges() > 0) { MessageBox.Show("פעולת ההוספה הצליחה"); } else { } } }
/// <summary> /// Create a new Tank_Stocks object. /// </summary> /// <param name="id">Initial value of the Id property.</param> public static Tank_Stocks CreateTank_Stocks(global::System.Int32 id) { Tank_Stocks tank_Stocks = new Tank_Stocks(); tank_Stocks.Id = id; return tank_Stocks; }
void txtTankNumber_Leave(object sender, EventArgs e) { using (GazOnDevEntities db = new GazOnDevEntities()) { newrecord = db.Tank_Stocks.FirstOrDefault(x => (x.TankNumber == txtTankNumber.Text)); if (null == newrecord) return; if (newrecord.Id > 0) { if (newrecord.TankSystemStatus == "1") { MessageBox.Show("צובר קיים במערכת אתה עובר למצב עריכה "); edit = true; } if (newrecord.TankSystemStatus == "2") { MessageBox.Show("צובר קיים במערכת בסטאטוס המתנה לשיפוץ אי אפשר להביא את הנתונים שלו מכאן נא לגשת לניתוב או לטופס קליטה לשיפוץ "); txtTankNumber.Text = ""; txtTankNumber.Focus(); return; } if (newrecord.TankSystemStatus == "3") { MessageBox.Show("צובר קיים במערכת אבל הוא בשיפוץ אי אפשר להביא את הנתונים שלו מכאן נא לגשת לטופס שיפוץ "); txtTankNumber.Text = ""; txtTankNumber.Focus(); return; } } else { // MessageBox.Show(" אין צובר עם המספר הזה "); // true צובר חדש edit = false; } // newrecord = db.Tank_Stocks.FirstOrDefault(x =>( x.TankNumber == txtTankNumber.Text) &&(x.TankSystemStatus=="1")); if (null != newrecord) { txtTankNumber.Text = newrecord.TankNumber; //comboBox1.SelectedIndex = comboBox1.FindCode(newrecord.type); if (!string.IsNullOrEmpty(newrecord.type)) { comboBox1.SelectedIndex = Convert.ToInt32(newrecord.type); } txtdate1.Text = newrecord.Datetime; txtGazCompanyName.Text = newrecord.GazCompanyName; txtGazCompanyAddress.Text = newrecord.GazCompanyAddress; txtGazDistributor.Text = newrecord.GazDistributor; if (null != newrecord.Year_of_manufacture) { txtYear_of_manufacture.Text = newrecord.Year_of_manufacture.ToString(); } Date_Of_Fix.Text = newrecord.Date_of_Fix; txtmanufacture_name.Text = newrecord.manufacture_name; if (null != newrecord.Tank_Size) { txt_Tank_Size.Text = newrecord.Tank_Size.ToString(); } if (null != newrecord.Label_Number) { txtLabel_Number.Text = newrecord.Label_Number.ToString(); } txt_tank_fromAddress.Text = newrecord.Address_Tank_From; if (null != newrecord.NumberOfZoklokPort) { txtNumberOfZoklokPort.Text = newrecord.NumberOfZoklokPort.ToString(); } if (null != newrecord.tankStatus) { combotankStatus.SelectedIndex = Convert.ToInt32(newrecord.tankStatus); } checkBox1.Checked = (bool)newrecord.TankWithBase_baton; edit = true; } } }
void txtTankNumber_Leave(object sender, EventArgs e) { bool error = false; if(!string.IsNullOrEmpty(txtTankNumber.Text)) { selcted = db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == txtTankNumber.Text); if (null == selcted) { MessageBox.Show("לא קיים מספר צובר כזה "); return; } if (!string.IsNullOrEmpty(selcted.invoiceid)) { MessageBox.Show("צובר עם מספר זה מקושר כבר לתעןדת משלוח מס " + selcted.invoiceid ); return; } if (selcted.Id < 1) { error = true; } }else { error = false; } if (error) { MessageBox.Show("לא קיים מספר צובר כזה "); } else { button1.Enabled = true; tankSize = selcted.Tank_Size.ToString(); labelSize.Text = selcted.Tank_Size.ToString(); tankID = selcted.Id.ToString(); TankNumber = selcted.TankNumber; _Type = "tank"; _Typeid = selcted.Id.ToString(); _Amount = "1"; } }
private void Find_Tank() { /* _ListlsvwTank _listoflsvwWaitingTanks _ListlsvwFixingTanks;_ListlsvwStockTanks; _listoflsvwStock;_listoflsvwInvoices */ using (GazOnDevEntities db = new GazOnDevEntities()) { selected =db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == txttanknumber.Text); switch (selected.TankSystemStatus) { case "1" : _ListlsvwStockTanks.Add(selected); //FIND A //במלאי break; case "2" : //ממתין לשיפוץ _listoflsvwWaitingTanks.Add(selected); break; case "3": //בשיפוץ _ListlsvwFixingTanks.Add(selected); break; case "4": //יצא לתעודת משלוח _ListlsvwTank.Add(selected); break; } } }
private void btnOpenTank_Click(object sender, EventArgs e) { using (GazOnDevEntities db = new GazOnDevEntities()) { if (string.IsNullOrEmpty(txtTankNumber.Text)) { MessageBox.Show("מספר צובר ריק נא להכניס מספר צובר תקין"); txtTankNumber.Text = ""; txtTankNumber.Focus(); return; } if(null !=newrecord) { if (string.IsNullOrEmpty(newrecord.TankNumber)) { MessageBox.Show("מספר צובר ריק נא להכניס מספר צובר תקין"); txtTankNumber.Text = ""; txtTankNumber.Focus(); return; } } if (null == newrecord) { edit = false; } if (edit) { // dbconf.tanknumber = (Convert.ToInt32(dbconf.tanknumber) + 1).ToString(); dbconf.tankfixformnum = (Convert.ToInt32(dbconf.tankfixformnum) + 1).ToString(); db.Attach(dbconf); db.ObjectStateManager.ChangeObjectState(dbconf, EntityState.Modified); db.Attach(newrecord); db.ObjectStateManager.ChangeObjectState(newrecord, EntityState.Modified); } else { newrecord = new Tank_Stocks(); } newrecord.TankNumber = txtTankNumber.Text; newrecord.TankFixNumber = txtfixnumber.Text; newrecord.type = comboBox1.SelectedIndex.ToString(); newrecord.Datetime = txtdate1.Text; newrecord.GazCompanyName = txtGazCompanyName.Text; newrecord.GazCompanyAddress = txtGazCompanyAddress.Text; newrecord.GazDistributor = txtGazDistributor.Text; if (!string.IsNullOrEmpty(txtYear_of_manufacture.Text)) { newrecord.Year_of_manufacture = Convert.ToInt32(txtYear_of_manufacture.Text); } newrecord.Date_of_Fix = Date_Of_Fix.Text; newrecord.manufacture_name = txtmanufacture_name.Text; if (!string.IsNullOrEmpty(txt_Tank_Size.Text)) { newrecord.Tank_Size =txt_Tank_Size.Text; } if (!string.IsNullOrEmpty(txtLabel_Number.Text)) { newrecord.Label_Number = Convert.ToInt32(txtLabel_Number.Text); } newrecord.Address_Tank_From = txt_tank_fromAddress.Text; if (!string.IsNullOrEmpty(txtNumberOfZoklokPort.Text)) { newrecord.NumberOfZoklokPort = Convert.ToInt32(txtNumberOfZoklokPort.Text); } newrecord.tankStatus = combotankStatus.SelectedIndex.ToString(); newrecord.TankWithBase_baton = checkBox1.Checked ? true : false; // means that enabled at the stock //status 2 means that the tank is ready for fix and not in the stock if (newrecord.TankSystemStatus != "3") { newrecord.TankSystemStatus = "2"; } //signed person if (!string.IsNullOrEmpty(txtName_of_recipient.Text)) { newrecord.PersonRecipetsignName = txtName_of_recipient.Text; } if (!string.IsNullOrEmpty(txtSign_of_recipient.Text)) { newrecord.PersonRecipetsignSigniture = txtSign_of_recipient.Text; } // transport Company if (!string.IsNullOrEmpty(txtTransportCompany.Text)) { newrecord.TransportCompanyName = txtTransportCompany.Text; } if (!string.IsNullOrEmpty(txtTransporterName.Text)) { newrecord.TransportCompanyTransportername = txtTransporterName.Text; } if (!string.IsNullOrEmpty(txtCarNumber.Text)) { newrecord.CarNumber = txtCarNumber.Text; } if (!edit) { dbconf.tanknumber = (Convert.ToInt32(dbconf.tanknumber) + 1).ToString(); dbconf.tankfixformnum = (Convert.ToInt32(dbconf.tankfixformnum) + 1).ToString(); db.Attach(dbconf); db.ObjectStateManager.ChangeObjectState(dbconf, EntityState.Modified); db.AddToTank_Stocks(newrecord); } if (db.SaveChanges() > 0) { MessageBox.Show("פעול הצליחה"); //foreach (Control item in this.Controls) //{ // item.Enabled = false; // //if(item.) //} //btnOpenTank.Enabled = false; } } }
void txtTankNumber_Leave(object sender, EventArgs e) { using (GazOnDevEntities db = new GazOnDevEntities()) { newrecord = db.Tank_Stocks.FirstOrDefault(x => (x.TankNumber == txtTankNumber.Text)); newrecord = db.Tank_Stocks.FirstOrDefault(x => (x.TankNumber == txtTankNumber.Text)); if (null == newrecord) return; if (newrecord.Id > 0) { if (newrecord.TankSystemStatus == "2" || newrecord.TankSystemStatus == "3") { MessageBox.Show("צובר קיים במערכת אתה עובר למצב עריכה "); edit = true; } if (newrecord.TankSystemStatus == "1") { MessageBox.Show("צובר קיים במערכת בסטאטוס קיים במלאי אי אפשר להביא את הנתונים שלו מכאן נא לגשת לטופס פתיחת צובר חדש "); txtTankNumber.Text = ""; txtTankNumber.Focus(); return; } //if (newrecord.TankSystemStatus == "3") //{ // MessageBox.Show("צובר קיים במערכת אבל הוא בשיפוץ אי אפשר להביא את הנתונים שלו מכאן נא לגשת לטופס שיפוץ "); // txtTankNumber.Text = ""; // txtTankNumber.Focus(); // return; //} if (string.IsNullOrEmpty(newrecord.TankNumber)) { MessageBox.Show("מספר צובר ריק נא להכניס מספר צובר תקין"); txtTankNumber.Text = ""; txtTankNumber.Focus(); return; } } else { // MessageBox.Show(" אין צובר עם המספר הזה "); // true צובר חדש edit = false; } if (null != newrecord) { txtTankNumber.Text = newrecord.TankNumber; txtfixnumber.Text=newrecord.TankFixNumber; if (!string.IsNullOrEmpty(newrecord.type)) { comboBox1.SelectedIndex = Convert.ToInt32(newrecord.type); } txtdate1.Text = newrecord.Datetime; txtGazCompanyName.Text = newrecord.GazCompanyName; txtGazCompanyAddress.Text = newrecord.GazCompanyAddress; txtGazDistributor.Text = newrecord.GazDistributor; if (null != newrecord.Year_of_manufacture) { txtYear_of_manufacture.Text = newrecord.Year_of_manufacture.ToString(); } Date_Of_Fix.Text = newrecord.Date_of_Fix; txtmanufacture_name.Text = newrecord.manufacture_name; if (null != newrecord.Tank_Size) { txt_Tank_Size.Text = newrecord.Tank_Size.ToString(); } if (null != newrecord.Label_Number) { txtLabel_Number.Text = newrecord.Label_Number.ToString(); } txt_tank_fromAddress.Text = newrecord.Address_Tank_From; if (null != newrecord.NumberOfZoklokPort) { txtNumberOfZoklokPort.Text = newrecord.NumberOfZoklokPort.ToString(); } if (null != newrecord.tankStatus) { combotankStatus.SelectedIndex = Convert.ToInt32(newrecord.tankStatus); } checkBox1.Checked = (bool)newrecord.TankWithBase_baton; //signed person if (!string.IsNullOrEmpty(newrecord.PersonRecipetsignName)) { txtName_of_recipient.Text = newrecord.PersonRecipetsignName; } if (!string.IsNullOrEmpty(newrecord.PersonRecipetsignSigniture)) { txtSign_of_recipient.Text=newrecord.PersonRecipetsignSigniture; } // transport Company if (!string.IsNullOrEmpty( newrecord.TransportCompanyName)) { txtTransportCompany.Text= newrecord.TransportCompanyName; } if (!string.IsNullOrEmpty(newrecord.TransportCompanyTransportername)) { txtTransporterName.Text = newrecord.TransportCompanyTransportername; } if (!string.IsNullOrEmpty(newrecord.CarNumber)) { txtCarNumber.Text = newrecord.CarNumber; } } } }