private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.comboBox1.SelectedValue != null) { selected = (Accompanying_stocks)this.comboBox1.SelectedItem; txteditAmount.Text = selected.Count; button1.Enabled = true; // CurrentAmount = selected.Count; /*MessageBox.Show(selcted.Title); MessageBox.Show(selcted.Id.ToString());*/ } }
public TankInvoice() { InitializeComponent(); dataGridView1.CellClick+=new DataGridViewCellEventHandler(dataGridView1_CellClick); dataGridView1.KeyDown +=new KeyEventHandler(dataGridView1_KeyDown); this.RightToLeft = Gizmox.WebGUI.Forms.RightToLeft.Yes; txtinvoiceid.Leave += new EventHandler(txtinvoiceid_Leave); txtTankNymber.Leave += new EventHandler(txtTankNymber_Leave); dataGridView1.AllowUserToAddRows = true; dataGridView1.ReadOnly = false; dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2; //dataGridView1.KeyDown+=new KeyEventHandler(dataGridView1_KeyDown); //dataGridView1.KeyPress += new KeyPressEventHandler(dataGridView1_KeyPress); using (GazOnDevEntities db= new GazOnDevEntities()) { dbconf= db.Configdbs.FirstOrDefault(); txtinvoiceid.Text = dbconf.invoicelastid; var query = from p in db.Accompanying_stocks where p.isininvoice == true orderby p.invoiceorder ascending select p; List<Accompanying_stocks> newstocklist = new List<Accompanying_stocks>(query.ToList<Accompanying_stocks>()); Accompanying_stocks temp=new Accompanying_stocks(); int k = 1; foreach (Accompanying_stocks item in newstocklist) { invoiceitem invitm=new invoiceitem(); invitm.invoiceid =txtinvoiceid.Text; invitm.title =item.Title; invitm.type = "stock"; invitm.typeid = item.Id.ToString(); invitm.num = k.ToString(); k++; _currentinvoiceitems.Add(invitm); } bindingSource1.DataSource = _currentinvoiceitems; //stocklist.Add(temp); //stocklist.Add(temp); // must icrease id of invoice id ; } // textBox1.Leave += new EventHandler(textBox1_Leave); }
private void btnOpenTank_Click(object sender, EventArgs e) { //MessageBox.Show("הוספת פריט למלאי נלווה"); using (GazOnDevEntities db=new GazOnDevEntities()) { Accompanying_stocks newrecord = new Accompanying_stocks(); newrecord.Count = txtStockAmount.Text; newrecord.Title = txtStockTitle.Text; db.AddToAccompanying_stocks(newrecord); int result = db.SaveChanges(); if (result > 0) { MessageBox.Show("פריט התווסף למלאי בהצלחה "+result); } } }
/// <summary> /// Create a new Accompanying_stocks object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="count">Initial value of the Count property.</param> public static Accompanying_stocks CreateAccompanying_stocks(global::System.Int32 id, global::System.String title, global::System.String count) { Accompanying_stocks accompanying_stocks = new Accompanying_stocks(); accompanying_stocks.Id = id; accompanying_stocks.Title = title; accompanying_stocks.Count = count; return accompanying_stocks; }
/// <summary> /// Deprecated Method for adding a new object to the Accompanying_stocks EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAccompanying_stocks(Accompanying_stocks accompanying_stocks) { base.AddObject("Accompanying_stocks", accompanying_stocks); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { //this.bindingSource1.RemoveFilter(); // if (this.comboBox1.SelectedValue != null) // { // //Set Filter for 'Orders' DataSources that it contains orders only of selected customer. // this.bindingSource1.Filter = string.Format("Id='{0}'", this.comboBox1.SelectedValue.ToString()); // } if (this.comboBox1.SelectedValue != null) { selected = (Accompanying_stocks)this.comboBox1.SelectedItem; txteditmakat.Text = selected.makat; //txteditAmount.Text = selected.Count; txteditAmountCurrent.Text = selected.Count; button1.Enabled = true; // CurrentAmount = selected.Count; /*MessageBox.Show(selcted.Title); MessageBox.Show(selcted.Id.ToString());*/ } }
void txteditmakat_Leave1(object sender, EventArgs e) { //txteditmakat using (GazOnDevEntities db = new GazOnDevEntities()) { selected = db.Accompanying_stocks.FirstOrDefault(x => x.makat == textmakat.Text); // comboBox1.sele = selected. //comboBox1.FindStringExact(selected.Title) if (null != selected) { if (comboBox1.FindStringExact(selected.Title) >0 ) { comboBox1.SelectedIndex = comboBox1.FindStringExact(selected.Title); MessageBox.Show("הפריט קיים במלאי אתה מועבר למצב עריכה"); } } // comboBox1.Items } }
void txteditmakat_Leave(object sender, EventArgs e) { //txteditmakat using (GazOnDevEntities db = new GazOnDevEntities()) { selected = db.Accompanying_stocks.FirstOrDefault(x => x.makat == txteditmakat.Text); // comboBox1.sele = selected. //comboBox1.FindStringExact(selected.Title) comboBox1.SelectedIndex = comboBox1.FindStringExact(selected.Title); } }
private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e) { if (this.comboBox1.SelectedValue != null) { selcted = (Accompanying_stocks)this.comboBox1.SelectedValue; CurrentAmount = selcted.Count; /*MessageBox.Show(selcted.Title); MessageBox.Show(selcted.Id.ToString());*/ } }