예제 #1
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();
                }
            }
        }
예제 #2
0
        private void btnEditIn_Click(object sender, EventArgs e)
        {
            VIn vIn = this.GetFirstSelectedVIn();

            if (vIn != null)
            {
                InOut    inOut  = DAL.GetInOutByVIn(vIn);
                int      oldId  = inOut.ID;
                frmInOut editor = new frmInOut(inOut);
                if (editor.ShowDialog() == DialogResult.OK)
                {
                    if (DAL.EditInOut(oldId, inOut))
                    {
                        this.ViewAll();
                    }
                }
            }
        }
예제 #3
0
파일: DAL.cs 프로젝트: tomyqg/CSHomework
 public static InOut GetInOutByVIn(VIn vIn)
 {
     try
     {
         using (WareHouseEntities en = new WareHouseEntities())
         {
             return(en.InOuts.Include(p => p.Material).First(x =>
                                                             x.IsIn &&
                                                             x.Material.Name == vIn.Name &&
                                                             x.Quantity == vIn.Quantity &&
                                                             x.Date == vIn.Date));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }