public bool insertAll(Int16 costumerid, string name, Int16 orderid, DateTime data, string produs, Decimal valoareOD, Int16 serial, string adress = "", Decimal valoareO = -1) { bool insert = false; using (var testEntities = new TestEntities()) { CUSTOMER c = new CUSTOMER(); c.CUSTOMERID = costumerid; if (testEntities.CUSTOMER.Where(x => x.CUSTOMERID == c.CUSTOMERID).Count() <= 0) { c.NAME = name; c.ADRESA = adress; if (testEntities.ORDER.Where(x => x.ORDERID == orderid).Count() <= 0 && testEntities.ORDERDETAILS.Where(x => x.SERIAL == serial).Count() <= 0) {// nu exita conflicte ORDER o = new ORDER { ORDERID = orderid, DATA = data, CUSTOMERID = costumerid, VALOARE = valoareO }; c.ORDER.Add(o); o.ORDERDETAILS.Add(new ORDERDETAILS { ORDERID = orderid, PRODUS = produs, VALOARE = valoareOD, SERIAL = serial }); testEntities.AddToCUSTOMER(c); testEntities.SaveChanges(); insert = true; } } else { return(false); } } return(insert); }
public bool addOrder(Int16 id, DateTime data, Int16 costumerId, Decimal valoare = -1) { bool added = false; using (var testEntities = new TestEntities()) { ORDER order = new ORDER(); order.ORDERID = id; if (testEntities.ORDER.Where(x => x.ORDERID == order.ORDERID).Count() <= 0) { order.DATA = data; order.CUSTOMERID = costumerId; if (valoare != -1) { order.VALOARE = valoare; } testEntities.AddToORDER(order); testEntities.SaveChanges(); added = true; } else { return(false); } } return(added); }
/// <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); }
public void UpdateOrder(ORDER order) { decimal d; bool ok; if (order.VALOARE != null) // always?? { try { d = Convert.ToDecimal(order.VALOARE); ok = db.updateOrder(Convert.ToInt16(order.ORDERID), order.DATA, Convert.ToInt16(order.CUSTOMERID), d); } catch { } } else { ok = db.updateOrder(Convert.ToInt16(order.ORDERID), order.DATA, Convert.ToInt16(order.CUSTOMERID)); } }
/// <summary> /// Deprecated Method for adding a new object to the ORDER EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToORDER(ORDER oRDER) { base.AddObject("ORDER", oRDER); }
public void DeleteOrder(ORDER order) { bool ok = db.deleteOrder(Convert.ToInt16(order.ORDERID)); }
public ORDER GetOrder(int orderId) { ORDER OR = db.selectOrder(Convert.ToInt16(orderId)); return(OR); }