Beispiel #1
0
 public bool SetFieldStatus(int resolutionId, string fieldname, bool included)
 {
     try
     {
         var provider = new ResolutionProvider(_context);
         var entity   = provider.Retrieve(resolutionId);
         if (entity != null)
         {
             if (fieldname == "IncludeOnStatement")
             {
                 entity.IncludeOnStatement = included;
                 provider.Update(entity.ResolutionId, entity);
                 provider.Commit();
                 return(true);
             }
             else // not supported field; just ignore for now...
             {
                 return(true);
             }
         }
     }
     catch
     {
         throw;
     }
     return(false);
 }
Beispiel #2
0
 // Replaced by stored precedure version MoveWorkflowAll above due to performance issue using Entity Framework for bulk db operation
 public RevenueApprovalStatus?BacktrackWorkflowAll(DateTime month, RevenueApprovalStatus state)
 {
     try
     {
         // Too slow to use Entity Framework for bulk upload
         var provider    = new ResolutionRevenueProvider(_context);
         var resolutions = provider.Retrieve(month, string.Empty);
         var prevState   = PrevState(state);
         if (resolutions != null && prevState != null)
         {
             var dataProvider = new ResolutionProvider(_context);
             foreach (var viewModel in resolutions)
             {
                 //BacktrackWorkflow(viewModel.ResolutionId, state);
                 var entity = dataProvider.Retrieve(viewModel.ResolutionId);
                 if (entity != null)
                 {
                     entity.ApprovalStatus = prevState.Value;
                     RetrackWorkflowSignature(entity, state);
                     dataProvider.Update(entity.ResolutionId, entity);
                 }
             }
             dataProvider.Commit();
             return(prevState);
         }
     }
     catch
     {
         throw;
     }
     return(null);
 }
Beispiel #3
0
 // Replaced by stored precedure version MoveWorkflowAll above due to performance issue using Entity Framework for bulk db operation
 public RevenueApprovalStatus?MoveWorkflowAll(DateTime month, RevenueApprovalStatus state)
 {
     try
     {
         // Too slow using Entity Framework for bulk upload
         var provider = new ResolutionRevenueProvider(_context);
         List <ResolutionRevenueModel> resolutions = provider.Retrieve(month, string.Empty);
         var nextState = NextState(state);
         if (resolutions != null && nextState != null)
         {
             var dataProvider = new ResolutionProvider(_context);
             foreach (var viewModel in resolutions)
             {
                 //MoveWorkflow(viewModel.ResolutionId, state);
                 var entity = dataProvider.Retrieve(viewModel.ResolutionId);
                 if (entity != null)
                 {
                     entity.ApprovalStatus = state;
                     SetWorkflowSignature(entity, state);
                     dataProvider.Update(entity.ResolutionId, entity);
                 }
             }
             dataProvider.Commit();
             return(nextState);
         }
     }
     catch
     {
         throw;
     }
     return(null);
 }
Beispiel #4
0
 public override void Update(int id, ResolutionRevenueModel model)
 {
     try
     {
         var dataProvider = new ResolutionProvider(_context);
         var entity       = dataProvider.Retrieve(model.ResolutionId);
         MapData(model, entity, false);
         dataProvider.Update(id, entity);
     }
     catch
     {
         throw;
     }
 }
Beispiel #5
0
 public override void Delete(int id)
 {
     try
     {
         // entity deletion does not physically delete the record; it marks [IsDeletd] = true
         var dataProvider = new ResolutionProvider(_context);
         var entity       = dataProvider.Retrieve(id);
         entity.IsDeleted = true;
         dataProvider.Update(id, entity);
     }
     catch
     {
         throw;
     }
 }
Beispiel #6
0
 public RevenueApprovalStatus?BacktrackWorkflow(int resolutionId, RevenueApprovalStatus state)
 {
     try
     {
         var dataProvider = new ResolutionProvider(_context);
         var entity       = dataProvider.Retrieve(resolutionId);
         var prevState    = PrevState(state);
         if (entity != null && prevState != null)
         {
             entity.ApprovalStatus = prevState.Value;
             RetrackWorkflowSignature(entity, state);
             dataProvider.Update(resolutionId, entity);
             dataProvider.Commit();
             return(prevState);
         }
     }
     catch
     {
         throw;
     }
     return(null);
 }
Beispiel #7
0
 public RevenueApprovalStatus?MoveWorkflow(int resolutionId, RevenueApprovalStatus state)
 {
     try
     {
         var dataProvider = new ResolutionProvider(_context);
         var entity       = dataProvider.Retrieve(resolutionId);
         var nextState    = NextState(state);
         if (entity != null && nextState != null)
         {
             entity.ApprovalStatus = state;
             SetWorkflowSignature(entity, state);
             dataProvider.Update(resolutionId, entity);
             dataProvider.Commit();
             return(nextState);
         }
     }
     catch
     {
         throw;
     }
     return(null);
 }