コード例 #1
0
        public MenuOrder_R GetMenuOrder_RByID(string ID)
        {
            MenuOrder_R mor = new MenuOrder_R();

            mor = this.MORDataContext.MenuOrder_R.SingleOrDefault(o => o.MenuOrderID == ID);
            return(mor);
        }
コード例 #2
0
 public bool UpdataMOR(MenuOrder_R MOR)
 {
     try
     {
         MORDataContext.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #3
0
 //添加用户
 public bool AddMOR(MenuOrder_R MOR)
 {
     try
     {
         this.MORDataContext.MenuOrder_R.InsertOnSubmit(MOR);
         this.MORDataContext.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #4
0
 //通过主键
 public bool DeleteMORById(string orderID)
 {
     try
     {
         MenuOrder_R MOR = this.MORDataContext.MenuOrder_R.SingleOrDefault(o => o.OrderID == orderID);
         this.MORDataContext.MenuOrder_R.DeleteOnSubmit(MOR);
         this.MORDataContext.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #5
0
 public bool UpdataMOR(MenuOrder_R MOR)
 {
     return(mORDataAccess.UpdataMOR(MOR));
 }
コード例 #6
0
 public bool AddMOR(MenuOrder_R MOR)
 {
     return(mORDataAccess.AddMOR(MOR));
 }
コード例 #7
0
        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("提交成功!", "提示");
        }