public void FindSpawnIdInActions(DTO.Program program, string p, DTO.Module m) { try { if (m.Actions != null) { foreach (Actions a in m.Actions) { if (a.Id.Equals(p)) { SetInitialProperties(program.AssignToId, a, false); OnProcessIdEvent(a); } else { FindSpawnIdInSteps(program, p, a); } } } } catch (Exception ex) { throw new Exception("AD:PlanElementUtil:FindIdInActions()::" + ex.Message, ex.InnerException); } }
public void Set_Assigned_On_With_Previous_Not_Complete() { IPlanElementUtils peUtil = new PlanElementUtils { }; var mods = new List <AD.Module> { new AD.Module { Id = "123456789012345678901234", Completed = false } }; AD.Module mod = new DTO.Module { Previous = "123456789012345678901234" }; peUtil.SetEnabledState(mods, mod, "123456789012345612341234", true); Assert.IsNull(mod.AssignDate); }
public void Set_Assigned_On_With_Previous_Complete() { IPlanElementUtils peUtil = new PlanElementUtils { }; var mods = new List <AD.Module> { new AD.Module { Id = "123456789012345678901234", Completed = true } }; AD.Module mod = new DTO.Module { Previous = "123456789012345678901234" }; peUtil.SetEnabledState(mods, mod, "123456789012345612341234", true); Assert.AreEqual(DateTime.UtcNow.Date, ((DateTime)mod.AssignDate).Date); }
public List <DTO.Module> GetReportData(int?moduleId, int?userId, int?userGroupId, int?officeId) { List <DTO.UserPermission> permissionDetails = GetReportDataDetail(moduleId, userId, userGroupId, officeId); List <DTO.Module> data = new List <DTO.Module>(); using (PermissionOverviewRptEntities context = CreateContext()) { data = converter.DB2DTO_Module(context.PermissionOverviewRpt_function_getModule(moduleId).ToList()); } foreach (int mID in permissionDetails.Select(o => o.ModuleID).Distinct()) { DTO.Module mModule = data.FirstOrDefault(o => o.ModuleID == mID); if (mModule != null) { mModule.CreateCount = permissionDetails.Count(o => o.ModuleID == mID && o.CanCreate); mModule.ReadCount = permissionDetails.Count(o => o.ModuleID == mID && o.CanRead); mModule.UpdateCount = permissionDetails.Count(o => o.ModuleID == mID && o.CanUpdate); mModule.DeleteCount = permissionDetails.Count(o => o.ModuleID == mID && o.CanDelete); mModule.PrintCount = permissionDetails.Count(o => o.ModuleID == mID && o.CanPrint); mModule.ApproveCount = permissionDetails.Count(o => o.ModuleID == mID && o.CanApprove); mModule.ResetCount = permissionDetails.Count(o => o.ModuleID == mID && o.CanReset); } } // decorate permission list int index = 1; foreach (DTO.Module module in data.Where(o => o.ParentID == 0).OrderBy(o => o.DisplayOrder)) { module.DisplayOrder = index; module.IsParent = true; index++; foreach (DTO.Module subModule in data.Where(o => o.ParentID == module.ModuleID).OrderBy(o => o.DisplayOrder)) { subModule.DisplayText = "-----" + subModule.DisplayText; subModule.DisplayOrder = index; subModule.IsParent = false; index++; } } return(data.Where(o => o.ReadCount > 0).ToList()); }
public static DTO.Module CreateModule(string actionId, string step1Id, string step2Id, string selectedRespId) { var module = new DTO.Module { Id = ObjectId.GenerateNewId().ToString(), Actions = new List <DTO.Actions> { new DTO.Actions { Id = ObjectId.GenerateNewId().ToString(), ElementState = 2, Next = actionId, Previous = actionId, SpawnElement = new List <DTO.SpawnElement> { new DTO.SpawnElement { ElementId = actionId } }, Steps = new List <DTO.Step> { new DTO.Step { Id = step1Id, ActionId = actionId, SourceId = ObjectId.GenerateNewId().ToString(), Completed = true, Order = 1, Header = "Step 1 header", SelectedResponseId = selectedRespId, ControlType = 2, SelectType = 0, IncludeTime = false, Question = "Step 1 Question", Title = "Step 1 Title", Description = "This is the description for the step 1.", Notes = "These are notes", Text = "This is some text.", Status = 2, Responses = new List <DTO.Response> { new DTO.Response { Id = selectedRespId, Order = 2, Text = "Moderate", StepId = step1Id, Value = "", Nominal = false, Required = false, NextStepId = step2Id, Selected = false, Delete = false, SpawnElement = new List <DTO.SpawnElement> { new DTO.SpawnElement { ElementId = actionId } } } }, StepTypeId = 10, Enabled = true, StateUpdatedOn = null, DateCompleted = DateTime.Now.Subtract(TimeSpan.FromDays(3)), Next = "", SpawnElement = new List <DTO.SpawnElement> { new DTO.SpawnElement { ElementId = actionId } } } } }, new DTO.Actions { Id = actionId, ElementState = 2, Steps = new List <DTO.Step> { new DTO.Step { Id = step1Id, ActionId = actionId, SourceId = ObjectId.GenerateNewId().ToString(), Completed = true, Order = 1, Header = "Step 1 header", SelectedResponseId = selectedRespId, ControlType = 2, SelectType = 0, IncludeTime = false, Question = "Step 1 Question", Title = "Step 1 Title", Description = "This is the description for the step 1.", Notes = "These are notes", Text = "This is some text.", Status = 2, Responses = new List <DTO.Response> { new DTO.Response { Id = selectedRespId, Order = 2, Text = "Moderate", StepId = step1Id, Value = "", Nominal = false, Required = false, NextStepId = step2Id, Selected = false, Delete = false } }, StepTypeId = 10, Enabled = true, StateUpdatedOn = null, DateCompleted = DateTime.Now.Subtract(TimeSpan.FromDays(3)), Next = "" } } } } }; return(module); }