示例#1
0
        public IHttpActionResult PutOrder_Status(int id, Order_Status order_Status)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != order_Status.Order_Status_ID)
            {
                return(BadRequest());
            }

            db.Entry(order_Status).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Order_StatusExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Order_Status order_Status = db.Order_Status.Find(id);

            db.Order_Status.Remove(order_Status);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
 public ActionResult Edit([Bind(Include = "orderStatusId,status,statusDescription")] Order_Status order_Status)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order_Status).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(order_Status));
 }
        /*
         * retired in favor of GetTablesWithState()
         *
         *
         * public List<Table> GetTablesWithReadyOrders()
         * {
         *  string query = "select * from tables " +
         *      "where Table_ID in " +
         *      "(select Table_ID from Orders where Order_ID in " +
         *      "(select Order_ID from Order_Items where State_ID = 2))";
         *  SqlParameter[] sqlParameters = new SqlParameter[0];
         *  return ReadTables(ExecuteSelectQuery(query, sqlParameters));
         * }
         *
         * public List<Table> GetTablesPending()
         * {
         *  string query = "select * from tables " +
         *      "where Table_ID in " +
         *      "(select Table_ID from Orders where Order_ID in " +
         *      "(select Order_ID from Order_Items where State_ID = 1))";
         *  SqlParameter[] sqlParameters = new SqlParameter[0];
         *  return ReadTables(ExecuteSelectQuery(query, sqlParameters));
         * }
         */
        public List <Table> GetTablesWithState(Order_Status state)
        {
            string query = "select * from tables " +
                           "where Table_ID in " +
                           "(select Table_ID from Orders where Order_ID in " +
                           "(select Order_ID from Order_Items where State_ID = @state))";

            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@state", (int)state);
            return(ReadTables(ExecuteSelectQuery(query, sqlParameters)));
        }
示例#5
0
        public ActionResult Create([Bind(Include = "orderStatusId,status,statusDescription")] Order_Status order_Status)
        {
            if (ModelState.IsValid)
            {
                db.Order_Status.Add(order_Status);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(order_Status));
        }
 public ActionResult Edit([Bind(Include = "orderStatus_id,status,order_id")] Order_Status order_Status)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order_Status).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.order_id = new SelectList(db.Order, "order_id", "orderName", order_Status.order_id);
     return(View(order_Status));
 }
示例#7
0
        public IHttpActionResult GetOrder_Status(int id)
        {
            Order_Status order_Status = db.Order_Status.Find(id);

            if (order_Status == null)
            {
                return(NotFound());
            }

            return(Ok(order_Status));
        }
 public void StateOrderItem(int itemId, Order_Status state)
 {
     try
     {
         kitchenBar_db.Db_State_Order_Items(itemId, state);
     }
     catch
     {
         throw new Exception("  No Database conection!!!  ");
     }
 }
        public ActionResult Create([Bind(Include = "orderStatus_id,status,order_id")] Order_Status order_Status)
        {
            if (ModelState.IsValid)
            {
                db.Order_Status.Add(order_Status);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.order_id = new SelectList(db.Order, "order_id", "orderName", order_Status.order_id);
            return(View(order_Status));
        }
示例#10
0
        public IHttpActionResult PostOrder_Status(Order_Status order_Status)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Order_Status.Add(order_Status);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = order_Status.Order_Status_ID }, order_Status));
        }
        public void Db_State_Order_Items(int itemid, Order_Status state)
        {
            string query = "SET IDENTITY_INSERT Order_Items on; " +
                           "UPDATE Order_Items " +
                           "SET State_ID = @state " +
                           "WHERE Order_Item_ID = @itemid ; " +
                           "SET IDENTITY_INSERT Order_Items off; ";

            SqlParameter[] sqlParameters = new SqlParameter[2];
            sqlParameters[0] = new SqlParameter("@state", (int)state);
            sqlParameters[1] = new SqlParameter("@itemid", itemid);
            ExecuteEditQuery(query, sqlParameters);
        }
示例#12
0
        public IHttpActionResult DeleteOrder_Status(int id)
        {
            Order_Status order_Status = db.Order_Status.Find(id);

            if (order_Status == null)
            {
                return(NotFound());
            }

            db.Order_Status.Remove(order_Status);
            db.SaveChanges();

            return(Ok(order_Status));
        }
示例#13
0
        // GET: Order_Status/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Order_Status order_Status = db.Order_Status.Find(id);

            if (order_Status == null)
            {
                return(HttpNotFound());
            }
            return(View(order_Status));
        }
示例#14
0
        /*
         *  Retired in favor of GetTablesWithState()
         *
         * public List<Table> GetTablesWithReadyOrders()
         * {
         *  List<Table> tables;
         *  try
         *  {
         *      tables = DB.GetTablesWithState();
         *  }
         *  catch (Exception ex)
         *  {
         *      // lost connection to database
         *      throw new Exception(ex.Message);
         *  }
         *  return tables;
         * }
         *
         * public List<Table> GetTablesPending()
         * {
         *  List<Table> tables;
         *  try
         *  {
         *      tables = DB.GetTablesPending();
         *  }
         *  catch (Exception ex)
         *  {
         *      // lost connection to database
         *      throw new Exception(ex.Message);
         *  }
         *  return tables;
         * }
         */

        public List <Table> GetTablesWithState(Order_Status state)
        {
            List <Table> tables;

            try
            {
                tables = DB.GetTablesWithState(state);
            }
            catch (Exception ex)
            {
                // lost connection to database
                throw new Exception(ex.Message);
            }
            return(tables);
        }
        // GET: Order_Status/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Order_Status order_Status = db.Order_Status.Find(id);

            if (order_Status == null)
            {
                return(HttpNotFound());
            }
            ViewBag.order_id = new SelectList(db.Order, "order_id", "orderName", order_Status.order_id);
            return(View(order_Status));
        }
示例#16
0
 public void OrderIsReady(Order order, Order_Status state)               //marking order as ready or pending
 {
     foreach (OrderItem item in order.OrderItems)
     {
         if (order.OrderItems.Contains(item))
         {
             try
             {
                 service.StateOrderItem(item.ItemID, state);
             }
             catch (Exception dbEx)
             {
                 System.Windows.MessageBox.Show(dbEx.Message);
             }
         }
     }
 }
示例#17
0
        /// <summary>
        /// 批量修改网单的状态
        /// </summary>
        /// <param name="OrderId"></param>
        /// <param name="os"></param>
        /// <param name="ServiceId"></param>
        /// <returns></returns>
        public int  UpdateServiceStatus(int[] OrderId, Order_Status os, int ServiceId)
        {
            int      num = 0;
            DateTime ServiceFinishTime = DateTime.Now;
            string   username          = "******";

            if (ServiceId > 0)
            {
                Sys_Users sys_users = new Sys_Users();
                sys_users.Id = ServiceId;
                if (sys_users.Load())
                {
                    username = sys_users.Name;
                }
            }
            for (int i = 0; i < OrderId.Length; i++)
            {
                string sql = string.Format("update OrderStatus set ServiceStatus ='{0}' ,ServiceFinishTime='{1}' where OrderId ='{2}'", os, ServiceFinishTime, OrderId[i]);
                if (m_dbo.ExecuteNonQuery(sql))
                {
                    //修改订单的UserId
                    Order order = new Order();
                    order.Id = OrderId[i];
                    order.Load();
                    order.UserId = ServiceId;
                    order.Save();

                    //添加订单状态明细
                    OrderStatusDetail osd = new OrderStatusDetail();
                    osd.IsInner   = 0;
                    osd.OrderId   = OrderId[i];
                    osd.Status    = "您的订单已通过审核!";
                    osd.UserId    = ServiceId;
                    osd.StatusId  = 2;
                    osd.TPIStatus = CommenClass.Order_Status.已接受.ToString();
                    osd.UserName  = username;
                    if (osd.Save() > 0)
                    {
                        num += 1;
                    }
                }
            }
            return(num);
        }
示例#18
0
        public bool UpdateStatusByOrderId(OrderStatusType StatusType1, Order_Status StatusValue1, DateTime deliveryFinishTime, string orderIds)
        {
            string StatusType  = StatusType1.ToString();
            string StatusValue = StatusValue1.ToString();
            bool   result      = false;
            string sql         = "";

            switch (StatusType)
            {
            case "配送":
                sql    = string.Format("update OrderStatus set DeliveryStatus='{0}',DeliveryFinishTime = '{1}'  where OrderId in ({2})", StatusValue, deliveryFinishTime, orderIds);
                result = m_dbo.ExecuteNonQuery(sql);
                break;

            case "回单":
                sql    = string.Format("update OrderStatus set FeedBackStatus='{0}',FeedBackFinishTime = '{1}'  where OrderId in ({2})", StatusValue, DateTime.Now, orderIds);
                result = m_dbo.ExecuteNonQuery(sql);
                break;
            }
            return(result);
        }
示例#19
0
        public ResultModel UpdateRefundStatus(string OrderID, string OtherRefundNum, Order_Status Status)
        {
            try
            {
                var entity = base.SelectByID(OrderID);
                if (entity != null)
                {
                    entity.RefundStatus   = (int)Status;
                    entity.OtherRefundNum = OtherRefundNum;

                    if (base.Update(entity))
                    {
                        return(Common.MessageRes.OperateSuccess.SetResult("SUCCESS"));
                    }
                }
                return(Common.MessageRes.OperateFailed.SetResult(null));
            }
            catch (Exception ex)
            {
                Common.MYLog.Error("修改退款申请单状态:" + Common.SessionTools.UserName, ex.ToString());
                return((Common.MessageRes.OperateException + ex.ToString()).SetResult(null));
            }
        }
示例#20
0
        /// <summary>
        ///修改订单的状态
        /// ERP FFeedBack.cs 中调用
        /// </summary>
        /// <param name="StatusType1"></param>
        /// <param name="StatusValue1"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public bool UpdateStatus(OrderStatusType StatusType1, Order_Status StatusValue1, int UserId)
        {
            string StatusType  = StatusType1.ToString();
            string StatusValue = StatusValue1.ToString();

            this.Id = Id;
            this.Load();
            string Status   = string.Empty;
            int    IsInner  = -1;
            int    statusId = 0;

            switch (StatusType)
            {
            case "客服":
                this.ServiceStatus = StatusValue;
                this.ServiceId     = UserId;
                if (StatusValue == "已完成")
                {
                    this.ServiceFinishTime = DateTime.Now;
                    Status  = "您的订单已确认";
                    IsInner = 0;
                }
                else
                {
                    IsInner = -1;
                    this.ServiceFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "采购":
                this.PurchaseStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.PurchaseFinishTime = DateTime.Now;
                }
                else if (StatusValue == "已接受")
                {
                    IsInner  = 1;
                    Status   = "采购已接受!";
                    statusId = 3;
                    this.PurchaseFinishTime = new DateTime(1900, 1, 1);
                }
                else
                {
                    IsInner = -1;
                    this.PurchaseFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "仓库":
                this.StoreStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.StoreFinishTime = DateTime.Now;
                    statusId             = 4;
                    Status  = "您商品已出库";
                    IsInner = 1;
                }
                else if (StatusValue == "已接受")
                {
                    IsInner              = 0;
                    Status               = "您的订单正在分拣!";
                    statusId             = 3;
                    this.StoreFinishTime = new DateTime(1900, 1, 1);
                }
                else
                {
                    IsInner = -1;
                    this.StoreFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "配送":
                this.DeliveryStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.DeliveryFinishTime = DateTime.Now;
                    Status   = "您的订单已配送完成!";
                    statusId = 5;
                    IsInner  = 0;
                }
                else if (StatusValue == "已接受")
                {
                    IsInner  = 0;
                    statusId = 4;
                    Status   = "您的订单已分配到配送员,我们会尽快送达!";
                    this.DeliveryFinishTime = new DateTime(1900, 1, 1);
                }
                else
                {
                    IsInner = -1;
                    this.DeliveryFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "回单":
                this.FeedBackStatus = StatusValue;

                if (StatusValue == "已完成")
                {
                    IsInner  = 1;
                    Status   = "订单已完成!";
                    statusId = 6;
                    this.FeedBackFinishTime = DateTime.Now;
                }
                else
                {
                    IsInner = -1;
                    this.FeedBackFinishTime = new DateTime(1900, 1, 1);
                }
                break;
            }
            if (this.Save() > 0)
            {
                if (IsInner >= 0)
                {
                    //添加订单状态明细
                    OrderStatusDetail osd = new OrderStatusDetail();
                    osd.IsInner   = IsInner;
                    osd.OrderId   = this.OrderId;
                    osd.Status    = Status;
                    osd.UserId    = UserId;
                    osd.StatusId  = statusId;
                    osd.TPIStatus = CommenClass.Order_Status.已完成.ToString();
                    if (osd.UserId == 0)
                    {
                        osd.UserName = "******";
                    }
                    else
                    {
                        Sys_Users sys_users = new Sys_Users();
                        sys_users.Id = osd.UserId;
                        if (sys_users.Load())
                        {
                            osd.UserName = sys_users.Name;
                        }
                    }
                    osd.Save();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#21
0
        /// <summary>
        /// 修改订单状态
        /// ERP FFeedBack.cs 中调用
        /// </summary>
        /// <param name="StatusType1"></param>
        /// <param name="StatusValue1"></param>
        /// <param name="deliveryFinishTime"></param>
        /// <returns></returns>
        public bool UpdateStatus(OrderStatusType StatusType1, Order_Status StatusValue1, DateTime deliveryFinishTime)
        {
            string StatusType  = StatusType1.ToString();
            string StatusValue = StatusValue1.ToString();

            this.Id = Id;
            this.Load();
            switch (StatusType)
            {
            case "客服":
                this.ServiceStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.ServiceFinishTime = DateTime.Now;
                }
                else
                {
                    this.ServiceFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "采购":
                this.PurchaseStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.PurchaseFinishTime = DateTime.Now;
                }
                else
                {
                    this.PurchaseFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "仓库":
                this.StoreStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.StoreFinishTime = DateTime.Now;
                }
                else
                {
                    this.StoreFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "配送":
                this.DeliveryStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.DeliveryFinishTime = deliveryFinishTime;
                }
                else
                {
                    this.DeliveryFinishTime = new DateTime(1900, 1, 1);
                }
                break;

            case "回单":
                this.FeedBackStatus = StatusValue;
                if (StatusValue == "已完成")
                {
                    this.FeedBackFinishTime = DateTime.Now;
                }
                else
                {
                    this.FeedBackFinishTime = new DateTime(1900, 1, 1);
                }
                break;
            }
            if (this.Save() > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }