Esempio n. 1
0
        public HttpResponseMessage ChangeOrderStatus(HttpRequestMessage req, RP_ChangeOrderStatus rpChangeOrderStatus)
        {
            if (rpChangeOrderStatus != null)
            {
                RM_ChangeOrderStatus rmChangeOrderStatus = new RM_ChangeOrderStatus();
                List<RPR_ChangeOrderStatus> rprChangeOrderStatus = rmChangeOrderStatus.ChangeOrderStatus(rpChangeOrderStatus);

                if (rmChangeOrderStatus._IsSuccess)
                    return req.CreateResponse<List<RPR_ChangeOrderStatus>>(HttpStatusCode.Created, rprChangeOrderStatus);

                return req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError");
            }

            return req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request");
        }
Esempio n. 2
0
        public List<RPR_ChangeOrderStatus> ChangeOrderStatus(RP_ChangeOrderStatus rpChangeOrderStatus)
        {
            this.SpName = "DigitalMenu_WaiterchangeOrderStatus"; //Sp Name
            _IsSuccess = true;
            try
            {

                // update Delievery qunatity
                if (rpChangeOrderStatus.UpdatedItemDetails != "" || rpChangeOrderStatus.Status == "Kitchen")
                {
                    string[] categoryDetails = new string[4];
                    JArray a = JArray.Parse(rpChangeOrderStatus.UpdatedItemDetails);
                    int count = a.Count;
                    int last_sp_call = 0; // to send Status to searlize json object
                    foreach (JObject o in a.Children<JObject>())
                    {
                        int i = 0;
                        foreach (JProperty p in o.Properties())
                        {
                            categoryDetails[i] = p.Value.ToString();
                            i++;
                        }
                        SqlParameter[] param = new SqlParameter[9];
                        param[0] = new SqlParameter("@key", rpChangeOrderStatus.key);
                        param[1] = new SqlParameter("@RestId", int.Parse(rpChangeOrderStatus.RestId));
                        param[2] = new SqlParameter("@WaiterId", rpChangeOrderStatus.WaitorId);
                        param[3] = new SqlParameter("@ItemId", categoryDetails[1]);
                        param[4] = new SqlParameter("@quantity", int.Parse(categoryDetails[2]));
                        param[5] = new SqlParameter("amount", float.Parse(categoryDetails[3]));
                        param[6] = new SqlParameter("@Status", rpChangeOrderStatus.Status);
                        param[7] = new SqlParameter("@tableNum", rpChangeOrderStatus.TableNo);
                        param[8] = new SqlParameter("@cartId", int.Parse(categoryDetails[0]));
                        ds = db.GetDataSet(this.SpName, param);
                        last_sp_call++;
                        if (last_sp_call == count)
                        {
                            if (ds != null && ds.Tables.Count > 0)
                            {
                                rprNewDelivery = SerializeData.SerializeMultiValue<RPR_ChangeOrderStatus>(ds.Tables[0]);
                            }
                        }

                    } // loop end
                } // update Delivery Quantity End

                else
                {

                    SqlParameter[] param = new SqlParameter[9];
                    param[0] = new SqlParameter("@key", rpChangeOrderStatus.key);
                    param[1] = new SqlParameter("@RestId", int.Parse(rpChangeOrderStatus.RestId));
                    param[2] = new SqlParameter("@WaiterId", rpChangeOrderStatus.WaitorId);
                    param[3] = new SqlParameter("@ItemId", "-1");
                    param[4] = new SqlParameter("@quantity", int.Parse("-1"));
                    param[5] = new SqlParameter("amount", float.Parse("-1"));
                    param[6] = new SqlParameter("@Status", rpChangeOrderStatus.Status);
                    param[7] = new SqlParameter("@tableNum", rpChangeOrderStatus.TableNo);
                    param[8] = new SqlParameter("@cartId", "-1");
                    ds = db.GetDataSet(this.SpName, param);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        rprNewDelivery = SerializeData.SerializeMultiValue<RPR_ChangeOrderStatus>(ds.Tables[0]);
                    }

                }

            }
            catch (Exception ex)
            {
                _IsSuccess = false;
                Logger.WriteLog(LogLevelL4N.ERROR, " change Order status | Exception : " + ex.Message);
            }
            return rprNewDelivery;
        }