public async Task <string> addNewOrder(tx_orders element) { int res = -1; orders_manager mng = new orders_manager(); res = mng.createNewOrder(element); cms_manager cms_mng = new cms_manager(); int isUserExsist = cms_mng.isUserExist(element.phone); if (isUserExsist == -1) { int result = await cms_mng.createNewUser(element.phone); if (result == -1) { res = -1; } else { } } return("{\"result\": " + res + "}"); }
public int setDriver(int orderID, string driverID) { int res = -1; try { orders_manager mng = new orders_manager(); tx_orders element = mng.getOrder(orderID); element.driver = driverID; res = mng.updateOrder(element); } catch (Exception ex) { Error_manager errorMng = new Error_manager(); errorMng.LogError(ex); return(res); } return(res); }
public tx_orders getOrder(int orderID) { tx_orders res = null; try { res = db.tx_orders.Where(x => x.ID == orderID).ToList().FirstOrDefault(); } catch (Exception ex) { Error_manager mng = new Error_manager(); mng.LogError(ex); return(res); } return(res); }
public int updateOrder(tx_orders element) { int res = -1; try { Repository mng = new Repository(); res = mng.updateOrder(element); } catch (Exception ex) { Error_manager ErrorMng = new Error_manager(); ErrorMng.LogError(ex); return(res); } return(res); }
public int updateOrder(tx_orders element) { int res = -1; try { db.Entry(element).State = EntityState.Modified; db.SaveChanges(); res = 1; } catch (Exception ex) { Error_manager mng = new Error_manager(); mng.LogError(ex); return(res); } return(res); }
public int addOrder(tx_orders newItem) { int res = 0; try { db.tx_orders.Add(newItem); db.SaveChanges(); res = 1; } catch (Exception ex) { Error_manager mng = new Error_manager(); mng.LogError(ex); res = -1; return(res); } return(res); }
// public tx_orders getOrder(int orderID) { tx_orders res = null; try { Repository mng = new Repository(); res = mng.getOrder(orderID); } catch (Exception ex) { Error_manager ErrorMng = new Error_manager(); ErrorMng.LogError(ex); return(res); } return(res); }
public int doneOrder(int orderID) { int res = -1; try { orders_manager mng = new orders_manager(); tx_orders element = mng.getOrder(orderID); element.status = "done"; res = mng.updateOrder(element); } catch (Exception ex) { Error_manager errorMng = new Error_manager(); errorMng.LogError(ex); return(res); } return(res); }