private void LoadbyCN(string key) { StorageDAO s = new StorageDAO(); dgvTonKho.DataSource = s.listCustombyCN(key).ToList(); SetEditingMode(false); }
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")); }
private void txtProductName_TextChanged(object sender, EventArgs e) { StorageDAO storage = new StorageDAO(); List <SellGridView> list = storage.listCustombyName(txtProductName.Text).ToList(); dgv_sellProduct.DataSource = list; }
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); }
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); }
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); }
public ActionResult Edit(int id) { Storage obj = new StorageDAO().Select(id); return(View(obj)); }
public ActionResult Index() { StorageDAO sdao = new StorageDAO(); return(View(sdao.Select())); }
private void loadDataByKey(string text) { StorageDAO s = new StorageDAO(); dgvTonKho.DataSource = s.listCustombyName(text).ToList(); }
public void loaddata() { StorageDAO s = new StorageDAO(); dgv_sellProduct.DataSource = s.listCustom().ToList(); }