Exemple #1
0
        public frmInOut(InOut inOut)
        {
            InitializeComponent();
            this.BindMaterials();

            this.InOut = inOut;
            this.Text  = this.InOut.IsIn ? "编辑入库" : "编辑出库";
            this.SyncToControl();
            //this.isAdding = true;
        }
Exemple #2
0
        public frmInOut(bool isIn)
        {
            InitializeComponent();
            this.BindMaterials();

            this.InOut      = new InOut();
            this.InOut.IsIn = isIn;
            this.Text       = isIn ? "添加入库" : "添加出库";
            //this.isAdding = true;
        }
Exemple #3
0
        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();
                }
            }
        }
Exemple #4
0
        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();
                }
            }
        }
Exemple #5
0
 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);
     }
 }
Exemple #6
0
 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);
     }
 }
Exemple #7
0
        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();
                    }
                }
            }
        }
Exemple #8
0
 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);
     }
 }