Beispiel #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            pnDetail.Controls.Clear();
            Button addNew = (Button)sender;
            int tag = Convert.ToInt32(addNew.Tag);

            switch (tag)
            {
                case 1:
                    UCMenu ucMenu = new UCMenu();
                    ucMenu.Dock = DockStyle.Fill;
                    ucMenu.btnSave.Click += ucMenuList_btnSave_Click;
                    ucMenu.btnRemove.Hide();
                    pnDetail.Controls.Add(ucMenu);
                    break;
                case 2:
                    UCGroupList ucGroupItem = new UCGroupList();
                    ucGroupItem.Dock = DockStyle.Fill;
                    ucGroupItem.btnSave.Click += ucGroupList_btnSave_Click;
                    ucGroupItem.btnRemove.Hide();
                    pnDetail.Controls.Add(ucGroupItem);
                    break;
                case 3:
                    UCItemList ucItemList = new UCItemList();
                    ucItemList.Dock = DockStyle.Fill;
                    ucItemList.btnSave.Click += ucItemList_btnSave_Click;
                    ucItemList.btnRemove.Visible = false;
                    ucItemList.btnAddProtions.Visible = false;

                    pnDetail.Controls.Add(ucItemList);
                    break;
                case 4:
                    UCModifier ucModifier = new UCModifier();
                    ucModifier.Dock = DockStyle.Fill;
                    ucModifier.btnSave.Click += ucModifier_btnSave_Click;
                    ucModifier.btnRemove.Visible = false;
                    pnDetail.Controls.Add(ucModifier);
                    break;
                case 5:
                    UCPriceList ucPriceList = new UCPriceList();
                    ucPriceList.Dock = DockStyle.Fill;
                    pnDetail.Controls.Add(ucPriceList);
                    break;
            }
        }
Beispiel #2
0
        private void addModifierItemDetail(ModifireModel dataModifire)
        {
            //pnDetail.Controls.Clear();

            if (dataModifire.ModifireID > 0)
            {
                UCModifier ucModifier = new UCModifier();
                if (pnDetail.Controls.Count > 0)
                {
                    ucModifier = (UCModifier)pnDetail.Controls[0];
                }
                else
                {
                    ucModifier.Dock = DockStyle.Fill;
                    pnDetail.Controls.Add(ucModifier);
                }
                ucModifier.Dock = DockStyle.Fill;
                ucModifier.lblModifierName.Text = dataModifire.ModifireName;
                ucModifier.txtModifierName.Text = dataModifire.ModifireName;
                if (dataModifire.CurrentPrice > 0)
                    ucModifier.txtModifierPrice.Text = money.Format2(dataModifire.CurrentPrice.ToString());
                else
                    ucModifier.txtModifierPrice.Text = "0";
                ucModifier.btnSave.Tag = dataModifire;
                ucModifier.btnSave.Click += ucModifier_btnSave_Click;
                ucModifier.btnRemove.Tag = dataModifire;
                ucModifier.btnRemove.Click += ucModifier_btnRemove_Click;
                pnDetail.Controls.Add(ucModifier);
                ucModifier = (UCModifier)pnDetail.Controls[0];
                ucModifier.cbColor.SelectedItem = dataModifire.Color;
            }
            else
            {
                pnDetail.Controls.Clear();
            }
        }