Esempio n. 1
0
        private void getcomboDishPad()
        {
            //
            comboDishPad = new ArrayList();
            ArrayList    onlydishs = comboDish.Onlydishs;
            TPotDishInfo potinfo   = new TPotDishInfo();
            //组合
            ArrayList combodishs = comboDish.Combodishs;

            for (int i = 0; i <= combodishs.Count - 1; i++)
            {
                TCombo combo = (TCombo)combodishs[i];
                for (int k = 0; k <= combo.Endnum - 1; k++)
                {
                    for (int j = 0; j <= combo.Dishs.Count - 1; j++)
                    {
                        combodishs.Add(combo.Dishs[i]);
                    }
                }
            }
            //必选
            for (int i = 0; i <= onlydishs.Count - 1; i++)
            {
                combodishs.Add((TPotDishInfo)onlydishs[i]);
            }
            //把选择的数量一个一个加到新套餐结构上,下单的时候 primarykey 的尾号就是numbers[]对应的序号
        }
Esempio n. 2
0
        private void initView()
        {
            lblDishName.Text = dishinfo.Title;
            //根据套餐内容创建控件显示 controls
            ArrayList    onlydishs = comboDish.Onlydishs;
            TPotDishInfo potinfo   = new TPotDishInfo();
            //组合
            ArrayList combodishs = comboDish.Combodishs;

            for (int i = 0; i <= combodishs.Count - 1; i++)
            {
                TCombo combo = (TCombo)combodishs[i];
                Label  lbl   = getonlyLabel(combo);
                lbl.Name = "lbl" + combo.Columnid;
                addComboControl(lbl);
                for (int j = 0; j <= combo.Dishs.Count - 1; j++)
                {
                    if (combo.Dishs[j].GetType().Name.Equals(potinfo.GetType().Name))
                    {
                        //鱼锅
                        lbl = getonlyLabel((TPotDishInfo)combo.Dishs[j]);
                        DevExpress.XtraEditors.TextEdit tbx = getComboTextBox();
                        tbx.Tag          = combo;
                        tbx.Click       += new EventHandler(edtNum1_Click);
                        tbx.TextChanged += new EventHandler(edtNum1_EditValueChanged);
                        tbx.Enter       += new EventHandler(edtNum1_Enter);
                        addControlCombo(lbl, (TPotDishInfo)combo.Dishs[j], tbx);
                    }
                    else
                    {
                        //普通菜
                        lbl = getonlyLabel((t_shopping)combo.Dishs[j], true);
                        DevExpress.XtraEditors.TextEdit tbx = getComboTextBox();
                        tbx.Tag          = combo;
                        tbx.Click       += new EventHandler(edtNum1_Click);
                        tbx.TextChanged += new EventHandler(edtNum1_EditValueChanged);
                        tbx.Enter       += new EventHandler(edtNum1_Enter);
                        addControlCombo(lbl, (t_shopping)combo.Dishs[j], tbx);
                    }
                }
            }
            //必选
            for (int i = 0; i <= onlydishs.Count - 1; i++)
            {
                Label lbl = lblSimple;
                if (onlydishs[i].GetType().Name.Equals(potinfo.GetType().Name))
                {
                    //鱼锅
                    lbl = getonlyLabel((TPotDishInfo)onlydishs[i]);
                    addControl(lbl, (TPotDishInfo)onlydishs[i], null);
                }
                else
                {
                    //普通菜
                    lbl = getonlyLabel((t_shopping)onlydishs[i], false);
                    addControl(lbl, (t_shopping)onlydishs[i], null);
                }
                lblLine.Top = lbl.Top + lblHeight;
            }
        }
Esempio n. 3
0
        public void saveCombo([FromBody] List <jComboDetail> list)
        {
            擺腹BuyFoodContext dbcontext = new 擺腹BuyFoodContext();

            if (list.First().cID != 0)
            {
                TCombo reviseTarget = dbcontext.TCombos.FirstOrDefault(n => n.CComboId == list.First().cID);
                reviseTarget.CComboName = list.First().cName;
                var removetarget = dbcontext.TComboDetails.Where(n => n.CComboId == list[0].cID);
                dbcontext.TComboDetails.RemoveRange(removetarget);

                foreach (var item in list)
                {
                    for (int i = 0; i < item.q; i++)
                    {
                        TComboDetail detail = new TComboDetail
                        {
                            CComboId   = item.cID,
                            CProductId = item.pID,
                        };
                        dbcontext.TComboDetails.Add(detail);
                    }
                    ;
                }
                ;
                dbcontext.SaveChanges();
            }
            else
            {
                TCombo newcombo = new TCombo
                {
                    CComboName = list.First().cName,
                    CMemberId  = list.First().mID,
                };

                dbcontext.TCombos.Add(newcombo);
                dbcontext.SaveChanges();

                int newcomboID = dbcontext.TCombos.Where(n => n.CMemberId == list.First().mID).OrderByDescending(n => n.CComboId).First().CComboId;
                foreach (var item in list)
                {
                    for (int i = 0; i < item.q; i++)
                    {
                        TComboDetail detail = new TComboDetail
                        {
                            CComboId   = newcomboID,
                            CProductId = item.pID,
                        };
                        dbcontext.TComboDetails.Add(detail);
                    }
                    ;
                }
                ;
                dbcontext.SaveChanges();
            }
            //return "done";
        }
Esempio n. 4
0
        private Label getonlyLabel(TCombo combo)
        {
            Label  label   = new Label();
            String dishStr = String.Format("{0}({1}选{2})->已选:0                               ", combo.ItemDesc, combo.Startnum, combo.Endnum);

            label.Text = dishStr;
            label.Tag  = combo;
            return(label);
        }
Esempio n. 5
0
        public ActionResult AddCombo(ComboAddViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var user = new ApplicationUser
            {
                Email    = model.Email,
                UserName = model.Email
            };

            string password = RandomPassword();
            string regex    = @"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{6,9}$";
            var    match    = Regex.Match(password, regex, RegexOptions.IgnoreCase);

            if (!match.Success)
            {
                //Console.WriteLine($"Поганий пароль - {str}");
            }

            var res = UserManager.CreateAsync(user, "Qwerty1-").Result;

            //manager.AddToRole(user.Id, "AppAdmin");
            if (res.Succeeded)
            {
                TCombo combo = new TCombo
                {
                    Name  = model.Name,
                    Image = model.Image
                };
                _context.Combos.Add(combo);
                _context.SaveChanges();

                var client = new SmtpClient("smtp.gmail.com", 587)
                {
                    Credentials = new NetworkCredential("*****@*****.**", "tanyavadim1234"),
                    EnableSsl   = true
                };
                client.Send("*****@*****.**", model.Email, "Новий пароль", $"Пароль: {password}");
            }
            return(RedirectToAction("index"));
        }
Esempio n. 6
0
        private void edtNum1_EditValueChanged(object sender, EventArgs e)
        {
            //
            DevExpress.XtraEditors.TextEdit edt = (DevExpress.XtraEditors.TextEdit)sender;
            TCombo combo    = (TCombo)edt.Tag;
            string lblname  = "lbl" + combo.Columnid;
            Label  lbl      = (Label)this.Controls.Find(lblname, true)[0];
            TCombo comb     = (TCombo)edt.Tag;
            int    groupnum = 0;

            for (int i = 0; i <= combocontrols.Count - 1; i++)
            {
                TComboFromControl cfc = (TComboFromControl)combocontrols[i];
                if (((TCombo)cfc.edt.Tag).Columnid == comb.Columnid)
                {
                    groupnum = groupnum + strtointdef0(cfc.edt.Text);
                }
            }
            if (groupnum > combo.Endnum)
            {
                for (int i = 0; i <= combocontrols.Count - 1; i++)
                {
                    TComboFromControl cfc = (TComboFromControl)combocontrols[i];
                    if (((TCombo)cfc.edt.Tag).Columnid == comb.Columnid)
                    {
                        cfc.edt.Text = "";
                        cfc.edt.Refresh();
                        groupnum = 0;
                    }
                }
            }
            else
            if (combo.Endnum == groupnum)
            {
                lbl.BackColor = lblCombo2.BackColor;
            }
            else
            {
                lbl.BackColor = lblCombo.BackColor;
            }
            String dishStr = String.Format("{0}({1}选{2})->已选:{3}                               ", combo.ItemDesc, combo.Startnum, combo.Endnum, groupnum);

            lbl.Text = dishStr;
        }
Esempio n. 7
0
        private void setedtNum(DevExpress.XtraEditors.TextEdit edt)
        {
            TCombo comb = (TCombo)edt.Tag;

            if (comb.Endnum == 1)
            {
                for (int i = 0; i <= combocontrols.Count - 1; i++)
                {
                    TComboFromControl cfc = (TComboFromControl)combocontrols[i];
                    if (((TCombo)cfc.edt.Tag).Columnid == comb.Columnid)
                    {
                        cfc.edt.Text = "";
                    }
                }

                edt.Text = "1";
                edt.SelectAll();
            }
        }