Пример #1
0
        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 + "}");
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        //

        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);
        }
Пример #8
0
        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);
        }