/// <summary> /// Initial approve to elastic search model. /// </summary> /// <param name="result"></param> /// <param name="item"></param> /// <returns></returns> private CaSearchViewModel InitialApprove(CaSearchViewModel result, Ca item) { var workflowLog = new List <WorkflowActivityLog>(); var process = _unitOfWork.GetRepository <WorkflowProcessInstance>().Get(x => x.DataId == item.Id && x.ProcessCode == CaViewModel.ProcessCode).FirstOrDefault(); if (process != null) { workflowLog = _unitOfWork.GetRepository <WorkflowActivityLog>().Get(x => x.ProcessInstanceId == process.ProcessInstanceId).ToList(); } workflowLog = workflowLog.Where(x => x.Step > 1).ToList(); foreach (var workItem in workflowLog) { result = SetApproveElastic(result, workItem); } return(result); }
/// <summary> /// Set property approve elastic search. /// </summary> /// <param name="result"></param> /// <param name="workItem"></param> /// <returns></returns> private CaSearchViewModel SetApproveElastic(CaSearchViewModel result, WorkflowActivityLog workItem) { if (string.IsNullOrEmpty(result.Approver01)) { result.Approver01 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver02)) { result.Approver02 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver03)) { result.Approver03 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver04)) { result.Approver04 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver05)) { result.Approver05 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver06)) { result.Approver06 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver07)) { result.Approver07 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver08)) { result.Approver08 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver09)) { result.Approver09 = workItem.ActionUser; } else if (string.IsNullOrEmpty(result.Approver10)) { result.Approver10 = workItem.ActionUser; } return(result); }
/// <summary> /// Initial Ca Model to Ca Search Model. /// </summary> /// <param name="model"></param> /// <returns></returns> private CaSearchViewModel InitialCAListViewModel(Ca model) { var status = _unitOfWork.GetRepository <ValueHelp>().GetCache(x => x.ValueType == ConstantValue.VALUE_HELP_STATUS && x.ValueKey == model.Status).FirstOrDefault(); var result = new CaSearchViewModel { ID = model.Id, CANo = UtilityService.DataOrDefault(model.Cano), ComCode = model.ComCode, FundIOSAP = UtilityService.DataOrDefault(model.FundSap), Amount = model.Amount.HasValue ? model.Amount.Value.ToString("0.##") : string.Empty, AmountText = UtilityService.DataOrDefault(model.Amount), DueDate = UtilityService.DataOrDefault(model.DueDate, ConstantValue.DATETIME_DAYMONTHYEAR), DueDateText = UtilityService.DataOrDefault(model.DueDate, ConstantValue.DATETIME_DAYMONTHTEXTYEAR), DueDateSort = model.DueDate, RequireDate = UtilityService.DataOrDefault(model.RequireDate, ConstantValue.DATETIME_DAYMONTHYEAR), RequireDateText = UtilityService.DataOrDefault(model.RequireDate, ConstantValue.DATETIME_DAYMONTHTEXTYEAR), RequireDateSort = model.RequireDate, Status = model.Status, StatusText = status.ValueText, ReceiveDate = UtilityService.DataOrDefault(model.ReceiveDate, ConstantValue.DATETIME_DAYMONTHYEAR), ReceiveDateText = UtilityService.DataOrDefault(model.ReceiveDate, ConstantValue.DATETIME_DAYMONTHTEXTYEAR), ReceiveDateSort = model.ReceiveDate, RequestFor = model.RequestFor, RequestPos = model.RequestPos, RequestOrg = model.RequestOrg, CreateBy = model.CreateBy, CreatePos = model.CreatePos, CreateOrg = model.CreateOrg, CreateByText = this.GetCreateBy(model.RequestFor) }; result = this.InitialApprove(result, model); return(result); }