public bool UpdatePurchaseHeader(PurchaseHeaderViewModel model)
        {
            var instanceToUpdate = _purchaseHeaderRepository.FindBy(x => x.PurchaseNumber == model.PurchaseNumber).FirstOrDefault();

            if (instanceToUpdate == null)
            {
                return(false);
            }
            instanceToUpdate.CreatePerson     = model.CreatePerson;
            instanceToUpdate.AuditDepart      = model.AuditDepart;
            instanceToUpdate.Auditor          = model.Auditor;
            instanceToUpdate.DeliveryCategory = model.DeliveryCategory;
            instanceToUpdate.DeliveryDate     = model.DeliveryDate;
            instanceToUpdate.PurchaseCategory = model.PurchaseCategory;
            instanceToUpdate.UpdateDate       = DateTime.Now;
            try
            {
                _purchaseHeaderRepository.Edit(instanceToUpdate);
                _purchaseHeaderRepository.Save();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Esempio n. 2
0
        //修改Header
        private void gridView1_RowUpdated(object sender, RowObjectEventArgs e)
        {
            SplashScreenManager.ShowDefaultWaitForm();
            PurchaseHeaderViewModel row = (PurchaseHeaderViewModel)this.gridView1.GetFocusedRow();

            _purchaseService.UpdatePurchaseHeader(row);
            SplashScreenManager.CloseDefaultWaitForm();
        }
 public AllPurchaseHeaderViewModel()
 {
     purchaseHeaderRepository = new PurchaseHeaderRepository();
     purchaseHeaderViewModel = new PurchaseHeaderViewModel();
 }