public frmInOut(InOut inOut) { InitializeComponent(); this.BindMaterials(); this.InOut = inOut; this.Text = this.InOut.IsIn ? "编辑入库" : "编辑出库"; this.SyncToControl(); //this.isAdding = true; }
public frmInOut(bool isIn) { InitializeComponent(); this.BindMaterials(); this.InOut = new InOut(); this.InOut.IsIn = isIn; this.Text = isIn ? "添加入库" : "添加出库"; //this.isAdding = true; }
private void btnDeleteOut_Click(object sender, EventArgs e) { VOut vOut = this.GetFirstSelectedVOut(); InOut inOut = DAL.GetInOutByVOut(vOut); if (vOut != null) { if (DAL.DeleteInOut(inOut)) { this.ViewAll(); } } }
private void btnDelIn_Click(object sender, EventArgs e) { VIn vIn = this.GetFirstSelectedVIn(); InOut inOut = DAL.GetInOutByVIn(vIn); if (vIn != null) { if (DAL.DeleteInOut(inOut)) { this.ViewAll(); } } }
public static bool AddInOut(InOut inOut) { try { using (WareHouseEntities en = new WareHouseEntities()) { en.InOuts.Add(inOut); en.SaveChanges(); } return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
public static bool DeleteInOut(InOut InOut) { try { using (WareHouseEntities en = new WareHouseEntities()) { InOut inOut = en.InOuts.First(x => x.ID == InOut.ID); en.InOuts.Remove(inOut); en.SaveChanges(); } return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
private void btnEditOut_Click(object sender, EventArgs e) { VOut vOut = this.GetFirstSelectedVOut(); if (vOut != null) { InOut inOut = DAL.GetInOutByVOut(vOut); int oldId = inOut.ID; frmInOut editor = new frmInOut(inOut); if (editor.ShowDialog() == DialogResult.OK) { if (DAL.EditInOut(oldId, inOut)) { this.ViewAll(); } } } }
public static bool EditInOut(int oldInOutID, InOut newInOut) { try { using (WareHouseEntities en = new WareHouseEntities()) { InOut inOut = en.InOuts.First(x => x.ID == oldInOutID); inOut.MID = newInOut.MID; inOut.Quantity = newInOut.Quantity; inOut.Date = newInOut.Date; en.SaveChanges(); } return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }