public DataSaveResult Save()
 {
     this.IsCopy = false;
     Ast_AssetCatogry dbAssetCatogry;
     try
     {
         NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
         var dbAssetCatogrys = from u in newAppsCnn.Ast_AssetCatogry where u.AstCatId == this.AstCatId select u;
         if (dbAssetCatogrys.Count() > 0)
         {
             dbAssetCatogry = dbAssetCatogrys.First();
             this.ToDbAssetCatogry(dbAssetCatogry);
         }
         else
         {
             dbAssetCatogry = new Ast_AssetCatogry();
             this.ToDbAssetCatogry(dbAssetCatogry);
             newAppsCnn.Ast_AssetCatogry.Add(dbAssetCatogry);
         }
         newAppsCnn.SaveChanges();
         Audit.AddDataAudit(Audit.AuditActionTypes.AddNew, "Ast_AssetCatogry", this);
         this.FromDbAssetCatogry(dbAssetCatogry);
         return new DataSaveResult() { SaveStatus = true };
     }
     catch (Exception ex)
     {
         return new DataSaveResult() { SaveStatus = false,ErrorMessage=ex.Message };
     }
 }
 public void ToDbAssetCatogry(Ast_AssetCatogry _dbAssetCatogry)
 {
     _dbAssetCatogry.AstCatId = this.AstCatId;
     _dbAssetCatogry.AstCatName_Ara = this.AstCatName_Ara;
     _dbAssetCatogry.AstCatName_Eng = this.AstCatName_Eng;
     _dbAssetCatogry.IsDisable = this.IsDisable;
     if (this.IsNew == true)
     {
         _dbAssetCatogry.ParentId = this.ParentId;
     }
     this.IsCopy = false;
 }
 public void FromDbAssetCatogry(Ast_AssetCatogry _dbAssetCatogry)
 {
     this.AstCatId = _dbAssetCatogry.AstCatId;
     this.AstCatName_Ara = _dbAssetCatogry.AstCatName_Ara;
     this.AstCatName_Eng = _dbAssetCatogry.AstCatName_Eng;
     this.IsDisable = _dbAssetCatogry.IsDisable;
     this.ParentId = _dbAssetCatogry.ParentId;
     this.IsNew = false;
     this.IsCopy = false;
 }