Exemplo n.º 1
0
        private void LoadbyCN(string key)
        {
            StorageDAO s = new StorageDAO();

            dgvTonKho.DataSource = s.listCustombyCN(key).ToList();
            SetEditingMode(false);
        }
Exemplo n.º 2
0
        public ActionResult Complite(int id)
        {
            OrdersDAO odao = new OrdersDAO();
            Orders    ord  = odao.Single(x => x.Id_ord == id);

            ord.Status = new StatusDAO().Single(x => x._name == "Выполнен").Id;
            StorageDAO stoDao = new StorageDAO();
            Storage    add    = stoDao.Single(x => x.FK_mat == ord.FK_Mat1);

            if (add == null)
            {
                add = new Storage()
                {
                    FK_mat = ord.FK_Mat1,
                    Number = ord.Number
                };
                stoDao.insert(add);
            }
            else
            {
                add.Number += ord.Number;
                stoDao.update(add);
            }
            odao.update(ord);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        private void txtProductName_TextChanged(object sender, EventArgs e)
        {
            StorageDAO          storage = new StorageDAO();
            List <SellGridView> list    = storage.listCustombyName(txtProductName.Text).ToList();

            dgv_sellProduct.DataSource = list;
        }
Exemplo n.º 4
0
        private void LoadData()
        {
            StorageDAO  s  = new StorageDAO();
            DBContextSV db = new DBContextSV(Program.connectionString);

            comboBox1.DataSource = db.chinhanhs.Select(x => x.tencn).ToList();
            dgvTonKho.DataSource = s.listCustom().ToList();
            SetEditingMode(false);
        }
Exemplo n.º 5
0
        public MsgBox storageAdd(Storage s)
        {
            //建立主键
            s.ID = Guid.NewGuid().ToString();

            MsgBox mb = null;

            //传到Dao层处理
            //存在的情况下,更新
            if (new StorageDAO().checkExist(s))
            {
                mb = new StorageDAO().updateStorage(s);
            }
            //否则就新增一条
            else
            {
                mb = new StorageDAO().insertStorage(s);
            }

            return(mb);
        }
Exemplo n.º 6
0
        private void iconbtnAdd_Click(object sender, EventArgs e)
        {
            sanpham s = new sanpham();

            s.masp   = txt_masp.Text;
            s.tensp  = txt_tenSP.Text;
            s.loai   = cbTypeProduct.Text;
            s.nhacc  = cbSupplier.Text;
            s.nhasx  = cbNSX.Text;
            s.giaban = Int32.Parse(txtPrice.Text);
            ProductDAO1 p   = new ProductDAO1();
            StorageDAO  kho = new StorageDAO();

            if (p.create(s) == 1)
            {
                MessageBox.Show("Thêm thành công");
            }
            else
            {
                MessageBox.Show("Thêm thất bại");
            }
        }
        public SingleResponse <Storage> DeleteProduct(ProductOutputDetail item)
        {
            SingleResponse <Storage> singleResponse = new SingleResponse <Storage>();
            Storage storage = new Storage();

            storage.ProductsID = item.IDProduct;

            StorageDAO storageDAO = new StorageDAO();

            if (storageDAO.GetQuantityByIDProductsOutput(item).Quantity == 0)
            {
                singleResponse.Message = "Estoque zerado";
                singleResponse.Success = false;
            }
            else if (storageDAO.GetQuantityByIDProductsOutput(item).Quantity > 0)
            {
                item.Quantity         -= storageDAO.GetQuantityByIDProductsOutput(item).Quantity;
                storage.Quantity       = item.Quantity;
                singleResponse.Success = true;
                Update(storage);
            }
            return(singleResponse);
        }
        public SingleResponse <Storage> AddProduct(ProductIncomeDetail item)
        {
            SingleResponse <Storage> singleResponse = new SingleResponse <Storage>();
            Storage storage = new Storage();

            storage.ProductsID = item.IDProduct;

            StorageDAO storageDAO = new StorageDAO();

            if (storageDAO.GetQuantityByIDProducts(item).Quantity == 0)
            {
                item.Quantity    = storageDAO.GetQuantityByIDProducts(item).Quantity;
                storage.Quantity = item.Quantity;
                Update(storage);
            }
            else if (storageDAO.GetQuantityByIDProducts(item).Quantity > 0)
            {
                ProductPriceAtt(item);
                item.Quantity   += storageDAO.GetQuantityByIDProducts(item).Quantity;
                storage.Quantity = item.Quantity;
                Update(storage);
            }
            return(singleResponse);
        }
Exemplo n.º 9
0
        public ActionResult Edit(int id)
        {
            Storage obj = new StorageDAO().Select(id);

            return(View(obj));
        }
Exemplo n.º 10
0
        public ActionResult Index()
        {
            StorageDAO sdao = new StorageDAO();

            return(View(sdao.Select()));
        }
Exemplo n.º 11
0
        private void loadDataByKey(string text)
        {
            StorageDAO s = new StorageDAO();

            dgvTonKho.DataSource = s.listCustombyName(text).ToList();
        }
Exemplo n.º 12
0
        public void loaddata()
        {
            StorageDAO s = new StorageDAO();

            dgv_sellProduct.DataSource = s.listCustom().ToList();
        }