Exemple #1
0
        //GCM Notify Waitor
        protected void NotifyWaitor(RP_OrderItem rpOrderItem, string status)
        {
            if (Status.Equals('1'))
            {
                this.SpName = "DigitalMenu_GetGCMRegId"; //Sp Name
                try
                {
                    SqlParameter[] param = new SqlParameter[2];
                    param[0] = new SqlParameter("@WaitorId", rpOrderItem.WaiterId);
                    param[1] = new SqlParameter("@RestId", int.Parse(rpOrderItem.RestId));
                    // param[2] = new SqlParameter("@TableId", rpOrderItem.TableId);

                    ds = db.GetDataSet(this.SpName, param);
                    string RegId = "";
                    string msg = "";
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        DataRowCollection drc = ds.Tables[0].Rows;
                        foreach (DataRow item in drc)
                        {
                            RegId = "" + item["RegID"];

                        }
                        msg = "Order From Table" + rpOrderItem.TableId;
                        AndroidGCMPushNotification apnGCM = new AndroidGCMPushNotification();
                        //apnGCM.SendNotification(RegId, msg);

                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteLog(LogLevelL4N.ERROR, " Unable To Send Notification: | Exception : " + ex.Message);
                }

            }
        }
        public HttpResponseMessage OrderItem(HttpRequestMessage req, RP_OrderItem rpOrderItem)
        {
            if (rpOrderItem != null)
            {
                RM_OrderItem rmOrderItem = new RM_OrderItem();
                List<RPR_OrderItem> rprOrderItem = rmOrderItem.OrderItem(rpOrderItem);
                if (rmOrderItem._IsSuccess)
                    return req.CreateResponse<List<RPR_OrderItem>>(HttpStatusCode.Created, rprOrderItem);

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

            return req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request");
        }
Exemple #3
0
        public List<RPR_OrderItem> OrderItem(RP_OrderItem rpOrderItem)
        {
            this.SpName = "DigitalMenu_OrderItem"; //Sp Name
            _IsSuccess = true;
            try
            {
                string[] categoryDetails = new string[4];
                JArray a = JArray.Parse(rpOrderItem.ItemDetails);
                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("@RestId", int.Parse(rpOrderItem.RestId));
                    param[1] = new SqlParameter("@cusId", int.Parse(rpOrderItem.CusId));
                    param[2] = new SqlParameter("@key", rpOrderItem.key);
                    param[3] = new SqlParameter("@waiterId", rpOrderItem.WaiterId);
                    param[4] = new SqlParameter("@tableNum", rpOrderItem.TableId);
                    param[5] = new SqlParameter("@itemId", categoryDetails[0]);
                    param[6] = new SqlParameter("@qunatity", int.Parse(categoryDetails[2]));
                    param[7] = new SqlParameter("@price", float.Parse(categoryDetails[1]));
                    param[8] = new SqlParameter("@amount", float.Parse(categoryDetails[3]));

                    ds = db.GetDataSet(this.SpName, param);
                    last_sp_call++;
                    if (last_sp_call == count)
                    {
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            rprOrderItem = SerializeData.SerializeMultiValue<RPR_OrderItem>(ds.Tables[0]);
                        }
                    } //if end

                } //foreach end

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

            return rprOrderItem;
        }