public ActionResult Apply(string ProcessEntity, object EntityData = null) { //Get business proccess flow var process = processRepository.GetAllProcess().Where(item => item.Category == "business_process_flow" && item.DataSource == ProcessEntity && item.IsActive.Value).FirstOrDefault(); if (process != null) { var model = new ProcessApplyViewModel(); model.ProcessEntity = ProcessEntity; model.EntityData = EntityData; model.ListProcessStage = processStageRepository.GetAllProcessStage() .Where(item => item.ProcessId == process.Id) .Select(item => new ProcessStageViewModel { Id = item.Id, Name = item.Name, OrderNo = item.OrderNo }).OrderBy(m => m.OrderNo).ToList(); int activeStageId = model.ListProcessStage[0].Id; var q = processStepRepository.GetAllProcessStep() .Where(item => item.StageId == activeStageId) .Select(i => new ProcessStepViewModel { Id = i.Id, Name = i.Name, StepValue = i.StepValue, IsRequired = i.IsRequired, IsSequential = i.IsSequential, EditControl = i.EditControl, OrderNo = i.OrderNo }).OrderBy(m => m.OrderNo).ToList(); model.ListEditViewField = new List <Administration.Models.EditViewField>(); foreach (var item in q) { var editViewField = new Administration.Models.EditViewField(); editViewField.LabelName = item.Name; editViewField.FieldName = item.StepValue; editViewField.IsRequired = item.IsRequired; editViewField.EditControl = item.EditControl; editViewField.OrderNo = item.OrderNo; model.ListEditViewField.Add(editViewField); } return(View(model)); } return(null); }
public ViewResult Index(int StageId, string ProcessEntity) { IQueryable <ProcessStepViewModel> q = ProcessStepRepository.GetAllProcessStep() .Where(item => item.StageId == StageId) .Select(item => new ProcessStepViewModel { Id = item.Id, CreatedUserId = item.CreatedUserId, //CreatedUserName = item.CreatedUserName, CreatedDate = item.CreatedDate, ModifiedUserId = item.ModifiedUserId, //ModifiedUserName = item.ModifiedUserName, ModifiedDate = item.ModifiedDate, Name = item.Name, StepValue = item.StepValue, IsRequired = item.IsRequired, IsSequential = item.IsSequential, OrderNo = item.OrderNo }).OrderBy(m => m.OrderNo); ViewBag.StageId = StageId; ViewBag.ProcessEntity = ProcessEntity; return(View(q)); }