Example #1
0
        //点击菜式
        private void btnMenu_Click(object sender, EventArgs e)
        {
            YouSoftBathGeneralClass.Menu menu = db.Menu.FirstOrDefault(x => x.name == ((Button)sender).Text);
            Orders order = new Orders();

            order.menu          = menu.name;
            order.text          = m_Seat.text;
            order.systemId      = m_Seat.systemId;
            order.number        = 1;
            order.money         = menu.price;
            order.inputTime     = GeneralClass.Now;
            order.inputEmployee = m_Employee.id.ToString();
            order.paid          = false;
            //m_Seat.money += menu.price;
            if (menu.technician)
            {
                InputServerId techForm = new InputServerId("", false);
                if (techForm.ShowDialog() != DialogResult.OK)
                {
                    GeneralClass.printErrorMsg("需要选择技师!");
                    return;
                }
                order.technician = techForm.emplyee.id.ToString();
                //var tech = db.Employee.FirstOrDefault(x => x.id.ToString() == technicianForm.m_tId);
            }

            db.Orders.InsertOnSubmit(order);
            db.SubmitChanges();

            m_Orders.Add(order);
            //findComboOfOrder(order);
            find_combo();
            dgvExpense_show();
        }
Example #2
0
        //构造函数
        public MenuForm(BathDBDataContext dc, YouSoftBathGeneralClass.Menu menu, string cat, MenuManagementForm form)
        {
            db = dc;
            m_cat = cat;
            m_Form = form;
            if (menu != null)
            {
                newMenu = false;
                m_menu = menu;
            }

            InitializeComponent();
            catgory.Items.AddRange(db.Catgory.Select(x => x.name).ToArray());
            catgory.Text = cat;
            techRatioType.SelectedIndex = 0;
            timeLimitType.SelectedIndex = 0;
        }
Example #3
0
        //构造函数
        public MenuForm(BathDBDataContext dc, YouSoftBathGeneralClass.Menu menu, string cat, MenuManagementForm form)
        {
            db     = dc;
            m_cat  = cat;
            m_Form = form;
            if (menu != null)
            {
                newMenu = false;
                m_menu  = menu;
            }

            InitializeComponent();
            catgory.Items.AddRange(db.Catgory.Select(x => x.name).ToArray());
            catgory.Text = cat;
            techRatioType.SelectedIndex = 0;
            timeLimitType.SelectedIndex = 0;
        }
Example #4
0
        //确定
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (catgory.Text == "")
            {
                GeneralClass.printErrorMsg("需要选择类别!");
                return;
            }

            if (name.Text == "")
            {
                GeneralClass.printErrorMsg("需要输入名称!");
                return;
            }
            if (unit.Text == "")
            {
                GeneralClass.printErrorMsg("需要输入单位!");
                return;
            }

            m_menu.name = name.Text;
            m_menu.unit = unit.Text;
            m_menu.catgoryId = db.Catgory.FirstOrDefault(x => x.name == catgory.Text).id;
            m_menu.note = note.Text;
            m_menu.addAutomatic = addAutomatic.Checked;
            m_menu.waiter = waiter.Checked;
            m_menu.technician = technician.Checked;
            if (technician.Checked)
            {
                m_menu.techRatioType = techRatioType.Text;
                if (onRatio.Text == "" || orderRatio.Text == "")
                {
                    GeneralClass.printErrorMsg("需要输入提成比例!");
                    return;
                }
                m_menu.techRatioCat = techRatioCat.Text;
                m_menu.onRatio = Convert.ToDouble(onRatio.Text);
                m_menu.orderRatio = Convert.ToDouble(orderRatio.Text);
            }

            if (waiter.Checked)
            {
                if (waiterRatio.Text == "")
                {
                    GeneralClass.printErrorMsg("需要输入提成比例!");
                    return;
                }
                m_menu.waiterRatioType = waiterRatioType.SelectedIndex;
                m_menu.waiterRatio = Convert.ToDouble(waiterRatio.Text);
            }

            if (price.Text == "")
            {
                price.Focus();
                GeneralClass.printErrorMsg("需要输入价格!");
                return;
            }
            m_menu.price = Convert.ToDouble(price.Text);

            //if (timeLimitHour.Text == "" || timeLimitMiniute.Text == "")
            //{
            //    GeneralClass.printErrorMsg("需要输入数据!");
            //    return;
            //}

            if (addAutomatic.Checked)
            {
                if (addType.Text == "")
                {
                    GeneralClass.printErrorMsg("需要选择添加类型!");
                    return;
                }
                m_menu.timeLimitType = timeLimitType.Text;
                m_menu.addType = addType.Text;
                m_menu.timeLimitHour = Convert.ToInt32(timeLimitHour.Text);
                m_menu.timeLimitMiniute = Convert.ToInt32(timeLimitMiniute.Text);

                if (addType.SelectedIndex == 1)
                {
                    if (addMoney.Text == "")
                    {
                        GeneralClass.printErrorMsg("需要输入价格!");
                        return;
                    }
                    m_menu.addMoney = Convert.ToDouble(addMoney.Text);
                }
            }

            if (dgv.Rows.Count != 0)
            {
                m_menu.ResourceExpense = BathClass.assemble_Menu_resourceExpense(resourceExpense);
            }

            if (db.Unit.FirstOrDefault(x=>x.name==unit.Text)==null)
            {
                Unit newUnit = new Unit();
                newUnit.name = unit.Text;
                db.Unit.InsertOnSubmit(newUnit);
            }

            if (newMenu)
            {
                db.Menu.InsertOnSubmit(m_menu);
                db.SubmitChanges();
                m_Form.dgv_show();

                name.Text = "";
                catgory.Text = m_cat;
                price.Text = "";

                technician.Checked = false;
                techRatioType.SelectedIndex = 0;
                onRatio.Text = "";
                orderRatio.Text = "";

                timeLimitHour.Text = "0";
                timeLimitMiniute.Text = "0";
                addAutomatic.Checked = false;
                addType.Text = "";
                addType.Enabled = false;
                addMoney.Text = "10";
                addMoney.Enabled = false;
                note.Text = "";
                m_menu = new YouSoftBathGeneralClass.Menu();
                name.Focus();

                dgv.Rows.Clear();
                return;
            }
            else
            {
                db.SubmitChanges();
                this.DialogResult = DialogResult.OK;
            }
        }
Example #5
0
        //确定
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (catgory.Text == "")
            {
                GeneralClass.printErrorMsg("需要选择类别!");
                return;
            }

            if (name.Text == "")
            {
                GeneralClass.printErrorMsg("需要输入名称!");
                return;
            }
            if (unit.Text == "")
            {
                GeneralClass.printErrorMsg("需要输入单位!");
                return;
            }

            m_menu.name         = name.Text;
            m_menu.unit         = unit.Text;
            m_menu.catgoryId    = db.Catgory.FirstOrDefault(x => x.name == catgory.Text).id;
            m_menu.note         = note.Text;
            m_menu.addAutomatic = addAutomatic.Checked;
            m_menu.waiter       = waiter.Checked;
            m_menu.technician   = technician.Checked;
            if (technician.Checked)
            {
                m_menu.techRatioType = techRatioType.Text;
                if (onRatio.Text == "" || orderRatio.Text == "")
                {
                    GeneralClass.printErrorMsg("需要输入提成比例!");
                    return;
                }
                m_menu.techRatioCat = techRatioCat.Text;
                m_menu.onRatio      = Convert.ToDouble(onRatio.Text);
                m_menu.orderRatio   = Convert.ToDouble(orderRatio.Text);
            }

            if (waiter.Checked)
            {
                if (waiterRatio.Text == "")
                {
                    GeneralClass.printErrorMsg("需要输入提成比例!");
                    return;
                }
                m_menu.waiterRatioType = waiterRatioType.SelectedIndex;
                m_menu.waiterRatio     = Convert.ToDouble(waiterRatio.Text);
            }

            if (price.Text == "")
            {
                price.Focus();
                GeneralClass.printErrorMsg("需要输入价格!");
                return;
            }
            m_menu.price = Convert.ToDouble(price.Text);

            //if (timeLimitHour.Text == "" || timeLimitMiniute.Text == "")
            //{
            //    GeneralClass.printErrorMsg("需要输入数据!");
            //    return;
            //}

            if (addAutomatic.Checked)
            {
                if (addType.Text == "")
                {
                    GeneralClass.printErrorMsg("需要选择添加类型!");
                    return;
                }
                m_menu.timeLimitType    = timeLimitType.Text;
                m_menu.addType          = addType.Text;
                m_menu.timeLimitHour    = Convert.ToInt32(timeLimitHour.Text);
                m_menu.timeLimitMiniute = Convert.ToInt32(timeLimitMiniute.Text);

                if (addType.SelectedIndex == 1)
                {
                    if (addMoney.Text == "")
                    {
                        GeneralClass.printErrorMsg("需要输入价格!");
                        return;
                    }
                    m_menu.addMoney = Convert.ToDouble(addMoney.Text);
                }
            }

            if (dgv.Rows.Count != 0)
            {
                m_menu.ResourceExpense = BathClass.assemble_Menu_resourceExpense(resourceExpense);
            }

            if (db.Unit.FirstOrDefault(x => x.name == unit.Text) == null)
            {
                Unit newUnit = new Unit();
                newUnit.name = unit.Text;
                db.Unit.InsertOnSubmit(newUnit);
            }

            if (newMenu)
            {
                db.Menu.InsertOnSubmit(m_menu);
                db.SubmitChanges();
                m_Form.dgv_show();

                name.Text    = "";
                catgory.Text = m_cat;
                price.Text   = "";

                technician.Checked          = false;
                techRatioType.SelectedIndex = 0;
                onRatio.Text    = "";
                orderRatio.Text = "";

                timeLimitHour.Text    = "0";
                timeLimitMiniute.Text = "0";
                addAutomatic.Checked  = false;
                addType.Text          = "";
                addType.Enabled       = false;
                addMoney.Text         = "10";
                addMoney.Enabled      = false;
                note.Text             = "";
                m_menu = new YouSoftBathGeneralClass.Menu();
                name.Focus();

                dgv.Rows.Clear();
                return;
            }
            else
            {
                db.SubmitChanges();
                this.DialogResult = DialogResult.OK;
            }
        }
 partial void DeleteMenu(Menu instance);
 partial void UpdateMenu(Menu instance);
 partial void InsertMenu(Menu instance);