// GET: ServingSize
        public ActionResult Index()
        {
            int             OrgId        = OrderType.CurrOrgId();
            List <HG_Items> ServingItems = new HG_Items().GetAll(OrgId, 2);

            return(View(ServingItems));
        }
Exemple #2
0
        public ActionResult CreateEditAddOn([System.Web.Http.FromBody] AddOns Addons)
        {
            Addons.AddonnList = Addons.AddonnList.FindAll(x => x.AddOnTitle != null && x.AddOnTitle != "");
            if (Addons.IsServingAddon && Addons.AddOnCatorItmId == 0)
            {
                Addons.OrgID = OrderType.CurrOrgId();
                //store in global list item not created
                AddOns.ServingAddonList.RemoveAll(x => x.OrgID == Addons.OrgID);
                AddOns.ServingAddonList.Add(Addons);
            }
            else
            {
                foreach (var AddOn in Addons.AddonnList)
                {
                    AddOn.CatOrItmId = Addons.AddOnCatorItmId;
                    AddOn.Save();
                    foreach (var AddOnItem in AddOn.AddOnItemList)
                    {
                        if (AddOn.DeletedStatus == 1)
                        {
                            AddOnItem.DelStatus = 1;
                        }
                        AddOnItem.AddonID = AddOn.TitleId;
                        double taxAmt = (AddOnItem.CostPrice * AddOnItem.Tax) / 100;
                        AddOnItem.Price      = AddOnItem.CostPrice + taxAmt;
                        AddOnItem.CatOrItmId = Addons.AddOnCatorItmId;
                        AddOnItem.Save();
                    }
                }
            }

            return(Json(new { data = "" }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index()
        {
            List <Cashback> Cashbks = Cashback.GetAll(OrderType.CurrOrgId(), 1);

            Cashbks = Cashbks.FindAll(x => x.CampeignType == 1);
            return(View(Cashbks));
        }
Exemple #4
0
        public static List <int> GetRedSeatings(Cashback Current)
        {
            List <Cashback> Cashbakcs   = Cashback.GetAll(OrderType.CurrOrgId(), 1);// all active cashbk of current outlet
            List <int>      RedSeatings = new List <int>();

            Cashbakcs = Cashbakcs.FindAll(x => x.SeatingIds != "");
            Cashbakcs = Cashbakcs.FindAll(x => x.CashBkId != Current.CashBkId && x.CashBkStatus == 1); // all running cashback not Current cashbk
            if (Current.CampeignType == 3)                                                             // check for only offers
            {
                Cashbakcs = Cashbakcs.FindAll(x => x.CampeignType == 3);
            }
            else if (Current.CampeignType == 1 || Current.CampeignType == 2)
            {
                Cashbakcs = Cashbakcs.FindAll(x => x.CampeignType != 3);
            }
            if (Current.StartDate.Date > DateTime.Now.Date)
            {
                Cashbakcs = Cashbakcs.FindAll(x => Current.StartDate.Date >= x.StartDate.Date && x.ValidTillDate <= Current.ValidTillDate.Date).ToList();
            }
            else
            {
                if (Current.ValidTillDate < DateTime.Now.Date)
                {
                    return(RedSeatings);
                }
                Cashbakcs = Cashbakcs.FindAll(x => Current.StartDate.Date <= x.ValidTillDate.Date).ToList();
            }
            foreach (var cashbak in Cashbakcs)
            {
                RedSeatings.AddRange(cashbak.SeatingIds.Split(',').Select(int.Parse).ToList());
            }

            return(RedSeatings);
        }
Exemple #5
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);
        }
Exemple #6
0
        /////=============offer=====
        ///
        public ActionResult OfferIndex()
        {
            List <Cashback> Cashbks = Cashback.GetAll(OrderType.CurrOrgId(), 1);

            Cashbks = Cashbks.FindAll(x => x.CampeignType == 3);// only offer types
            return(View(Cashbks));
        }
        public ActionResult ShowServingSize()
        {
            int OrgId = OrderType.CurrOrgId();
            //List<ServingSize> servingSizes = ServingSize.GetAll(OrgId);
            List <HG_Items> ServingItems = new HG_Items().GetAll(OrgId, 2);

            return(View(ServingItems));
        }
 public ActionResult CreatEdit(ServingSize servingSize)
 {
     if (servingSize.ServingId == 0)
     {
         servingSize.OrgId = OrderType.CurrOrgId();
     }
     servingSize.Save();
     return(Json(new { data = servingSize }, JsonRequestBehavior.AllowGet));
 }
Exemple #9
0
        public JObject ReloadSeating(int OrgId = 0)
        {
            if (OrgId <= 0)
            {
                OrgId = OrderType.CurrOrgId();
            }
            JObject ProcedureParm = new JObject();
            var     CurrDate      = DateTime.Now;
            var     Todate        = new DateTime(CurrDate.Year, CurrDate.Month, CurrDate.Day, 23, 59, 00);

            ProcedureParm.Add("FromDate", CurrDate.ToString("MM/dd/yyyy"));
            ProcedureParm.Add("Todate", Todate.ToString("MM/dd/yyyy HH:mm:ss"));
            ProcedureParm.Add("Orgid", OrgId);
            List <TblData> RunningOrds = TblData.GetAll("GetRunningOrder", ProcedureParm);

            JObject Result = new JObject();

            Result.Add("RunningOrds", JArray.FromObject(RunningOrds.Select(x => x.Jobj)));
            return(Result);
        }
Exemple #10
0
        // GET: AdminApi
        public JObject GetSeating(int OrgId = 0)
        {
            List <HG_Items>    ListItems = new List <HG_Items>();
            List <HG_Category> MenuList  = new List <HG_Category>();

            if (OrgId <= 0)
            {
                OrgId = OrderType.CurrOrgId();
            }
            if (OrgId > 0)
            {
                ListItems = new HG_Items().GetAll(OrgId);
                ListItems = ListItems.FindAll(x => x.ItemAvaibility == 0);// only available items
                MenuList  = new HG_Category().GetAll(OrgId: OrgId);
            }
            JObject ProcedureParm = new JObject();
            var     CurrDate      = DateTime.Now;
            var     Todate        = new DateTime(CurrDate.Year, CurrDate.Month, CurrDate.Day, 23, 59, 00);

            ProcedureParm.Add("FromDate", CurrDate.ToString("MM/dd/yyyy"));
            ProcedureParm.Add("Todate", Todate.ToString("MM/dd/yyyy HH:mm:ss"));
            ProcedureParm.Add("Orgid", OrgId);
            List <TblData>         RunningOrds = TblData.GetAll("GetRunningOrder", ProcedureParm);
            HG_OrganizationDetails ObjOrg      = new HG_OrganizationDetails().GetOne(OrgId);
            List <Seating>         Listseating = Seating.GetSeating(OrgId);
            JObject JobjResonse  = new JObject();
            JArray  SeatingArray = new JArray();
            JArray  TakeAwayItem = new JArray();
            List <HG_Floor_or_ScreenMaster> FlrScr = new HG_Floor_or_ScreenMaster().GetAll(int.Parse(ObjOrg.OrgTypes), OrgId);

            foreach (var ObjSeating in Listseating)
            {
                JObject jObject = new JObject();
                jObject.Add("Table_or_SheetName", ObjSeating.Seatting);
                jObject.Add("Table_or_RowID", ObjSeating.SeatId);
                jObject.Add("Otp", ObjSeating.Otp);
                jObject.Add("SeatName", ObjSeating.SeatName);
                jObject.Add("ScrnFlr", ObjSeating.FSName);
                jObject.Add("RowSide", ObjSeating.RowSideName);
                jObject.Add("Floor_or_ScreenId", ObjSeating.FSIS);
                JArray MenuJarray = new JArray();
                var    order      = RunningOrds.Find(x => x.getVal <Int64>("Table_or_SheatId") == ObjSeating.SeatId && x.getVal <int>("TableOtp") == ObjSeating.Otp);
                if (order != null && order.getVal <Int64>("OID") > 0)
                {
                    jObject.Add("CurrOID", order.getVal <Int64>("OID"));
                    jObject.Add("Status", 3);//table is booked
                }
                else
                {
                    jObject.Add("CurrOID", 0);
                    jObject.Add("Status", 1);//table is free;
                }

                double CurrentTableAmt = 0.00;
                string Cmobile         = "";
                string Cname           = "";
                int    ContactId       = 0;
                if (order != null)
                {
                    if (order.getVal <int>("ContactId") > 0)
                    {
                        LocalContacts localContacts = LocalContacts.GetOne(order.getVal <int>("ContactId"));
                        Cmobile   = localContacts.MobileNo;
                        Cname     = localContacts.Cust_Name;
                        ContactId = localContacts.ContctID;
                    }
                    else
                    {
                        vw_HG_UsersDetails ObjUser = new vw_HG_UsersDetails().GetSingleByUserId((int)order.getVal <Int64>("CID"));
                        if (ObjUser != null && ObjUser.UserCode > 0 && ObjUser.UserType == "CUST")
                        {
                            Cmobile   = ObjUser.UserId;
                            Cname     = ObjUser.UserName;
                            ContactId = -1;// minus show dont edit this. Order Palced By Customer
                        }
                    }
                    if (order.getVal <int>("PaymentStatus") == 0)
                    {
                        CurrentTableAmt += order.getVal <double>("OrdAmt");
                    }
                }
                if (ObjSeating.FSIS > 0)    // not takeaway
                {
                    jObject.Add("Type", 1); //Seat and table;
                    List <OrderMenuCategory> ListCategry   = OrderMenuCategory.GetAll(ObjSeating.OMID);
                    List <OrdMenuCtgItems>   ListMenuItems = OrdMenuCtgItems.GetAll(ObjSeating.OMID);
                    ListCategry   = ListCategry.FindAll(x => x.Status == true);
                    ListCategry   = ListCategry.OrderBy(x => x.OrderNo).ToList();
                    ListMenuItems = ListMenuItems.FindAll(x => x.Status == true);
                    HashSet <int> ItemIdHash = new HashSet <int>(ListItems.Select(x => x.ItemID).ToArray());
                    ListMenuItems = ListMenuItems.FindAll(x => ItemIdHash.Contains((int)x.ItemId));
                    int count = 0;
                    foreach (var OrderMenuObj in ListCategry)
                    {
                        double MenuItemPrice  = 0.00;
                        var    OrderMenuItems = ListMenuItems.FindAll(x => x.OrdMenuCatId == OrderMenuObj.id);
                        if (OrderMenuItems.Count > 0)
                        {
                            JObject JobjMenu   = new JObject();
                            JArray  jarrayItem = new JArray();
                            JobjMenu.Add("MenuId", OrderMenuObj.CategoryId);
                            JobjMenu.Add("Name", OrderMenuObj.DisplayName);
                            JobjMenu.Add("MenuIndex", count++);
                            int ItemiIndex = 0;
                            OrderMenuItems = OrderMenuItems.OrderBy(x => x.OrderNo).ToList();
                            foreach (var MenuItmObj in OrderMenuItems)
                            {
                                var     Items     = ListItems.Find(x => x.ItemID == MenuItmObj.ItemId);
                                int     CurrCount = 0;
                                JObject objItem   = new JObject();
                                objItem.Add("IID", Items.ItemID);
                                objItem.Add("ItemName", Items.Items);
                                objItem.Add("ItemPrice", Items.Price);
                                objItem.Add("ItemQuntity", Items.Qty);
                                objItem.Add("ItemImage", Items.Image);
                                objItem.Add("ItemCartValue", CurrCount);
                                objItem.Add("MenuId", Items.CategoryID);
                                objItem.Add("ItemIndex", ItemiIndex++);
                                objItem.Add("ItemMode", Items.ItemMode);
                                objItem.Add("CostPrice", Items.CostPrice);// without gst
                                objItem.Add("Tax", Items.Tax);
                                objItem.Add("Info", Items.ItemDiscription);
                                //check addon or Serving Size or Both apply in current item
                                List <AddOnn> Addons = AddOns.GetAddonsAndMultiSSize(Items);
                                if (Addons.Count > 0)
                                {
                                    objItem.Add("Addons", JArray.FromObject(Addons));
                                }
                                jarrayItem.Add(objItem);
                                MenuItemPrice += Items.Price * CurrCount;
                            }
                            JobjMenu.Add("MenuItemCount", OrderMenuItems.Count);
                            JobjMenu.Add("MenuItems", jarrayItem);
                            //  JobjMenu.Add("MenuItmPrice", MenuItemPrice);
                            //JobjMenu.Add("TableAmt", CurrentTableAmt);
                            JobjMenu.Add("ContactId", ContactId);
                            JobjMenu.Add("Mobile", Cmobile);
                            JobjMenu.Add("CName", Cname);
                            MenuJarray.Add(JobjMenu);
                        }
                    }
                }
                else
                {
                    jObject.Add("Type", 3);//take away
                    if (TakeAwayItem.Count == 0)
                    {
                        int count = 0;
                        foreach (HG_Category menu in MenuList)
                        {
                            double          MenuItemPrice  = 0.00;
                            List <HG_Items> ItemListByMenu = ListItems.FindAll(x => x.CategoryID == menu.CategoryID);
                            if (ItemListByMenu.Count > 0)
                            {
                                JObject JobjMenu   = new JObject();
                                JArray  jarrayItem = new JArray();
                                JobjMenu.Add("MenuId", menu.CategoryID);
                                JobjMenu.Add("Name", menu.Category);
                                JobjMenu.Add("MenuIndex", count++);
                                int ItemiIndex = 0;
                                foreach (var Items in ItemListByMenu)
                                {
                                    int     CurrCount = 0;
                                    JObject objItem   = new JObject();
                                    objItem.Add("IID", Items.ItemID);
                                    objItem.Add("ItemName", Items.Items);
                                    objItem.Add("ItemPrice", Items.Price);
                                    objItem.Add("ItemQuntity", Items.Qty);
                                    objItem.Add("ItemImage", Items.Image);
                                    objItem.Add("ItemCartValue", CurrCount);
                                    objItem.Add("MenuId", Items.CategoryID);
                                    objItem.Add("ItemIndex", ItemiIndex++);
                                    objItem.Add("CostPrice", Items.CostPrice);// without gst
                                    objItem.Add("Tax", Items.Tax);
                                    objItem.Add("ItemMode", Items.ItemMode);
                                    objItem.Add("Info", Items.ItemDiscription);
                                    //check addon or Serving Size or Both apply in current item
                                    List <AddOnn> Addons = AddOns.GetAddonsAndMultiSSize(Items);
                                    if (Addons.Count > 0)
                                    {
                                        objItem.Add("Addons", JArray.FromObject(Addons));
                                    }
                                    jarrayItem.Add(objItem);
                                    MenuItemPrice += Items.Price * CurrCount;
                                }
                                JobjMenu.Add("MenuItemCount", ItemListByMenu.Count);
                                JobjMenu.Add("MenuItems", jarrayItem);
                                //JobjMenu.Add("MenuItmPrice", MenuItemPrice);
                                //JobjMenu.Add("TableAmt", CurrentTableAmt);
                                JobjMenu.Add("ContactId", ContactId);
                                JobjMenu.Add("Mobile", Cmobile);
                                JobjMenu.Add("CName", Cname);
                                TakeAwayItem.Add(JobjMenu);
                            }
                        }
                    }
                    MenuJarray = TakeAwayItem;
                }

                jObject.Add("MenuItems", MenuJarray);
                jObject.Add("SeatingAmt", CurrentTableAmt);
                SeatingArray.Add(jObject);
            }
            JobjResonse.Add("Seating", SeatingArray);
            JobjResonse.Add("FlrScrList", JArray.FromObject(FlrScr));
            JobjResonse.Add("UserCode", OrderType.UserCode());
            JobjResonse.Add("OrgType", ObjOrg.OrgTypes);// restuarant / theataer
            JobjResonse.Add("OrgId", OrgId);
            return(JobjResonse);
        }
        public ActionResult PostCasbBack(Cashback cashback)
        {
            int      OrgId     = OrderType.CurrOrgId();
            Cashback OldCashBk = new Cashback();

            try
            {
                cashback.StartDate     = DateTime.ParseExact(cashback.StrStartDate, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture);
                cashback.ValidTillDate = DateTime.ParseExact(cashback.ValidTillStr, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture);
                if (cashback.ValidTill == 1)
                {
                    cashback.ValidTillDate = cashback.StartDate.AddYears(20);
                }
                if (cashback.CashBkId == 0 && cashback.StartDate.Date < DateTime.Now.Date)
                {
                    return(Json(new { msg = "Start Date Can't less than Today's Date" }));
                }
                if (cashback.StartDate.Date > cashback.ValidTillDate.Date)
                {
                    return(Json(new { msg = "Start Date Can't Greater than ValidTillDate Date" }));
                }
                else if (cashback.CashBkId > 0)
                {
                    OldCashBk = Cashback.Getone(cashback.CashBkId);
                    if (OldCashBk.StartDate.Date <= DateTime.Now.Date && OldCashBk.StartDate.Date != cashback.StartDate.Date)
                    {
                        return(Json(new { msg = "Can't Modify Start Date" }));
                    }
                    if (OldCashBk.StartDate.Date <= DateTime.Now.Date && OldCashBk.StartDate.Date >= cashback.StartDate.Date && OldCashBk.StartDate.Date != cashback.StartDate.Date)
                    {
                        return(Json(new { msg = "Can't Modify Start Date" }));
                    }
                    if (OldCashBk.StartDate.Date > DateTime.Now.Date && cashback.StartDate.Date < DateTime.Now.Date)
                    {
                        return(Json(new { msg = "Can't Modify Start Date" }));
                    }
                }
                if (cashback.RaiseDynamic == false && cashback.BilAmt > 0 && cashback.MaxCBLimit == 2)//limited amt conditions
                {
                    double MaxCashBackAmt = (cashback.Percentage * cashback.BilAmt * 2) / 100;
                    if (cashback.MaxAmt < MaxCashBackAmt)
                    {
                        return(Json(new { msg = "Max CashBack Amt should be " + MaxCashBackAmt.ToString("0.00") + " greather than Minimun Bill Amt Of " + cashback.Percentage + " %" }));
                    }
                }
                if (cashback.CashBkId == 0)
                {
                    cashback.OrgID        = OrgId;
                    cashback.CashBkStatus = 1;
                    cashback.TerminateSts = 1;
                    cashback.SeatingIds   = "";
                    var value = DateTime.Now.ToString("ddMMyyyyHHmmss");
                    cashback.CBUniqId = Int64.Parse(value);
                }
                if (OldCashBk.CashBkId > 0 && OldCashBk.CashBkStatus == 1 && OldCashBk.SeatingIds != "")
                {
                    List <int> Seatings    = cashback.SeatingIds.Split(',').Select(int.Parse).ToList();
                    List <int> RedSeatings = Cashback.GetRedSeatings(cashback);
                    int        Cnt         = 0;
                    foreach (var SeatingId in Seatings)
                    {
                        var seating = RedSeatings.Find(x => x == SeatingId);
                        if (seating > 0)
                        {
                            Cnt += 1;
                        }
                    }
                    if (Cnt > 0)
                    {
                        return(Json(new { msg = "Another mutual campaign applied on specified table(s)" }));
                    }
                }
                if (cashback.SeatingIds == null)
                {
                    cashback.SeatingIds = "";
                }
                cashback.Save();
                JObject response = new JObject();
                response.Add("CashBkId", cashback.CashBkId);
                response.Add("StartDate", cashback.StartDate.ToString("dd-MM-yyyy"));
                response.Add("EndDate", cashback.ValidTillDate.ToString("dd-MM-yyyy"));
                response.Add("TerminateStsID", cashback.TerminateSts);
                response.Add("TStatus", TerminatSts(cashback.TerminateSts));
                response.Add("CBSts", CBSts(cashback.CashBkStatus));
                response.Add("CBStsID", cashback.TerminateSts);
                response.Add("UID", cashback.CBUniqId);
                response.Add("OfferType", cashback.OfferType);
                return(Json(new { data = response.ToString() }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { msg = e.Message }));
            }
        }