Beispiel #1
0
        public CheckFrom(string orderID, Users user)
        {
            MORBusinessLogic   mORBusinessLogic   = new MORBusinessLogic();
            OrderBusinessLogic orderBusinessLogic = new OrderBusinessLogic();

            InitializeComponent();
            this.orderID = orderID;
            this.user    = user;
            Order order = orderBusinessLogic.GetOrderByID(orderID);

            txbOrderId.Text          = order.OrderNumber;
            txbDepartment.Text       = order.Department;
            txbCreator.Text          = order.Creator;
            txbStatus.Text           = order.Status;
            txbProvider.Text         = order.Provider;
            dtpOrderTime.Text        = order.InputDate.ToString();
            label7.Text              = order.TotalMoney.ToString();
            this.dt                  = mORBusinessLogic.GetMOR(orderID);
            dgvOrderCheck.DataSource = this.dt;
            if (user.Remark == "班组")
            {
                btnSubmit.Visible = false;
            }
            setColumn();
        }
 public OrderEditForm(string orderID, Users user)
 {
     this.orderBusinessLogic = new OrderBusinessLogic();
     this.mORBusinessLogic   = new MORBusinessLogic();
     InitializeComponent();
     this.user               = user;
     order                   = this.orderBusinessLogic.GetOrderByID(orderID);
     txbGroup.Text           = order.Department;
     txbCreator.Text         = order.Creator;
     txbStatus.Text          = order.Status;
     dtpOrderTime.Text       = order.InputDate.ToString();
     txbRemark.Text          = order.Remark;
     menuOrder_RList         = this.mORBusinessLogic.GetMORByOrderID(orderID);
     dgvOrderEdit.DataSource = menuOrder_RList;
     setColumn();
 }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            MenuBusinessLogic  menuBusinessLogic  = new MenuBusinessLogic();
            OrderBusinessLogic orderBusinessLogic = new OrderBusinessLogic();
            MORBusinessLogic   mORBusinessLogic   = new MORBusinessLogic();
            Order order = new Order();
            bool  flag  = orderBusinessLogic.IscontainOrder(txbOrderNumber.Text.Trim());

            if (flag)
            {
                MessageBox.Show("订单已存在!", "提示");
                return;
            }
            if (dataGridView1.Rows[0].Cells[0].Value == null)
            {
                MessageBox.Show("订单不能为空!", "提示");
                return;
            }
            if (dataGridView1.Rows[cellRowIndex].Cells[0].Value != null && dataGridView1.Rows[cellRowIndex].Cells[3].Value == null)
            {
                MessageBox.Show("数量不能为空!", "提示");
                return;
            }
            if (dataGridView1.Rows[cellRowIndex].Cells[0].Value == null && dataGridView1.Rows[cellRowIndex].Cells[3].Value != null)
            {
                MessageBox.Show("请填写菜品!", "提示");
                return;
            }
            order.OrderID     = Guid.NewGuid().ToString();
            order.OrderNumber = txbOrderNumber.Text.Trim();
            order.Department  = txbDepartment.Text.Trim();
            order.Creator     = txbCreater.Text.Trim();
            order.InputDate   = Convert.ToDateTime(txbOrderDate.Text.Trim());
            order.TotalMoney  = Convert.ToDouble(this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[7].Value);
            order.Status      = "未发送";
            orderBusinessLogic.AddOrder(order);
            int count = dataGridView1.Rows.Count;

            for (int i = 0; i < count - 1; i++)
            {
                if (dataGridView1.Rows[i].Cells[0].Value != null && dataGridView1.Rows[i].Cells[3].Value != null)
                {
                    string      menuName = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    Model.Menu  menu     = menuBusinessLogic.GetMenuByName(menuName);
                    MenuOrder_R MOR      = new MenuOrder_R();
                    MOR.MenuOrderID = Guid.NewGuid().ToString();
                    MOR.OrderID     = order.OrderID;
                    MOR.MenuName    = menu.MenuName;
                    MOR.Unit        = menu.Unit;
                    MOR.InputDate   = Convert.ToDateTime(txbOrderDate.Text.Trim());
                    MOR.Money       = Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value);
                    MOR.Quote       = menu.MenuQuote;
                    MOR.Rate        = menu.MenuRate;
                    MOR.Price       = menu.MenuPrice;
                    MOR.Count       = Convert.ToDouble(dataGridView1.Rows[i].Cells[3].Value);
                    //MOR.Remark = null;
                    mORBusinessLogic.AddMOR(MOR);
                }
            }
            MessageBox.Show("提交成功!", "提示");
        }