private void button13_Click(object sender, EventArgs e) //delete o { ORDER selo = (ORDER)comboOrder.SelectedItem; context.DeleteObject(selo); int rowsAffected = context.SaveChanges(false); textCh.Text = rowsAffected.ToString() + " changes made to the order (delete)"; }
/// <summary> /// Create a new ORDER object. /// </summary> /// <param name="oRDERID">Initial value of the ORDERID property.</param> /// <param name="dATA">Initial value of the DATA property.</param> /// <param name="cUSTOMERID">Initial value of the CUSTOMERID property.</param> public static ORDER CreateORDER(global::System.Int16 oRDERID, global::System.DateTime dATA, global::System.Int16 cUSTOMERID) { ORDER oRDER = new ORDER(); oRDER.ORDERID = oRDERID; oRDER.DATA = dATA; oRDER.CUSTOMERID = cUSTOMERID; return(oRDER); }
private void comboOrder_SelectedIndexChanged(object sender, EventArgs e) { ORDER selo = (ORDER)comboOrder.SelectedItem; textoid.Text = selo.ORDERID.ToString(); textozi.Text = selo.DATA.Day.ToString(); textoluna.Text = selo.DATA.Month.ToString(); textoan.Text = selo.DATA.Year.ToString(); textocid.Text = selo.CUSTOMERID.ToString(); textovaloare.Text = selo.VALOARE.ToString(); }
/// <summary> /// Deprecated Method for adding a new object to the ORDERs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToORDERs(ORDER oRDER) { base.AddObject("ORDERs", oRDER); }
//insert o private void button5_Click(object sender, EventArgs e) { short cid = Convert.ToInt16(textocid.Text); IQueryable<CUSTOMER> ct = from c in context.CUSTOMERs where c.CUSTOMERID == cid select c; if (ct.Count() <= 0) MessageBox.Show("Invalid Customer ID!"); else { try { ORDER addo = new ORDER(); addo.ORDERID = Convert.ToInt16(context.ORDERs.ToList().Last().ORDERID + 1); DateTime dt = new DateTime(Convert.ToInt32(textoan.Text), Convert.ToInt32(textoluna.Text), Convert.ToInt32(textozi.Text)); addo.DATA = dt; addo.CUSTOMERID = cid; addo.VALOARE = Convert.ToDecimal(textovaloare.Text); context.AddToORDERs(addo); int rowsAffected = context.SaveChanges(false); textCh.Text=rowsAffected.ToString() + " changes made to the orders (insert)"; } catch (ArgumentOutOfRangeException ex) { MessageBox.Show("Invalid Date!"); } } }
/// <summary> /// Create a new ORDER object. /// </summary> /// <param name="oRDERID">Initial value of the ORDERID property.</param> /// <param name="dATA">Initial value of the DATA property.</param> /// <param name="cUSTOMERID">Initial value of the CUSTOMERID property.</param> public static ORDER CreateORDER(global::System.Int16 oRDERID, global::System.DateTime dATA, global::System.Int16 cUSTOMERID) { ORDER oRDER = new ORDER(); oRDER.ORDERID = oRDERID; oRDER.DATA = dATA; oRDER.CUSTOMERID = cUSTOMERID; return oRDER; }