Ejemplo n.º 1
0
    public void IncDecOrder(IncDec op, string FbCode)
    {
        eMenuTools tools = new eMenuTools();

        if (op == IncDec.Inc)
        {
            List <Order> all;
            all = mSession.Basket;

            if (mSession.Basket.Where(z => z.fbCode == FbCode && !z.IsPWP).Count() > 0)
            {
                all.First(z => z.fbCode == FbCode && !z.IsPWP).Quantity++;
            }
            else
            {
                Tblfoodbeverage pr    = dc.Tblfoodbeverages.First(z => z.Foodbeveragecode == FbCode);
                Order           order = new Order();
                order.fbCode         = FbCode;
                order.Description    = pr.Foodbeveragedescription;
                order.AltDescription = pr.Foodbeveragealternatedescription;
                order.Quantity       = 1;
                // order.Pic = ConfigFile.PicVisible ? pr.Foodbeveragepicture : null;
                order.fbUnitPrice = tools.CalculatePrice(pr).Value;
                order.HasPWP      = pr.Tblfoodbeveragepwpitems.Count > 0 ? true : false;
                all.Add(order);
            }
            mSession.Basket = all;
        }
        if (op == IncDec.Dec)
        {
            var item = mSession.Basket.FirstOrDefault(z => z.fbCode == FbCode && !z.IsPWP);
            if (item != null)
            {
                if (item.Quantity > 1)
                {
                    mSession.Basket.First(z => z.fbCode == FbCode && !z.IsPWP).Quantity--;
                }
                else
                {
                    mSession.Basket.Remove(mSession.Basket.First(z => z.fbCode == FbCode && !z.IsPWP));
                }

                if (item.HasPWP)
                {
                    DecreasePWPItems(FbCode);
                }
            }
        }
    }
Ejemplo n.º 2
0
    //public void RaisePostBackEvent(string eventArgument)
    //{
    //}
    public void AddRequestIDs_ToBasket(List <int> reqCodeList, string fbCode, ref Order RowOrder)
    {
        eMenuTools tools = new eMenuTools();

        if (reqCodeList.Count == 0 && (dc.Tblfoodbeveragerequestrules.Where(z => z.Foodbeveragecode == fbCode).Count() == 0 || dc.Tblfoodbeveragerequestrules.Where(z => z.Foodbeveragecode == fbCode && z.Foodbeveragerequestrulescondition == "At Least").Count() > 0))
        {
            //var fb = dc.Tblfoodbeveragerequest.First(i => i.Foodbeveragerequestpk == RCode[0]).Tblfoodbeverage;
            var   fb    = dc.Tblfoodbeverages.First(i => i.Foodbeveragecode == fbCode);
            Order order = RowOrder;
            if (order == null)
            {
                order = new Order();

                order.fbCode         = fbCode;
                order.Description    = fb.Foodbeveragedescription;
                order.AltDescription = fb.Foodbeveragealternatedescription;
                order.Quantity       = 1;
                // order.Pic = fb.Foodbeveragepicture;
                order.fbUnitPrice = tools.CalculatePrice(fb).Value; //.Foodbeverageprice.Value;
                RowOrder          = order;
            }
            else
            {
                mSession.Basket.FirstOrDefault(z => z.fbCode == fbCode && !z.IsPWP).Quantity++;
            }

            Requests requests = new Requests();
            requests.ID = RowOrder.Requests.Count > 0 ? RowOrder.Requests.Max(z => z.ID) + 1 : 0;

            RequestUnit newR = new RequestUnit();
            newR.fbCode       = order.fbCode;
            newR.RCode        = -1;
            newR.RDescription = "Normal ";
            newR.Price        = 0;
            requests.RequestUnits.Add(newR);


            var q = RowOrder.Requests.FirstOrDefault(i => i == requests);

            if (q == null)
            {
                RowOrder.Requests.Add(requests);
            }
            else
            {
                RowOrder.Requests.FirstOrDefault(i => i == requests).Quantity++;
            }
        }
        if (reqCodeList.Count > 0)
        {
            var fb = dc.Tblfoodbeveragerequests.First(i => i.Foodbeveragerequestpk == reqCodeList[0]).Tblfoodbeverage;

            Order order = RowOrder;
            if (order == null)
            {
                order = new Order();

                order.fbCode         = fb.Foodbeveragecode;
                order.Description    = fb.Foodbeveragedescription;
                order.AltDescription = fb.Foodbeveragealternatedescription;
                order.Quantity       = 1;
                //               order.Pic = fb.Foodbeveragepicture;
                order.fbUnitPrice = tools.CalculatePrice(fb).Value; //.Foodbeverageprice.Value;
                RowOrder          = order;
            }
            else
            {
                //order.FirstOrDefault(z => z.fbCode == fbCode && !z.IsPWP).Quantity++;
                RowOrder.Quantity++;
            }

            Requests requests = new Requests();
            requests.ID = RowOrder.Requests.Count > 0 ? RowOrder.Requests.Max(z => z.ID) + 1 : 0;
            foreach (int rc in reqCodeList)
            {
                var req = dc.Tblfoodbeveragerequests.First(z => z.Foodbeveragerequestpk == rc);

                RequestUnit newR = new RequestUnit();
                newR.fbCode       = order.fbCode;
                newR.RCode        = req.Foodbeveragerequestpk;
                newR.RDescription = req.Foodbeveragerequest;
                newR.Price        = req.Foodbeveragerequestprice.Value;
                requests.RequestUnits.Add(newR);
            }

            var q = RowOrder.Requests.FirstOrDefault(i => i == requests);

            if (q == null)
            {
                RowOrder.Requests.Add(requests);
            }
            else
            {
                RowOrder.Requests.FirstOrDefault(i => i == requests).Quantity++;
            }
        }
    }
Ejemplo n.º 3
0
    protected void gMenu_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        if (mSession.ViewingBasket)
        {
            byte[] b     = null;
            var    query = from i in mSession.Basket.AsEnumerable()
                           //where i.Groupcode == panelbar.SelectedItem.Value
                           select new
            {
                ID           = i.fbCode,
                Price        = FormatPrice(i.fbUnitPrice),
                Pic          = b,          //ConfigFile.PicVisible ? i.Pic : null,
                Dsc          = mSession.Language == Language.Description || string.IsNullOrEmpty(i.AltDescription) ? i.Description : i.AltDescription,
                Quantity     = i.Quantity, // FindQuantity(i.fbCode),
                VisibleMinus = VisibleMinus_InMasterTable(i.fbCode),
                Expanded     = this.ExpandedRow(i.fbCode),
                //VisibleQuantity = VisibleQuantity(i.fbCode),
                FoatPattern  = this.FloatPattern,
                Font         = mSession.AppFont,
                btnPlusText  = "[ + ]",           // mSession.MastersIncludedChiled.Where(z => z == i.fbCode).Count() > 0 ? "[ < ]" : "[ + ]",
                TooltipWidth = System.Web.UI.WebControls.Unit.Parse(ConfigFile.TooltipPictureSize),
                PicVisible   = false,
                i.IsPWP,
                HasPWP = i.HasPWP,
            };
            //if(ConfigFile.)
            gMenu.DataSource = query.ToList().Distinct();
        }
        else
        {
            if (mSession.GroupName != "")
            {
                var menuItem = panelbar.Items.FindItemByText(mSession.MenuType);
                if (menuItem != null)
                {
                    var groupItem = menuItem.Items.FindItemByValue(mSession.GroupName);
                    if (groupItem != null)
                    {
                        groupItem.Selected = true;
                    }
                }
            }
            if (panelbar.SelectedItem != null && panelbar.SelectedItem.Text != "")
            {
                var q = (from i in dc.Tblfoodbeverages
                         where i.Groupcode == panelbar.SelectedItem.Value &&
                         i.Foodbeverageavailable == "True"
                         select new
                {
                    ID = i.Foodbeveragecode,

                    Pic = i.Foodbeveragepicture,
                    Dsc = mSession.Language == Language.Description || string.IsNullOrEmpty(i.Foodbeveragealternatedescription) ? i.Foodbeveragedescription : i.Foodbeveragealternatedescription,
                    Quantity = FindQuantity(i.Foodbeveragecode),

                    Expanded = ExpandedRow(i.Foodbeveragecode),
                    VisibleMinus = VisibleMinus_InMasterTable(i.Foodbeveragecode),
                    // VisibleQuantity = FindQuantity(i.Foodbeveragecode) > 0 ? true : false, //VisibleQuantity(i.Foodbeveragecode),
                    HasPWP = i.Tblfoodbeveragepwpitems.Count > 0 ? true : false,
                    fb = i,
                });
                var query = from i in q.AsEnumerable()
                            select new
                {
                    i.ID,
                    Price = FormatPrice(tools.CalculatePrice(i.fb)),
                    Pic   = ConfigFile.PicVisible ? i.Pic : null,
                    i.Dsc,
                    Quantity = i.Quantity,
                    i.Expanded,
                    Font = mSession.AppFont,
                    i.VisibleMinus,
                    //VisibleQuantity = (i.Quantity > 0 ? true : false),
                    FoatPattern  = this.FloatPattern,
                    btnPlusText  = "[ + ]",           // mSession.MastersIncludedChiled.Where(z => z == i.ID).Count() > 0 ? "[ < ]" : "[ + ]",
                    TooltipWidth = System.Web.UI.WebControls.Unit.Parse(ConfigFile.TooltipPictureSize),
                    PicVisible   = ConfigFile.PicVisible,
                    i.HasPWP,
                    IsPWP = false,
                };
                gMenu.DataSource = query.ToList();
            }
        }
        //gMenu.Rebind();
        //gMenu.DataBind();
    }
Ejemplo n.º 4
0
    public void IncDecOrder(IncDec op, string FbCode)
    {
        eMenuTools tools = new eMenuTools();
        if (op == IncDec.Inc)
        {
            List<Order> all;
            all = mSession.Basket;

            if (mSession.Basket.Where(z => z.fbCode == FbCode && !z.IsPWP).Count() > 0)
            {
                all.First(z => z.fbCode == FbCode && !z.IsPWP).Quantity++;
            }
            else
            {
                Tblfoodbeverage pr = dc.Tblfoodbeverages.First(z => z.Foodbeveragecode == FbCode);
                Order order = new Order();
                order.fbCode = FbCode;
                order.Description = pr.Foodbeveragedescription;
                order.AltDescription = pr.Foodbeveragealternatedescription;
                order.Quantity = 1;
                // order.Pic = ConfigFile.PicVisible ? pr.Foodbeveragepicture : null;
                order.fbUnitPrice = tools.CalculatePrice(pr).Value;
                order.HasPWP = pr.Tblfoodbeveragepwpitems.Count > 0 ? true : false;
                all.Add(order);
            }
            mSession.Basket = all;
        }
        if (op == IncDec.Dec)
        {
            var item = mSession.Basket.FirstOrDefault(z => z.fbCode == FbCode && !z.IsPWP);
            if (item != null)
            {
                if (item.Quantity > 1)
                    mSession.Basket.First(z => z.fbCode == FbCode && !z.IsPWP).Quantity--;
                else
                    mSession.Basket.Remove(mSession.Basket.First(z => z.fbCode == FbCode && !z.IsPWP));

                if (item.HasPWP)
                {
                    DecreasePWPItems(FbCode);
                }
            }
        }
    }
Ejemplo n.º 5
0
    //public void RaisePostBackEvent(string eventArgument)
    //{
    //}
    public void AddRequestIDs_ToBasket(List<int> reqCodeList, string fbCode, ref Order RowOrder)
    {
        eMenuTools tools = new eMenuTools();
        if (reqCodeList.Count == 0 && (dc.Tblfoodbeveragerequestrules.Where(z => z.Foodbeveragecode == fbCode).Count() == 0 || dc.Tblfoodbeveragerequestrules.Where(z => z.Foodbeveragecode == fbCode && z.Foodbeveragerequestrulescondition == "At Least").Count() > 0))
        {
            //var fb = dc.Tblfoodbeveragerequest.First(i => i.Foodbeveragerequestpk == RCode[0]).Tblfoodbeverage;
            var fb = dc.Tblfoodbeverages.First(i => i.Foodbeveragecode == fbCode);
            Order order = RowOrder;
            if (order == null)
            {
                order = new Order();

                order.fbCode = fbCode;
                order.Description = fb.Foodbeveragedescription;
                order.AltDescription = fb.Foodbeveragealternatedescription;
                order.Quantity = 1;
                // order.Pic = fb.Foodbeveragepicture;
                order.fbUnitPrice = tools.CalculatePrice(fb).Value; //.Foodbeverageprice.Value;
                RowOrder = order;
            }
            else
            {
                mSession.Basket.FirstOrDefault(z => z.fbCode == fbCode && !z.IsPWP).Quantity++;
            }

            Requests requests = new Requests();
            requests.ID = RowOrder.Requests.Count > 0 ? RowOrder.Requests.Max(z => z.ID) + 1 : 0;

            RequestUnit newR = new RequestUnit();
            newR.fbCode = order.fbCode;
            newR.RCode = -1;
            newR.RDescription = "Normal ";
            newR.Price = 0;
            requests.RequestUnits.Add(newR);

            var q = RowOrder.Requests.FirstOrDefault(i => i == requests);

            if (q == null)
            {
                RowOrder.Requests.Add(requests);

            }
            else
            {
                RowOrder.Requests.FirstOrDefault(i => i == requests).Quantity++;

            }
        }
        if (reqCodeList.Count > 0)
        {
            var fb = dc.Tblfoodbeveragerequests.First(i => i.Foodbeveragerequestpk == reqCodeList[0]).Tblfoodbeverage;

            Order order = RowOrder;
            if (order == null)
            {
                order = new Order();

                order.fbCode = fb.Foodbeveragecode;
                order.Description = fb.Foodbeveragedescription;
                order.AltDescription = fb.Foodbeveragealternatedescription;
                order.Quantity = 1;
                //               order.Pic = fb.Foodbeveragepicture;
                order.fbUnitPrice = tools.CalculatePrice(fb).Value; //.Foodbeverageprice.Value;
                RowOrder = order;
            }
            else
            {
                //order.FirstOrDefault(z => z.fbCode == fbCode && !z.IsPWP).Quantity++;
                RowOrder.Quantity++;
            }

            Requests requests = new Requests();
            requests.ID = RowOrder.Requests.Count > 0 ? RowOrder.Requests.Max(z => z.ID) + 1 : 0;
            foreach (int rc in reqCodeList)
            {
                var req = dc.Tblfoodbeveragerequests.First(z => z.Foodbeveragerequestpk == rc);

                RequestUnit newR = new RequestUnit();
                newR.fbCode = order.fbCode;
                newR.RCode = req.Foodbeveragerequestpk;
                newR.RDescription = req.Foodbeveragerequest;
                newR.Price = req.Foodbeveragerequestprice.Value;
                requests.RequestUnits.Add(newR);
            }

            var q = RowOrder.Requests.FirstOrDefault(i => i == requests);

            if (q == null)
            {
                RowOrder.Requests.Add(requests);

            }
            else
            {
                RowOrder.Requests.FirstOrDefault(i => i == requests).Quantity++;

            }
        }
    }
Ejemplo n.º 6
0
    private void AddRequestToToBasketTemp(List <int> RCode, string fbCode)
    {
        //if (rule.Foodbeveragerequestrulescondition == "At Least")
        //{
        //    if (gridSelectedReqs.Count >= rule.Foodbeveragerequestrulesnumber)
        //        return true;
        //    else return false;
        //}
        if (RCode.Count == 0 && (dc.Tblfoodbeveragerequestrules.Where(z => z.Foodbeveragecode == FbCode).Count() == 0 || dc.Tblfoodbeveragerequestrules.Where(z => z.Foodbeveragecode == FbCode && z.Foodbeveragerequestrulescondition == "At Least").Count() > 0))
        {
            //var fb = dc.Tblfoodbeveragerequest.First(i => i.Foodbeveragerequestpk == RCode[0]).Tblfoodbeverage;
            var   fb    = dc.Tblfoodbeverages.First(i => i.Foodbeveragecode == fbCode);
            Order order = RowOrder;
            if (order == null)
            {
                order = new Order();

                order.fbCode         = fbCode;
                order.Description    = fb.Foodbeveragedescription;
                order.AltDescription = fb.Foodbeveragealternatedescription;
                order.Quantity       = 1;
//               order.Pic = fb.Foodbeveragepicture;
                order.fbUnitPrice = tools.CalculatePrice(fb).Value; //.Foodbeverageprice.Value;
                RowOrder          = order;
            }
            else
            {
                mSession.BasketTemp.FirstOrDefault(z => z.fbCode == this.FbCode).Quantity++;
            }

            Requests requests = new Requests();
            requests.ID = RowOrder.Requests.Count > 0 ? RowOrder.Requests.Max(z => z.ID) + 1 : 0;

            RequestUnit newR = new RequestUnit();
            newR.fbCode       = order.fbCode;
            newR.RCode        = -1;
            newR.RDescription = "Normal ";
            newR.Price        = 0;
            requests.RequestUnits.Add(newR);


            var q = RowOrder.Requests.FirstOrDefault(i => i == requests);

            if (q == null)
            {
                RowOrder.Requests.Add(requests);
            }
            else
            {
                RowOrder.Requests.FirstOrDefault(i => i == requests).Quantity++;
            }
        }
        if (RCode.Count > 0)
        {
            var fb = dc.Tblfoodbeveragerequests.First(i => i.Foodbeveragerequestpk == RCode[0]).Tblfoodbeverage;

            Order order = RowOrder;
            if (order == null)
            {
                order = new Order();

                order.fbCode         = fb.Foodbeveragecode;
                order.Description    = fb.Foodbeveragedescription;
                order.AltDescription = fb.Foodbeveragealternatedescription;
                order.Quantity       = 1;
//               order.Pic = fb.Foodbeveragepicture;
                order.fbUnitPrice = tools.CalculatePrice(fb).Value; //.Foodbeverageprice.Value;
                RowOrder          = order;
            }
            else
            {
                mSession.BasketTemp.FirstOrDefault(z => z.fbCode == this.FbCode).Quantity++;
            }

            Requests requests = new Requests();
            requests.ID = RowOrder.Requests.Count > 0 ? RowOrder.Requests.Max(z => z.ID) + 1 : 0;
            foreach (int rc in RCode)
            {
                var req = dc.Tblfoodbeveragerequests.First(z => z.Foodbeveragerequestpk == rc);

                RequestUnit newR = new RequestUnit();
                newR.fbCode       = order.fbCode;
                newR.RCode        = req.Foodbeveragerequestpk;
                newR.RDescription = req.Foodbeveragerequest;
                newR.Price        = req.Foodbeveragerequestprice.Value;
                requests.RequestUnits.Add(newR);
            }

            var q = RowOrder.Requests.FirstOrDefault(i => i == requests);

            if (q == null)
            {
                RowOrder.Requests.Add(requests);
            }
            else
            {
                RowOrder.Requests.FirstOrDefault(i => i == requests).Quantity++;
            }
        }
    }