Beispiel #1
0
 /// <summary>
 /// Converts Step collection into StepsDetail collection.
 /// </summary>
 /// <param name="list">Step list</param>
 /// <returns>StepsDetail list</returns>
 public static List <StepsDetail> GetADSteps(List <Step> list)
 {
     try
     {
         List <StepsDetail> sd = new List <StepsDetail>();
         if (list != null)
         {
             list.ForEach(s =>
             {
                 StepsDetail sdi = new StepsDetail
                 {
                     ActionId       = s.ActionId,
                     AssignBy       = s.AssignById,
                     AssignDate     = s.AssignDate,
                     Completed      = s.Completed,
                     CompletedBy    = s.CompletedBy,
                     ControlType    = s.ControlType,
                     DateCompleted  = s.DateCompleted,
                     Description    = s.Description,
                     ElementState   = s.ElementState,
                     StateUpdatedOn = s.StateUpdatedOn,
                     Enabled        = s.Enabled,
                     Header         = s.Header,
                     Id             = s.Id,
                     IncludeTime    = s.IncludeTime,
                     Next           = s.Next,
                     Notes          = s.Notes,
                     Order          = s.Order,
                     Previous       = s.Previous,
                     Question       = s.Question,
                     //Responses = GetADResponses(s.Responses),
                     SelectedResponseId = s.SelectedResponseId,
                     SelectType         = s.SelectType,
                     SourceId           = s.SourceId,
                     SpawnElement       = GetADSpawnElements(s.SpawnElement),
                     Status             = s.Status,
                     StepTypeId         = s.StepTypeId,
                     Text  = s.Text,
                     Title = s.Title
                 };
                 sd.Add(sdi);
             });
         }
         return(sd);
     }
     catch (Exception ex)
     {
         throw new Exception("AD:GetADSteps()::" + ex.Message, ex.InnerException);
     }
 }
        private static ProgramDetail GenTestProgram()
        {
            StepsDetail s = new StepsDetail()
            {
                Id          = "52a641e8d433231824878c8f",
                ActionId    = "52a0f33bd43323141c9eb274",
                ControlType = 1,
                Description = "description",
                Enabled     = true,
                Question    = "Are you an ABC Employee?",
                Notes       = "Example notes",
                Completed   = true,
                Order       = 1,
                Status      = 1,
                Responses   = new List <ResponseDetail> {
                    new ResponseDetail {
                        Id = "52a641f1d433231824878c90", Nominal = true, Order = 1, NextStepId = "52a641f1d433231824878c90", StepId = "52a641e8d433231824878c8f"
                    },
                    new ResponseDetail {
                        Id = "52a641f1d433231824878c90", Nominal = true, Order = 2, NextStepId = "52a641f1d433231824878c90", StepId = "52a641e8d433231824878c8f"
                    }
                }
            };

            StepsDetail s1 = new StepsDetail()
            {
                Id          = "52a641f1d433231824878c90",
                ActionId    = "52a0f33bd43323141c9eb274",
                ControlType = 1,
                Description = "description",
                Enabled     = true,
                Question    = "Are you a spouse of an ABC Employee?",
                Notes       = "Example notes",
                Completed   = true,
                Order       = 2,
                Status      = 1,
                Responses   = new List <ResponseDetail> {
                    new ResponseDetail {
                        Id = "52a641f1d433231824878c90", Nominal = true, Order = 1, NextStepId = "52a641f1d433231824878c90", StepId = "52a641f1d433231824878c90"
                    },
                    new ResponseDetail {
                        Id = "52a641f1d433231824878c90", Nominal = true, Order = 2, NextStepId = "52a641f1d433231824878c90", StepId = "52a641f1d433231824878c90"
                    }
                }
            };

            StepsDetail s2 = new StepsDetail()
            {
                Id          = "52a641f1d433231824871234",
                ActionId    = "52a0f33bd43323141c9eb274",
                ControlType = 1,
                Description = "description",
                Enabled     = true,
                Question    = "Are you a spouse of an ABC Employee?",
                Notes       = "Example notes",
                Completed   = true,
                Order       = 2,
                Status      = 1,
                StepTypeId  = 7
            };

            List <SpawnElementDetail> se = new List <SpawnElementDetail>();

            se.Add(new SpawnElementDetail {
                ElementId = "aaaaf33bd43323141c9eb274", ElementType = 3
            });
            se.Add(new SpawnElementDetail {
                ElementId = "52a0a775fe7a5915485b8866", ElementType = 2
            });
            se.Add(new SpawnElementDetail {
                ElementId = "52a0a775fe7a5915485b1212", ElementType = 2
            });

            ActionsDetail act = new ActionsDetail
            {
                Enabled      = true,
                Id           = "52a0f33bd43323141c9eb274",
                ModuleId     = "52a0a775fe7a5915485bdfd1",
                Name         = "act Verify P4H Eligibility",
                Description  = "act - Assess whether individual is eligible for the program",
                CompletedBy  = "Care Manager",
                Completed    = false,
                Order        = 1,
                Text         = "testtest",
                Status       = 1,
                SpawnElement = se,
                Steps        = new List <StepsDetail> {
                    s, s1, s2
                }
            };

            ActionsDetail act1 = new ActionsDetail
            {
                Enabled     = true,
                Id          = "5555f33bd43323141c9eb275",
                ModuleId    = "52a0a775fe7a5915485bdfd1",
                Name        = "act1 Verify P4H Eligibility",
                Description = "act1 Assess whether individual is eligible for the program",
                CompletedBy = "Care Manager",
                Completed   = false,
                Order       = 2,
                Text        = "testtest",
                Status      = 1,
                Previous    = "52a0f33bd43323141c9eb274",
                Steps       = new List <StepsDetail> {
                    s, s1
                }
            };

            ActionsDetail act2 = new ActionsDetail
            {
                Enabled     = false,
                Id          = "aaaaf33bd43323141c9eb274",
                ModuleId    = "52a0a775fe7a5915485bdfd1",
                Name        = "act2 Verify P4H Eligibility",
                Description = "dependent on act1",
                CompletedBy = "Care Manager",
                Completed   = false,
                Order       = 3,
                Text        = "testtest",
                Status      = 1,
                Previous    = "5555f33bd43323141c9eb275",
                Steps       = new List <StepsDetail> {
                    s, s1
                }
            };

            List <SpawnElementDetail> sem = new List <SpawnElementDetail>();

            sem.Add(new SpawnElementDetail {
                ElementId = "9990a775fe7a5915485b1212", ElementType = 2
            });

            ModuleDetail mod = new ModuleDetail
            {
                Id          = "52a0a775fe7a5915485bdfd1",
                Enabled     = true,
                ProgramId   = "52c71fd7d6a4850a1cf69494",
                Description = "Reduce the amount of crabs in the diet",
                Name        = "Low Carb Diet Module",
                Completed   = false,
                Order       = 1,
                Text        = "testtest",
                Status      = 1,
                Actions     = new List <ActionsDetail> {
                    act, act1, act2
                },
                SpawnElement = sem
            };

            ModuleDetail mod1 = new ModuleDetail
            {
                Id          = "52a0a775fe7a5915485b8866",
                Enabled     = false,
                ProgramId   = "52c71fd7d6a4850a1cf69494",
                Text        = "Reduce the amount of crabs in the diet",
                Description = "Reduce the amount of crabs in the diet",
                Name        = "Low Carb Diet Module",
                Completed   = false,
                Order       = 1,
                Status      = 1
            };

            ModuleDetail mod2 = new ModuleDetail
            {
                Id          = "52a0a775fe7a5915485b1212",
                Enabled     = false,
                ProgramId   = "52c71fd7d6a4850a1cf69494",
                Text        = "Reduce the amount of crabs in the diet",
                Description = "Reduce the amount of crabs in the diet",
                Name        = "Low Carb Diet Module",
                Completed   = false,
                Order       = 1,
                Status      = 1
            };

            ModuleDetail mod3 = new ModuleDetail
            {
                Id          = "9990a775fe7a5915485b1212",
                Enabled     = false,
                ProgramId   = "52c71fd7d6a4850a1cf69494",
                Text        = "Testgen module number 3",
                Description = "module number 3",
                Name        = "Low Carb Diet Module",
                Completed   = false,
                Order       = 1,
                Status      = 1
            };

            ProgramDetail pMap = new ProgramDetail()
            {
                Enabled   = true,
                Id        = "52c71fd7d6a4850a1cf69494",
                PatientId = "1234",
                Text      = "THIS IS THE PROGRAM",
                Modules   = new List <ModuleDetail> {
                    mod, mod1, mod2, mod3
                },
                Completed = false,
                Order     = 1,
                Status    = 1
            };

            return(pMap);
        }