public async Task <IActionResult> Create(List <IFormFile> files)
        {
            try
            {
                if (files == null)
                {
                    return(RedirectToAction(nameof(Index)));
                }
                foreach (var file in files)
                {
                    using (var fs = new FileStream(AddOns.Path(directory: "Files", filename: file.FileName), FileMode.Create))
                    {
                        await file.CopyToAsync(fs);
                    }
                }
                await files.WriteToJson();

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                await ex.LogAsync();

                return(View());
            }
        }
        public async Task <IActionResult> Edit(Guid id, Audio audio)
        {
            try
            {
                if (id != audio.ID)
                {
                    return(BadRequest());
                }
                var list = await AddOns.ReadFromJson();

                var solo = list.FirstOrDefault(x => x.ID == id);
                if (Data.Exists(AddOns.Path(directory: "Files", filename: solo.Name)))
                {
                    Data.Move(AddOns.Path(directory: "Files", filename: solo.Name), AddOns.Path(directory: "Files", filename: audio.Name));
                }
                solo.Name = audio.Name;
                solo.Size = audio.Size;
                await list.WriteToJson();

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                await ex.LogAsync();

                return(View());
            }
        }
Esempio n. 3
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));
        }
Esempio n. 4
0
        public async Task <IActionResult> CollectPayment(Bookings bookings, int id, DateTime value)
        {
            if (bookings.Amount != 0.0)
            {
                bookings.BookingStatus = "Returned";
                _context.Bookings.Update(bookings);
                _context.SaveChanges();
                return(RedirectToAction("ViewBookingsHistory"));
            }
            float additional = 0;
            int   dates      = (value - bookings.ReturnDate).Days;

            if (dates > 0)
            {
                additional = 200 * dates;
            }
            //  Bookings booking = await _context.Bookings.FindAsync(id);
            float   num     = 0;
            Vehicle vehicle = await _context.Vehicle.FindAsync(bookings.VehicleNo);

            int date = (bookings.ReturnDate - bookings.PickUpDate).Days;

            if (bookings.Equipment != null)
            {
                AddOns addOns = _context.AddOns.Where(a => a.Equipment == bookings.Equipment).FirstOrDefault();
                num = addOns.Amount * date;
            }
            float amount = vehicle.Amount * id;

            TempData["Amount"] = amount + num + additional;
            bookings.Amount    = amount + num;
            return(View("ReturnVehicle", bookings));
        }
        public async Task <IActionResult> Update(long id, [FromBody] AddOns item)
        {
            // set bad request if contact data is not provided in body
            if (item == null || id == 0)
            {
                return(BadRequest());
            }

            var details = await _context.AllAddOns.SingleOrDefaultAsync(t => t.Id == id);

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

            details.AddOnName        = item.AddOnName;
            details.Price            = item.Price;
            details.PromoDescription = item.PromoDescription;
            details.GroupId          = item.GroupId;
            details.IsPromoRecurring = item.IsPromoRecurring;
            details.RecurringPromoId = item.RecurringPromoId;
            details.Spiel            = item.Spiel;
            details.UpdatedAt        = DateTime.Now;

            if (await _context.SaveChangesAsync() > 0)
            {
                return(Ok(new { message = "Hi Renzen Add on is updated successfully.", details }));
            }


            return(Ok(new {
                message = "failed."
            }));
        }
Esempio n. 6
0
        public string SaveOrderDetails(string strAddOn, int ProductQuantity)
        {
            string addOnNames = "";

            VisitorSession.AddOns          = new List <AddOns>();
            VisitorSession.ProductQuantity = ProductQuantity;

            if (!string.IsNullOrEmpty(strAddOn))
            {
                string[] arr = strAddOn.Split('|');
                foreach (var o in arr)
                {
                    if (!string.IsNullOrEmpty(o))
                    {
                        //AddOns_0__IsChecked
                        int i = Convert.ToInt32(Helpers.HelperClasses.Numbers(o).FirstOrDefault());
                        addOnNames += AddOns.lstAddOns.ToArray()[i].Description + " | ";

                        AddOns addOn = new AddOns();
                        addOn.AddOnID     = AddOns.lstAddOns.ToArray()[i].AddOnID;
                        addOn.AddOnName   = AddOns.lstAddOns.ToArray()[i].AddOnName;
                        addOn.Description = AddOns.lstAddOns.ToArray()[i].Description;
                        addOn.Price       = AddOns.lstAddOns.ToArray()[i].Price;
                        addOn.IsChecked   = true;
                        VisitorSession.AddOns.Add(addOn);
                    }
                }
            }

            return(addOnNames != "" ? addOnNames.Substring(0, addOnNames.Length - 1) : addOnNames);
        }
        public async Task <IActionResult> Delete(Audio audio)
        {
            try
            {
                var list = await AddOns.ReadFromJson();

                var newlist = new List <Audio>();
                foreach (var item in list)
                {
                    if (item != audio)
                    {
                        newlist.Add(item);
                    }
                }
                var name = (await SingleAsync(audio.ID)).Name;
                await newlist.WriteToJson();

                if (Data.Exists(AddOns.Path(directory: "Files", filename: name)))
                {
                    Data.Delete(AddOns.Path(directory: "Files", filename: name));
                }
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                await ex.LogAsync();

                return(View());
            }
        }
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (CountryCode != null)
            {
                p.Add(new KeyValuePair <string, string>("CountryCode", CountryCode));
            }

            if (Type != null)
            {
                p.AddRange(Type.Select(prop => new KeyValuePair <string, string>("Type", prop)));
            }

            if (AddOns != null)
            {
                p.AddRange(AddOns.Select(prop => new KeyValuePair <string, string>("AddOns", prop)));
            }

            if (AddOnsData != null)
            {
                p.AddRange(PrefixedCollapsibleMap.Serialize(AddOnsData, "AddOns"));
            }

            return(p);
        }
Esempio n. 9
0
        public IActionResult AddAddOns(AddOns addOns)
        {
            addOns.Availability = true;
            _context.AddOns.Add(addOns);
            _context.SaveChanges();

            return(RedirectToAction("ViewAddOns"));
        }
Esempio n. 10
0
 private void Awake()
 {
     rb                 = GetComponent <Rigidbody2D>();
     _uiManager         = GameObject.Find("UI_Manager").GetComponent <UIManager>();
     _healthComponent   = GetComponent <HealthComponent>();
     boxCol             = GetComponent <BoxCollider2D>();
     _concussionObject  = concussionObj.GetComponent <ConcussionObject>();
     _momentumComponent = GetComponent <MomentumComponent>();
     _addOns            = GetComponent <AddOns>();
 }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         manifestsCheckTimer?.Dispose();
         ManifestUrls.GenericCollectionChanged -= ManifestUrlsGenericCollectionChangedHandler;
         AddOns?.Dispose();
         addOnsActiveEnumerable?.Dispose();
         addOnsWithUpdateAvailable?.Dispose();
     }
 }
        public async Task <IActionResult> Index()
        {
            try
            {
                return(View(await AddOns.ReadFromJson()));
            }
            catch (Exception ex)
            {
                await ex.LogAsync();

                return(View());
            }
        }
Esempio n. 13
0
        public async Task <IActionResult> GetJson()
        {
            try
            {
                return(File(await AddOns.GetJsonFileBytes(), "application/json", "SoundLink.json"));
            }
            catch (Exception ex)
            {
                await ex.LogAsync();

                return(StatusCode(500));
            }
        }
        private async Task <Audio> SingleAsync(Guid id)
        {
            try
            {
                return((await AddOns.ReadFromJson()).FirstOrDefault(x => x.ID == id));
            }
            catch (Exception ex)
            {
                await ex.LogAsync();

                return(new());
            }
        }
Esempio n. 15
0
        // Addon Items Create

        public ActionResult CreateEditAddOn(int CategryId)
        {
            AddOns addOns = AddOns.GetOne(CategryId, 0, false);

            addOns.AddOnCatorItmId = CategryId;
            if (addOns.AddonnList.Count == 0)
            {
                AddOnn addOnn = new AddOnn();
                addOnn.CatOrItmId = CategryId;
                addOns.AddonnList.Add(addOnn);
            }

            return(View(addOns));
        }
Esempio n. 16
0
        public async Task <IActionResult> ReturnCars(int id, int km, DateTime endDate)
        {
            AddOns   addOns  = null;
            Bookings booking = _context.Bookings.ToList().FirstOrDefault(v => v.BookingID == id);
            Vehicle  vehicle = _context.Vehicle.ToList().FirstOrDefault(v => v.VehicleType == booking.VehicleNo);

            if (booking.Equipment != null)
            {
                addOns = _context.AddOns.ToList().FirstOrDefault(a => a.Equipment == booking.Equipment);
            }
            int date = (booking.PickUpDate - booking.ReturnDate).Days;

            booking.Amount = (vehicle.Amount * km) + addOns.Amount;
            return(View(await _context.Vehicle.ToListAsync()));
        }
Esempio n. 17
0
        public IActionResult UpdateAddOns(AddOns addOns)
        {
            AddOns a = _context.AddOns.Find(addOns.AddOnsID);

            _context.AddOns.Attach(a);
            a.Equipment = addOns.Equipment;
            a.Amount    = addOns.Amount;
            a.Quantity  = addOns.Quantity;
            //    _context.Entry(addOns).State = Microsoft.EntityFrameworkCore.EntityState.Modified;

            //  _context.AddOns.Update(addOns);
            _context.SaveChanges();

            return(RedirectToAction("ViewAddOns"));
        }
        public async Task <IActionResult>  Post([FromBody] AddOns item)
        {
            if (ModelState.IsValid)
            {
                await _context.AddAsync(item).ConfigureAwait(false);
                await _context.SaveChangesAsync().ConfigureAwait(false);
            }
            else
            {
                return BadRequest(ModelState);
            }

            //return Ok(item);
            return(Ok(new { message = "Add-on successfully added." }));
        }
Esempio n. 19
0
        public IActionResult DeleteAddOns(int id = 0)
        {
            AddOns addOns = _context.AddOns.Find(id);

            if (_context.Bookings.Where(b => b.Equipment == addOns.Equipment).FirstOrDefault() == null)
            {
                _context.AddOns.Remove(_context.AddOns.Find(addOns.AddOnsID));
                _context.SaveChanges();
            }
            else
            {
                TempData["message"] = "AddOn is Already Booked By a User";
            }

            return(RedirectToAction("ViewAddOns"));
        }
Esempio n. 20
0
        public List <AddOns> GetAddOns()
        {
            var           rand            = new Random();
            var           AddOnsJsonText  = "[ { \"Name\": \"椰果\", \"Price\": 10, }, { \"Name\": \"白玉珍珠\", \"Price\": 10, }, { \"Name\": \"奇亞子\", \"Price\": 15, }]";
            List <AddOns> AddOnsDummyData = JsonConvert.DeserializeObject <List <AddOns> >(AddOnsJsonText);
            List <AddOns> AddOns          = new List <AddOns>();
            AddOns        tempAddOn       = AddOnsDummyData[rand.Next(0, 3)];

            AddOns.Add(new AddOns
            {
                Name   = tempAddOn.Name,
                Price  = tempAddOn.Price,
                Amount = 1
            });
            return(AddOns);
        }
Esempio n. 21
0
        public async Task <IActionResult> GetSound(string Name)
        {
            try
            {
                var path = AddOns.Path(directory: "Files", filename: Name);
                if (Files.Exists(path))
                {
                    return(PhysicalFile(path, "audio/mpeg", Name));
                }
                return(StatusCode(403));
            }
            catch (Exception ex)
            {
                await ex.LogAsync();

                return(StatusCode(500));
            }
        }
Esempio n. 22
0
 //slam upgrade
 // Use this for initialization
 private void Awake()
 {
     //if singleton gameLoaded = x
     //path = filename1, filename2 or filename3
     path = Application.persistentDataPath + "/" + filename;
     Debug.Log(path);
     _playerShoot          = GameObject.Find("Player").GetComponent <PlayerShoot>();
     _playerMain           = GameObject.Find("Player").GetComponent <PlayerMain>();
     _addOns               = GameObject.Find("Player").GetComponent <AddOns>();
     _dashUpgrade          = GameObject.Find("DashUpgrade").GetComponent <DashUpgrade>();
     _blastUpgrade         = GameObject.Find("BlastUpgrade").GetComponent <BlastUpgrade>();
     _airJumpUpgrade       = GameObject.Find("AirJumpUpgrade").GetComponent <AirJumpUpgrade>();
     _wallClimbUpgrade     = GameObject.Find("WallClimbUpgrade").GetComponent <WallClimbUpgrade>();
     _concussionUpgrade    = GameObject.Find("ConcussionUpgrade").GetComponent <ConcussionUpgrade>();
     _slamUpgrade          = GameObject.Find("SlamUpgrade").GetComponent <SlamUpgrade>();
     _doubleAirJumpUpgrade = GameObject.Find("DoubleAirJumpUpgrade").GetComponent <DoubleAirJumpUpgrade>();
     _healSplinter         = GameObject.Find("HealSplinter").GetComponent <HealSplinter>();
 }
Esempio n. 23
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope
            var objectContainer = context.GetFromContext <IObjectContainer>(TwilioApiScope.ParentContainerPropertyTag);

            // Inputs
            var number            = Number.Get(context);
            var countrycode       = CountryCode;
            var includeCallerName = IncludeCallerName.Get(context);
            var includeCarrier    = IncludeCarrier.Get(context);
            var addOns            = AddOns.Get(context);
            var addOnsData        = AddOnsData.Get(context);

            var lookup = await LookupWrappers.LookupPhoneNumber(objectContainer.Get <ITwilioRestClient>(), number, countrycode,
                                                                includeCallerName, includeCarrier, addOns, addOnsData);

            // Outputs
            return((ctx) => {
                PhoneNumber.Set(ctx, lookup);
            });
        }
Esempio n. 24
0
        public ActionResult AddMutiserving(int ItemId)
        {
            AddOns addOns = new AddOns();

            addOns.IsServingAddon = true;
            if (ItemId > 0)
            {
                addOns = AddOns.GetOne(ItemId, 0, true);
                addOns.IsServingAddon = true;
            }
            addOns.AddOnCatorItmId = ItemId;
            if (addOns.AddonnList.Count == 0)
            {
                AddOnn addOnn = new AddOnn();
                addOnn.CatOrItmId     = ItemId;
                addOnn.Min            = 1;
                addOnn.Max            = 1;
                addOnn.IsServingAddon = true;
                addOns.AddonnList.Add(addOnn);
            }

            return(View("CreateEditAddOn", addOns));
        }
Esempio n. 25
0
    // Use this for initialization
    void Start()
    {
        _playerMain        = GameObject.Find("Player").GetComponent <PlayerMain>();
        _momentumComponent = GameObject.Find("Player").GetComponent <MomentumComponent>();
        _addOns            = GameObject.Find("Player").GetComponent <AddOns>();

        if (_playerMain.isSlamming)
        {
            StartCoroutine(DestroyConcussionSlam());
        }
        else if (_playerMain.isDashing)
        {
            StartCoroutine(DestroyConcussionDash());
        }
        else
        {
            StartCoroutine(NormalConcussionKill());
        }

        //if (_addOns.damageIncreaseSplinter)
        //    concussionDamage = _addOns.ConcussionIncreaseDamage();
        //else
        //    concussionDamage = 0;
    }
Esempio n. 26
0
        public void RemoveAddOn(string addOnName)
        {
            var addOn = AddOns.Find(x => x.Name == addOnName);

            AddOns.Remove(addOn);
        }
Esempio n. 27
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);
        }
Esempio n. 28
0
 public void NewAddOn(AddOnDocument variant)
 {
     AddOns.Add(variant);
 }
 /// <summary>Open new add-ons popup</summary>
 public void OpenAddOnsPopUp()
 {
     AddOns.Click();
 }
Esempio n. 30
0
        public ActionResult CreateEdit(HG_Items Objitem, System.Web.HttpPostedFileBase FoodImg)
        {
            bool ApplyServingSize = false;

            if (Objitem.Qty == null)
            {
                Objitem.Qty = "";
            }
            if (Objitem.ItemDiscription == null)
            {
                Objitem.ItemDiscription = "";
            }
            if (Objitem.Type == 0)
            {
                Objitem.Type = 1;
            }
            if (Objitem.OrgID == 0)
            {
                var OrgObj = Request.Cookies["UserInfo"];
                Objitem.OrgID = int.Parse(OrgObj["OrgId"]);
            }
            if (Objitem.ApplyAddOn == 2 && Objitem.AddOnCatId == 0)
            {
                return(Json(new { msg = "Select Addon Category " }));
            }
            if (Objitem.CategoryID == 0)
            {
                return(Json(new { msg = "Select Item Category Name" }));
            }
            Objitem.EntryBy = Convert.ToInt32(Request.Cookies["UserInfo"]["UserCode"]);

            //check for category change and apply it to OrderMenu Section
            if (Objitem.ItemID > 0)
            {
                HG_Items OldObjItem = new HG_Items().GetOne(Objitem.ItemID);
                if (OldObjItem.CategoryID != Objitem.CategoryID)
                {
                    List <OrdMenuCtgItems>   ListItemsinCategory = OrdMenuCtgItems.GetAll(ItemId: Objitem.ItemID);
                    List <OrderMenuCategory> MenuCategoryList    = OrderMenuCategory.GetAll(CategoryId: Objitem.CategoryID);
                    foreach (var CtgItem in ListItemsinCategory)
                    {
                        foreach (var MenuCategory in MenuCategoryList)
                        {
                            List <OrdMenuCtgItems> MenuCategoryItems = OrdMenuCtgItems.GetAll(MenuCatTblId: MenuCategory.id);
                            if (MenuCategoryItems.Count > 0)
                            {
                                var ItemExist = MenuCategoryItems.Find(x => x.ItemId == CtgItem.ItemId);
                                if (ItemExist == null)
                                {
                                    CtgItem.OrderNo      = MenuCategoryItems.Count + 1;
                                    CtgItem.OrdMenuCatId = MenuCategory.id;
                                    CtgItem.OderMenuId   = MenuCategory.OrderMenuid;
                                    CtgItem.save();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                ApplyServingSize = true;
            }
            int i = Objitem.Save();

            if (i > 0 && ApplyServingSize)
            {
                AddOns Addon = AddOns.ServingAddonList.Find(x => x.OrgID == Objitem.OrgID);
                if (Addon != null && Addon.AddonnList.Count > 0)
                {
                    Addon.AddOnCatorItmId = Objitem.ItemID;
                    CreateEditAddOn(Addon);
                    AddOns.ServingAddonList.RemoveAll(x => x.OrgID == Objitem.OrgID);
                }
                //
            }
            if (i > 0 && FoodImg != null)
            {
                FoodImg.SaveAs(System.IO.Path.Combine(Server.MapPath("~/FoodImg/"), i + ".jpg"));
            }
            if (Objitem.Image.Equals(""))
            {
                Objitem.Image = "/FoodImg/" + i + ".jpg";
                if (Objitem.Save() < 1)
                {
                    return(Json(new { msg = "Error in Update Items" }));
                }
            }

            HG_Category hG_Category = new HG_Category().GetOne(Objitem.CategoryID);

            Objitem.Categoryname = hG_Category.Category;
            return(Json(new { data = Objitem }, JsonRequestBehavior.AllowGet));
        }