Exemple #1
0
 public void ModifyExpenseGroup(ExpenseGroupDE mod)
 {
     _expGrpRepo.Update(mod);
     _expGrpRepo.CommitAllChanges();
 }
Exemple #2
0
 public ExpenseGroupViewModel()
 {
     ExpenseGroup = new ExpenseGroupDE();
     ExpenseGroups = new List<ExpenseGroupDE>();
 }
Exemple #3
0
 public void AddExpenseGroup(ExpenseGroupDE mod)
 {
     _expGrpRepo.Insert(mod);
     _expGrpRepo.CommitAllChanges();
 }
        public ExpenseGroupViewModel ModifyExpenseGroup(ExpenseGroupDE mod)
        {
            ExpenseGroupViewModel model = new ExpenseGroupViewModel();

            try
            {
                DBOperations op = mod.IsActive ? DBOperations.Update : DBOperations.Delete;
                mod.SiteCode = AppConstants.SITE_CODE;
                _bdmSvc.ModifyExpenseGroup(mod);

                model.ExpenseGroup = new ExpenseGroupDE();
                model.FieldId = "groupCode";
                model.ExpenseGroups = _bdmSvc.GetAllExpenseGroups(AppConstants.SITE_CODE); //.GetAllExpenseGroups().Map(model.ExpenseGroups);
                model.Message = op == DBOperations.Update ? string.Format(AppConstants.CRUD_UPDATE, "ExpenseGroup") : string.Format(AppConstants.CRUD_DELETE, "ExpenseGroup");
            }
            catch (Exception ex)
            {

                model.IsValid = false;
                model.Message = ex.Message;
                if (ex.Message.Contains("Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions."))
                {
                    model.FieldId = "groupCode";
                    model.Message = "Unable to modify ExpenseGroup Code";
                }

            }
            return model;
        }