Esempio n. 1
0
 public DataSaveResult Save()
 {
     this.IsCopy = false;
     Acc_CostCenter dbCostCenter;
     try
     {
         NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
         var dbCostCenters = from u in newAppsCnn.Acc_CostCenter where u.CostCenterId == this.CostCenterId select u;
         if (dbCostCenters.Count() > 0)
         {
             dbCostCenter = dbCostCenters.First();
             this.ToDbCostCenter(dbCostCenter);
         }
         else
         {
             dbCostCenter = new Acc_CostCenter();
             this.ToDbCostCenter(dbCostCenter);
             newAppsCnn.Acc_CostCenter.Add(dbCostCenter);
         }
         newAppsCnn.SaveChanges();
         Audit.AddDataAudit(Audit.AuditActionTypes.AddNew, "Acc_CostCenter", this);
         this.FromDbCostCenter(dbCostCenter);
         return new DataSaveResult() { SaveStatus = true};
     }
     catch (Exception ex)
     {
         return new DataSaveResult() { SaveStatus = false ,ErrorMessage= ex.Message };
     }
 }
Esempio n. 2
0
 public void ToDbCostCenter(Acc_CostCenter _dbCostCenter)
 {
     _dbCostCenter.CostCenterId = this.CostCenterId;
     _dbCostCenter.CostCenterName_Ara = this.CostCenterName_Ara;
     _dbCostCenter.CostCenterName_Eng = this.CostCenterName_Eng;
     _dbCostCenter.CostOpenBalance = this.CostOpenBalance;
     _dbCostCenter.ClosingBalance = this.ClosingBalance;
     _dbCostCenter.IsDisable = this.IsDisable;
     if (this.IsNew == true)
     {
         _dbCostCenter.ParentId = this.ParentId;
     }
     this.IsCopy = false;
 }
Esempio n. 3
0
 public void FromDbCostCenter(Acc_CostCenter _dbCostCenter)
 {
     this.CostCenterId = _dbCostCenter.CostCenterId;
     this.CostCenterName_Ara = _dbCostCenter.CostCenterName_Ara;
     this.CostCenterName_Eng = _dbCostCenter.CostCenterName_Eng;
     this.CostOpenBalance = _dbCostCenter.CostOpenBalance.Value;
     this.ClosingBalance = _dbCostCenter.ClosingBalance.Value;
     this.IsDisable = _dbCostCenter.IsDisable;
     this.ParentId = _dbCostCenter.ParentId;
     this.IsNew = false;
     this.IsCopy = false;
 }