Exemplo n.º 1
0
 public int OrderAdd(Order or)
 {
     int id = 0;
     DataTable dt = new DataTable();
     dt = db.execQuery("Sp_OrderAdd", new object[] { or.supplier_id });
     if (dt.Rows.Count > 0)
     {
         id = Convert.ToInt16(dt.Rows[0]["id"].ToString());
     }
     return id;
 }
Exemplo n.º 2
0
 public string OrderAdd(Order or, List<OrderProduct> orp)
 {
     String msg = "Data sucessfully saved";
     db.beginTransaction();
     try
     {
         int id = dao.OrderAdd(or);
         foreach (OrderProduct prodMod in orp)
         {
             dao.OrderProductAdd(id, prodMod);
         }
         db.commitTrans();
     }
     catch (Exception ex)
     {
         db.rollBackTrans();
         msg = ex.Message;
     }
     return msg;
 }
Exemplo n.º 3
0
 public void OrderModify(Order or)
 {
     db.execQuery("Sp_OrderModify", new object[] { or.order_id, or.supplier_id });
 }
Exemplo n.º 4
0
 public string OrderModify(Order or, List<OrderProduct> orp)
 {
     String msg = "Data successfully saved";
     db.beginTransaction();
     try
     {
         int id = or.order_id;
         foreach (OrderProduct prodMod in orp)
         {
             dao.OrderProductModify(id, prodMod);
         }
         db.commitTrans();
     }
     catch (MyException.OutOfStock ex)
     {
         msg = ex.Message;
         db.rollBackTrans();
     }
     catch (Exception ex)
     {
         db.rollBackTrans();
         throw ex;
     }
     return msg;
 }