/// <summary>
        /// 对商品进行折扣
        /// </summary>
        /// <param name="selectedGroupProd">选中的Group_Prod</param>
        private void OrderMenu_DiscountGroupProd(string selectedGroupProd)
        {
            UpdateSales updateSales = new UpdateSales();

            updateSales.setPriceDisc(selectedGroupProd, Info.inputNumber);
            this.orderMenu.LoadInfo();
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            UpdateSales inventory = db.Inventory.Find(id);

            db.Inventory.Remove(inventory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "ID,Name,Quantity")] UpdateSales inventory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inventory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(inventory));
 }
        /// <summary>
        /// 主窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void MainForm_Load(object sender, EventArgs e)
        {
            this.Visible = false;
            ReadIni readIni = new ReadIni();

            CreateDB();

            Info.printPort   = operPara1.GetIniConfig("printPort");
            Info.cusShowPort = operPara1.GetIniConfig("cusShowPort");
            Info.showPort    = operPara1.GetIniConfig("showPort");
            Info.ICPort      = operPara1.GetIniConfig("ICPort");

            #region 生成连接字符串
            string localIp = this.operPara1.LocalIp;
            if (localIp == "")
            {
                string strHostName = Dns.GetHostName();                            //得到本机的主机名
                localIp = Dns.GetHostEntry(strHostName).AddressList[0].ToString(); //取得本机IP
            }
            //创建带实例名的连接
            Info.Constr = "server=" + localIp + @"\" + this.operPara1.LocalCase + "," + this.operPara1.LocalPort + ";" + "database=" + this.operPara1.LocalDBName + ";" + "uid=" + this.operPara1.LocalUserName + ";pwd=" + "'" + this.operPara1.LocalPassword + "'";
            #endregion
            try
            {
                Info.insertSingleProd = new InsertSingleProd();
                Info.getProduct       = new GetProduct0();
                login          = new Login();
                login.MainForm = this;
                login.ShowDialog();

                this.functionPanel.LoadBtnInfo(Info.emp_id, "", true);

                if (recoverSucess)
                {
                    //加载商品类别信息
                    this.btnPanelKind.LoadInfo(0, true);
                    this.Visible       = true;
                    this.recoverSucess = false;
                    //若上次处于结账状态,恢复成功时恢复结账前状态
                    UpdateSales.InitUpdateSales().DelSalesSucess();
                    this.orderMenu.LoadInfo();
                    return;
                }

                #region 如果本地数据库中的数据达到一定要求则按条件删除一部分
                DelLocalDB del = new DelLocalDB(this);
                del.DelLocalData();
                #endregion

                //加载商品类别信息
                this.btnPanelKind.LoadInfo(0, true);
                this.Visible = true;
            }
            catch { }
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "ID,Name,Quantity")] UpdateSales inventory)
        {
            if (ModelState.IsValid)
            {
                db.Inventory.Add(inventory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(inventory));
        }
Ejemplo n.º 6
0
        // GET: Inventory
        public ActionResult Index(int?id)
        {
            List <Menu> menu      = db.Menu.ToList();
            UpdateSales inventory = db.Inventory.Find(id);

            var updateSalestuple = new Tuple <List <Menu>, UpdateSales>(menu, inventory);

            return(View(updateSalestuple));


            //return View(db.Inventory.ToList());
        }
        /// <summary>
        /// 修改商品数量
        /// </summary>
        /// <param name="group_prod">组商品号</param>
        /// <param name="type">修改的类型,0代表自加1,1代表自减1,2代表把商品数量改成number代表的数量</param>
        /// <param name="number">修改的类型,0代表自加1,1代表自减1</param>
        private void OrderMenu_AlterProd(string group_prod, int type, decimal number)
        {
            UpdateSales updateSales = new UpdateSales();

            if (updateSales.CanChangeQty(group_prod, type, Info.sale_id, number))
            {
                updateSales.setSalesQty(group_prod, type, number);
                this.orderMenu.LoadInfo();
            }
            else
            {
                MessageBox.Show("改变数量失败!");
            }
        }
        /// <summary>
        /// 删除点单控件中选中的一个组商品
        /// </summary>
        /// <param name="orderMenu">点单控件对象</param>
        private void OrderMenu_DeleteGroup(OrderMenu orderMenu)
        {
            UpdateSales updateSale01 = new UpdateSales();

            if (orderMenu.SelectedGroupProd != "")
            {
                //从数据库中删除该组商品
                updateSale01.DelGroupProd(orderMenu.SelectedGroupProd);
                //清空选中的组号
                orderMenu.SelectedGroupProd = "";
                //重新给dataGridView绑定信息
                orderMenu.LoadInfo();
            }
        }
Ejemplo n.º 9
0
        // GET: Inventory/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UpdateSales inventory = db.Inventory.Find(id);

            if (inventory == null)
            {
                return(HttpNotFound());
            }
            return(View(inventory));
        }