Example #1
0
 public DataSaveResult Save()
 {
     Acc_Accountype dbAccounttype;
     try
     {
         NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
         var dbAccounttypes = from u in newAppsCnn.Acc_Accountype where u.TypeID == this.TypeID select u;
         if (dbAccounttypes.Count() > 0)
         {
             dbAccounttype = dbAccounttypes.First();
             this.ToDbAccounttype(dbAccounttype);
         }
         else
         {
             dbAccounttype = new Acc_Accountype();
             this.ToDbAccounttype(dbAccounttype);
             newAppsCnn.Acc_Accountype.Add(dbAccounttype);
         }
         newAppsCnn.SaveChanges();
         Audit.AddDataAudit(Audit.AuditActionTypes.AddNew, "Acc_Accountype", this);
         this.FromDbAccounttype(dbAccounttype);
         return new DataSaveResult() { SaveStatus = true };
     }
     catch (Exception ex)
     {
         return new DataSaveResult() { SaveStatus = false ,ErrorMessage=ex.Message};
     }
 }
Example #2
0
 public void ToDbAccounttype(Acc_Accountype _dbAccounttype)
 {
     _dbAccounttype.TypeID = this.TypeID;
     _dbAccounttype.TypeName_Ara = this.TypeName_Ara;
     _dbAccounttype.TypeName_Eng = this.TypeName_Eng;
     _dbAccounttype.IsDisable = this.IsDisable;
 }
Example #3
0
 public void FromDbAccounttype(Acc_Accountype _dbAccounttype)
 {
     this.TypeID = _dbAccounttype.TypeID;
     this.TypeName_Ara = _dbAccounttype.TypeName_Ara;
     this.TypeName_Eng = _dbAccounttype.TypeName_Eng;
     this.IsDisable = _dbAccounttype.IsDisable;
     this.IsNew = false;
 }