Пример #1
0
        public JObject ListFeedBack()
        {
            var ObjInfo = Request.Cookies["UserInfo"];
            int OrgId   = int.Parse(ObjInfo["OrgId"]);
            HG_OrganizationDetails orgobj = new HG_OrganizationDetails().GetOne(OrgId);
            int OrgType = orgobj.OrgTypes != null?int.Parse(orgobj.OrgTypes) : 1;

            List <HG_Floor_or_ScreenMaster> floorOrScreens   = new HG_Floor_or_ScreenMaster().GetAll(OrgType);
            List <HG_Tables_or_Sheat>       tableOrSheatlist = new HG_Tables_or_Sheat().GetAll(OrgType);
            JObject FeedBackObj = new JObject();
            var     feedbklist  = FeedbkForm.GetAll(OrgId);
            JArray  jArrayfdbk  = new JArray();

            foreach (var feedback in feedbklist)
            {
                JObject jObject = JObject.FromObject(feedback);
                jObject.Add("Create", feedback.CreateDate.ToString("dd/MM/yyyy HH:mm"));
                jArrayfdbk.Add(jObject);
            }
            FeedBackObj.Add("FormList", jArrayfdbk);
            JArray jArray = new JArray();

            foreach (HG_Floor_or_ScreenMaster Floors in floorOrScreens)
            {
                JObject jObject = JObject.FromObject(Floors);
                jObject.Add("TableSheatList", JArray.FromObject(tableOrSheatlist.FindAll(x => x.Floor_or_ScreenId == Floors.Floor_or_ScreenID)));
                jArray.Add(jObject);
            }
            FeedBackObj.Add("FloorList", jArray);
            return(FeedBackObj);
        }
Пример #2
0
        public ActionResult TakeAwayIndex()
        {
            HG_Tables_or_Sheat        ObjTable  = new HG_Tables_or_Sheat();
            List <HG_Tables_or_Sheat> listtable = ObjTable.GetAll(3);

            return(View(listtable));
        }
Пример #3
0
        public ActionResult SheetIndex(int Type)
        {
            HG_Tables_or_Sheat        ObjTable  = new HG_Tables_or_Sheat();
            List <HG_Tables_or_Sheat> listtable = ObjTable.GetAll(Type);

            return(View(listtable));
        }
Пример #4
0
        public ActionResult DiscntCharges(Int64 SeatingId, int Type = 0, int ID = 0, Int64 OID = 0)
        {
            OrdDiscntChrge ordDiscntChrge = new OrdDiscntChrge();

            if (SeatingId > 0)
            {
                HG_Tables_or_Sheat SeatingObj = new HG_Tables_or_Sheat().GetOne(SeatingId);
                List <HG_Orders>   orders     = new HG_Orders().GetListByGetDate(DateTime.Now, DateTime.Now);
                var ObjOrder = orders.Find(x => x.Table_or_SheatId == SeatingId && x.TableOtp == SeatingObj.Otp);
                if (ObjOrder != null && ObjOrder.Status != "3" && ObjOrder.Status != "4")
                {
                    ordDiscntChrge.OID = ObjOrder.OID;
                }
                ordDiscntChrge.Type       = Type;
                ordDiscntChrge.SeatingId  = SeatingId;
                ordDiscntChrge.SeatingOtp = SeatingObj.Otp;
            }
            else if (ID > 0)
            {
                ordDiscntChrge = OrdDiscntChrge.GetOne(ID);
                Type           = ordDiscntChrge.Type;
            }
            else if (OID > 0 && Type != 0)
            {
                ordDiscntChrge.Type = Type;
                ordDiscntChrge.OID  = OID;
            }


            return(View(ordDiscntChrge));
        }
Пример #5
0
        public static Feedbk SubmitFeedBk(Int64 OID)
        {
            Feedbk feedBack = Feedbk.GetOne(OID);

            //    public int FeedBkId { get; set; }
            //public int OrgId { get; set; }
            //public Int64 OrderId { get; set; }
            //public int FeedbkFormId { get; set; }
            if (feedBack.FeedBkId == 0)
            {
                HG_Orders          hG_Orders          = new HG_Orders().GetOne(OID);
                HG_Tables_or_Sheat hG_Tables_Or_Sheat = new HG_Tables_or_Sheat().GetOne(hG_Orders.Table_or_SheatId);

                feedBack = new Feedbk();
                feedBack.FeedbkFormId = hG_Tables_Or_Sheat.FDBKId;
                feedBack.OrgId        = hG_Orders.OrgId;
                feedBack.OrderId      = OID;
                feedBack.save();
                return(feedBack);
            }
            else
            {
                return(feedBack);
            }
        }
Пример #6
0
        public JObject SeatingList(int CBID, int Orgid = 0)
        {
            if (Orgid == 0)
            {
                Orgid = OrderType.CurrOrgId();
            }
            HG_OrganizationDetails orgobj = new HG_OrganizationDetails().GetOne(Orgid);
            int OrgType = orgobj.OrgTypes != null?int.Parse(orgobj.OrgTypes) : 1;

            Cashback cashback = Cashback.Getone(CBID);
            List <HG_Floor_or_ScreenMaster> floorOrScreens   = new HG_Floor_or_ScreenMaster().GetAll(OrgType);
            List <HG_Tables_or_Sheat>       tableOrSheatlist = new HG_Tables_or_Sheat().GetAll(OrgType);
            JObject    OrderMenus  = new JObject();
            List <int> Seatings    = new List <int>();
            List <int> RedSeatings = new List <int>();

            RedSeatings = Cashback.GetRedSeatings(cashback);
            if (cashback.SeatingIds != "")
            {
                Seatings = cashback.SeatingIds.Split(',').Select(int.Parse).ToList();
            }
            JArray jArray = new JArray();

            foreach (HG_Floor_or_ScreenMaster Floors in floorOrScreens)
            {
                JObject jObject = JObject.FromObject(Floors);
                jObject.Add("TableSheatList", JArray.FromObject(tableOrSheatlist.FindAll(x => x.Floor_or_ScreenId == Floors.Floor_or_ScreenID)));
                jArray.Add(jObject);
            }
            OrderMenus.Add("FloorList", jArray);
            OrderMenus.Add("ExistingSeatings", JArray.FromObject(Seatings));
            OrderMenus.Add("RedSeatings", JArray.FromObject(RedSeatings));
            return(OrderMenus);
        }
Пример #7
0
        public ActionResult CreateEdit(int ID)
        {
            HG_Tables_or_Sheat ObjTable = new HG_Tables_or_Sheat();

            ObjTable.Type = "1";
            if (ID > 0)
            {
                ObjTable = ObjTable.GetOne(ID);
            }
            return(View(ObjTable));
        }
Пример #8
0
        public ActionResult CreateTakeAway(int Id)
        {
            HG_Tables_or_Sheat ObjTable = new HG_Tables_or_Sheat();

            if (Id > 0)
            {
                ObjTable = ObjTable.GetOne(Id);
            }
            else
            {
                ObjTable.Table_or_RowID = 0;
                ObjTable.Type           = "3";
                ObjTable.QrCode         = "";
                ObjTable.Status         = 1;
            }
            return(View(ObjTable));
        }
Пример #9
0
        public ActionResult SheetCreateEdit(HG_Tables_or_Sheat ObjTable)
        {
            if (ObjTable.QrCode == null || ObjTable.QrCode.Replace(" ", "") == "")
            {
                return(Json(new { msg = "Please Enter Qr Code" }));
            }
            List <HG_Tables_or_Sheat> ListOfSeat = new HG_Tables_or_Sheat().GetAll(2);//Sheat
            var SeatExt = ListOfSeat.Find(x => x.Table_or_SheetName.ToUpper() == ObjTable.Table_or_SheetName.ToUpper() && (x.Floor_or_ScreenId == ObjTable.Floor_or_ScreenId) && (x.FloorSide_or_RowNoID == ObjTable.FloorSide_or_RowNoID) && x.Table_or_RowID != ObjTable.Table_or_RowID);

            if (SeatExt != null)
            {
                return(Json(new { msg = "Same Seating Already Exist" }));
            }
            HG_Tables_or_Sheat TorSAlreadyObj = new HG_Tables_or_Sheat().GetOne(QrOcde: ObjTable.QrCode);

            if (ObjTable.OrgId == 0)
            {
                var ObjOrg = Request.Cookies["UserInfo"];
                ObjTable.OrgId = int.Parse(ObjOrg["OrgId"]);
            }
            if (TorSAlreadyObj != null && TorSAlreadyObj.QrCode != "0" && TorSAlreadyObj.Table_or_RowID > 0 && TorSAlreadyObj.Table_or_RowID != ObjTable.Table_or_RowID)
            {
                string QrMsg = "Qr Code Already used ";
                if (TorSAlreadyObj.OrgId != ObjTable.OrgId)
                {
                    QrMsg = "Qr Code Already used For Other Organization";
                }
                return(Json(new { msg = QrMsg }));
            }
            Int64 i = ObjTable.save();

            if (i > 0)
            {
                HG_Floor_or_ScreenMaster ObjScr     = new HG_Floor_or_ScreenMaster().GetOne(ObjTable.Floor_or_ScreenId);
                HG_FloorSide_or_RowName  ObjRowName = new HG_FloorSide_or_RowName().GetOne(ObjTable.FloorSide_or_RowNoID);
                JObject jObject = JObject.FromObject(ObjTable);
                jObject.Add("ScreenName", ObjScr.Name);
                jObject.Add("RowName", ObjRowName.FloorSide_or_RowName);
                return(Json(new { data = jObject.ToString() }, JsonRequestBehavior.AllowGet));
            }

            return(RedirectToAction("Error"));
        }
Пример #10
0
        public ActionResult SaveTakeAway(HG_Tables_or_Sheat ObjTakeAway)
        {
            if (ObjTakeAway.QrCode == null)
            {
                ObjTakeAway.QrCode = "";
            }
            if (ObjTakeAway.OrgId == 0)
            {
                var ObjOrg = Request.Cookies["UserInfo"];
                ObjTakeAway.OrgId = int.Parse(ObjOrg["OrgId"]);
            }
            Int64 i = ObjTakeAway.save();

            if (i > 0)
            {
                return(RedirectToAction("TakeAwayIndex"));
            }
            return(RedirectToAction("Error"));
        }
Пример #11
0
        public ActionResult Delete(int ID)
        {
            HG_FloorSide_or_RowName ObjFscr = new HG_FloorSide_or_RowName().GetOne(ID);

            if (ObjFscr != null)
            {
                List <HG_Tables_or_Sheat> ListTorS = new HG_Tables_or_Sheat().GetAll(int.Parse(ObjFscr.Type));
                ListTorS = ListTorS.FindAll(x => x.FloorSide_or_RowNoID == ObjFscr.ID);
                if (ListTorS.Count > 0)
                {
                    return(Json(new { msg = "Already Used In Seating " }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    int id = HG_FloorSide_or_RowName.Dell(ID);
                }
            }
            return(Json(new { data = "1" }, JsonRequestBehavior.AllowGet));
        }
Пример #12
0
        public int ActiveForm([System.Web.Http.FromBody] ActiveMenu activeMenu)
        {
            //var Jobj = { };
            //Jobj.OMID = MenuId;
            //Jobj.TorSIDs = TableList;
            //Jobj.OrgId = OrgId;
            int status = 0;
            int FID    = activeMenu.OMID;
            int OrgId  = activeMenu.OrgId;
            HG_OrganizationDetails hG_OrganizationDetails = new HG_OrganizationDetails().GetOne(OrgId);
            string            OrgType      = hG_OrganizationDetails.OrgTypes != null ? hG_OrganizationDetails.OrgTypes : "1";
            List <FeedbkForm> FeedBackList = FeedbkForm.GetAll(OrgId);
            FeedbkForm        FeedBkObj    = FeedBackList.Find(x => x.Id == FID);

            FeedBkObj.Status = true;
            FeedBkObj.Save();
            List <HG_Tables_or_Sheat> TorSlist = new HG_Tables_or_Sheat().GetAll(int.Parse(OrgType));
            var AlreadySelectedList            = TorSlist.FindAll(x => x.FDBKId == FID);

            Int64[]         items    = activeMenu.TorSIDs;
            HashSet <Int64> hashKeys = new HashSet <Int64>();

            if (items != null && items.Length > 0)
            {
                hashKeys = new HashSet <Int64>(items);
            }
            var RemovedTorSList = AlreadySelectedList.FindAll(x => !hashKeys.Contains(x.Table_or_RowID));
            List <HG_Tables_or_Sheat> OnlyApplytoTorS = TorSlist.FindAll(x => hashKeys.Contains(x.Table_or_RowID));

            foreach (var TorSobj in OnlyApplytoTorS)
            {
                TorSobj.FDBKId = FID;
                TorSobj.save();
            }

            foreach (var TorSobj in RemovedTorSList)
            {
                TorSobj.FDBKId = 0;
                TorSobj.save();
            }
            return(status);
        }
Пример #13
0
        public ActionResult Delete(int ID)
        {
            HG_Tables_or_Sheat ObjTable = new HG_Tables_or_Sheat().GetOne(ID);

            if (ObjTable != null)
            {
                List <HG_Orders> listord = new HG_Orders().GetAll(ObjTable.OrgId);
                listord = listord.FindAll(x => x.Table_or_SheatId == ObjTable.Table_or_RowID);
                if (listord.Count > 0)
                {
                    // Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return(Json(new { msg = "Already Used in " + listord.Count.ToString() + " Orders" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    HG_Tables_or_Sheat.Dell(ObjTable.Table_or_RowID);
                }
            }
            return(Json(new { data = "1" }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Upload(int OrgID, System.Web.HttpPostedFileBase UplXl)
        {
            string msg = "Uploaded Succesfully";

            if (OrgID <= 0)
            {
                return(Json(new { msg = "Select Organization First" }));
            }
            if (UplXl == null)
            {
                return(Json(new { msg = "Upload Excel File First" }));
            }
            try
            {
                UplXl.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Image/"), UplXl.FileName));
                var DT = ReadExl.ReadExcelFileDT("~/Image/" + UplXl.FileName);
                if (DT.Rows.Count > 0)
                {
                    HG_OrganizationDetails ObjOrg = new HG_OrganizationDetails().GetOne(OrgID);
                    int OrgType = int.Parse(ObjOrg.OrgTypes);
                    List <HG_Tables_or_Sheat>       ListTorS           = new HG_Tables_or_Sheat().GetAll(OrgType, OrgID);
                    List <HG_Floor_or_ScreenMaster> ListFlrScr         = new HG_Floor_or_ScreenMaster().GetAll(OrgType, OrgID);
                    List <HG_FloorSide_or_RowName>  ListFsideorRowName = new HG_FloorSide_or_RowName().GetAll(OrgType, OrgID);
                    for (int i = 1; i < DT.Rows.Count; i++)
                    {
                        string TableorSheatName = (DT.Rows[i][0] == null ? "" : DT.Rows[i][0].ToString());
                        string FlrOrScrName     = (DT.Rows[i][1] == null?"": DT.Rows[i][1].ToString());
                        string FlrSideOrRowName = (DT.Rows[i][2] == null ? "" : DT.Rows[i][2].ToString());
                        string QrCode           = (DT.Rows[i][3] == null ? "" : DT.Rows[i][3].ToString().Replace(" ", ""));
                        string QrCodeOld        = QrCode;
                        if (QrCode == "" || QrCode.Trim() == "" || QrCode == "0")
                        {
                            QrCode = "0";
                        }
                        else
                        {
                            HG_Tables_or_Sheat TorSAlreadyObj = new HG_Tables_or_Sheat().GetOne(QrOcde: QrCode);
                            if (TorSAlreadyObj != null && TorSAlreadyObj.QrCode != "0" && TorSAlreadyObj.QrCode != "" && TorSAlreadyObj.Table_or_RowID > 0)
                            {
                                QrCode = "0";
                            }
                        }

                        var ObjFlrScr        = ListFlrScr.Find(x => x.Name.ToUpper() == FlrOrScrName.ToUpper());
                        var ObjFsideOrRoName = ListFsideorRowName.Find(x => x.FloorSide_or_RowName.ToUpper() == FlrSideOrRowName.ToUpper());
                        if (ObjFlrScr == null && FlrOrScrName.Replace(" ", "") != "")
                        {
                            ObjFlrScr       = new HG_Floor_or_ScreenMaster();
                            ObjFlrScr.Name  = FlrOrScrName;
                            ObjFlrScr.Type  = ObjOrg.OrgTypes;
                            ObjFlrScr.OrgID = OrgID;
                            ObjFlrScr.save();
                            ListFlrScr.Add(ObjFlrScr);
                        }
                        if (ObjFsideOrRoName == null && FlrSideOrRowName.Replace(" ", "") != "")
                        {
                            ObjFsideOrRoName = new HG_FloorSide_or_RowName();
                            ObjFsideOrRoName.FloorSide_or_RowName = FlrSideOrRowName;
                            ObjFsideOrRoName.OrgID = OrgID;
                            ObjFsideOrRoName.Type  = ObjOrg.OrgTypes;
                            ObjFsideOrRoName.save();
                            ListFsideorRowName.Add(ObjFsideOrRoName);
                        }
                        if (ObjFsideOrRoName != null && ObjFlrScr != null)
                        {
                            var ObjTblOrShtExit = ListTorS.Find(x => x.Table_or_SheetName.ToUpper() == TableorSheatName.ToUpper() && (x.Floor_or_ScreenId == ObjFlrScr.Floor_or_ScreenID) && (x.FloorSide_or_RowNoID == ObjFsideOrRoName.ID));
                            if (ObjTblOrShtExit == null && TableorSheatName.Replace(" ", "") != "")
                            {
                                HG_Tables_or_Sheat hG_Tables_Or_Sheat = new HG_Tables_or_Sheat();
                                hG_Tables_Or_Sheat.OrgId = OrgID;
                                hG_Tables_Or_Sheat.Type  = ObjOrg.OrgTypes;
                                hG_Tables_Or_Sheat.Table_or_SheetName   = TableorSheatName;
                                hG_Tables_Or_Sheat.QrCode               = QrCode;
                                hG_Tables_Or_Sheat.Floor_or_ScreenId    = ObjFlrScr.Floor_or_ScreenID;
                                hG_Tables_Or_Sheat.FloorSide_or_RowNoID = ObjFsideOrRoName.ID;
                                hG_Tables_Or_Sheat.save();
                                ListTorS.Add(hG_Tables_Or_Sheat);
                            }
                            else if (ObjTblOrShtExit != null && (ObjTblOrShtExit.QrCode != QrCodeOld) && (QrCode != ""))
                            {
                                ObjTblOrShtExit.QrCode = QrCode;
                                ObjTblOrShtExit.save();
                            }
                        }
                        else
                        {
                            msg = "Uploaded Succesfully. With Some Data Missing";
                        }
                    }
                }
                else
                {
                    return(Json(new { msg = "No Any Row Founds" }));
                }
            }
            catch (Exception e)
            {
                return(Json(new { msg = "Error " + e.Message }));
            }
            return(Json(new { msg = msg }, JsonRequestBehavior.AllowGet));
        }
Пример #15
0
        //=========FEEDBACK API===========
        public JObject FeedBack(Int64 OID, int CID)
        {
            HG_Orders          hG_Orders = new HG_Orders().GetOne(OID);
            HG_Tables_or_Sheat Seating   = new HG_Tables_or_Sheat().GetOne(hG_Orders.Table_or_SheatId);
            JObject            respose   = new JObject();

            if (Seating.FDBKId > 0)// feedback applied in seating
            {
                FeedbkForm         feedbkForm   = FeedbkForm.GetOne(Seating.FDBKId);
                List <FeedBackQue> feedBackQues = FeedBackQue.GetAll(feedbkForm.Id);
                feedBackQues = feedBackQues.FindAll(x => x.Status);
                feedBackQues = feedBackQues.OrderBy(x => x.OrderNo).ToList();
                respose.Add("Status", 200);
                JArray jArray = new JArray();
                foreach (var question in feedBackQues)
                {
                    JObject jObject = new JObject();
                    jObject.Add("QID", question.ID);
                    jObject.Add("Title", question.Title);
                    jObject.Add("QuestionType", question.QuestionType);
                    jObject.Add("FeedBkFormID", question.FeedBkFormID);
                    if (question.Title.Contains("ITEM FEEDBACK") && (question.QuestionType == 0 || question.QuestionType == 3))
                    {
                        jObject["Title"] = "ITEM FEEDBACK";
                        List <HG_OrderItem> hG_OrderItems = new HG_OrderItem().GetAll(OID);
                        hG_OrderItems = hG_OrderItems.FindAll(x => x.Status == 3);
                        hG_OrderItems = hG_OrderItems.FindAll(x => x.OrdById == CID);
                        JArray itemfeedbks = new JArray();
                        for (int i = 0; i < hG_OrderItems.Count; i++)
                        {
                            HG_Items Objfood  = new HG_Items().GetOne(hG_OrderItems[i].FID);
                            JObject  ItemJobj = new JObject();
                            ItemJobj.Add("ItmId", hG_OrderItems[i].FID);//FID is ItemId
                            ItemJobj.Add("ItmName", Objfood.Items);
                            itemfeedbks.Add(ItemJobj);
                        }
                        jObject.Add("Items", itemfeedbks);
                    }
                    if (question.QuestionType == 1)
                    {
                        List <FeedbkObj> objectivesList = FeedbkObj.GetAll(question.ID);
                        FeedbkObj        firstt         = objectivesList.FirstOrDefault();
                        jObject.Add("ObjectiveType", firstt.ObjectiveType);
                        jObject.Add("Objectives", JArray.FromObject(objectivesList));
                    }
                    jArray.Add(jObject);
                }
                //=====add customer review comment in last at feedback
                JObject jObject2 = new JObject();
                jObject2.Add("QID", 0);
                jObject2.Add("Title", "");
                jObject2.Add("QuestionType", 5);
                jObject2.Add("FeedBkFormID", 0);
                jArray.Add(jObject2);
                respose.Add("Questions", jArray);
            }
            else
            {
                respose.Add("Status", 400);
            }
            return(respose);
        }