コード例 #1
0
ファイル: StateService.cs プロジェクト: surifoll/git-test
 public void CreateState(StateModel model, string username)
 {
     try
     {
         Mapper.CreateMap<StateModel, State>();
         _unitOfWork.BeginTransaction();
         var entity = Mapper.Map<StateModel, State>(model);
         entity.CreatedBy = username;
         entity.CreatedDate = DateTime.Now;
         _repository.Insert(entity);
         model.Id = entity.Id;
         AddToApprovalProcess(model,username);
         _unitOfWork.Commit();
     }
     catch (Exception)
     {
         _unitOfWork.Rollback();
         throw;
     }
 }
コード例 #2
0
ファイル: StateService.cs プロジェクト: surifoll/git-test
 private void AddToApprovalProcess(StateModel model, string username)
 {
     var processRefId = UtilityService.GetStateRefId(model.Id);
     var workFlow = _workflowService.GetWorkflow(0, WorkFlowsConstants.SuperAdminDictionary[(int)WorkFlowsConstants.SuperAdminEnum.Configuration]);
     _workFlowSetupService.AddProcessToWorkflow(workFlow.Id, processRefId, processRefId);
     Approve(new StateApprovalModel
     {
         StateId = model.Id,
         Comment = "I Created "+ model.Name +" State "
     }, username, processRefId);
 }
コード例 #3
0
ファイル: StateService.cs プロジェクト: surifoll/git-test
 public void EditState(StateModel model, string username)
 {
     try
     {
         _unitOfWork.BeginTransaction();
         State entity = GetStateEntity(model.Id);
         Mapper.CreateMap<StateModel,State>();
         Mapper.Map(model, entity);
         entity.UpdatedBy = username;
         entity.UpdatedDate = DateTime.Now;
         _repository.Update(entity);
         _unitOfWork.Commit();
     }
     catch (Exception)
     {
         _unitOfWork.Rollback();
         throw;
     }
 }