コード例 #1
0
        public void SetElementEnabledState(string p, DTO.Program program)
        {
            try
            {
                foreach (Module m in program.Modules)
                {
                    if (m.Id.Equals(p))
                    {
                        SetInitialProperties(program.AssignToId, m, false);
                        var list = m.Actions.Where(a => a.Enabled == true &&
                                                   a.ElementState != (int)ElementState.Completed &&
                                                   a.ElementState != (int)ElementState.InProgress);         // create rule specification

                        list.ForEach(a => { if (a.Enabled)
                                            {
                                                SetInitialProperties(program.AssignToId, a, false);
                                            }
                                     });
                        OnProcessIdEvent(m);
                    }
                    else
                    {
                        FindSpawnIdInActions(program, p, m);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("AD:PlanElementUtil:SetElementEnabledState()::" + ex.Message, ex.InnerException);
            }
        }
コード例 #2
0
 public bool IsActionInitial(DTO.Program p)
 {
     try
     {
         bool result = true;
         if (p.Modules != null)
         {
             foreach (Module m in p.Modules)
             {
                 foreach (Actions a in m.Actions)
                 {
                     if (a.ElementState == (int)ElementState.InProgress ||
                         a.ElementState == (int)ElementState.Completed)
                     {
                         result = false;
                     }
                 }
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception("AD:PlanElementUtil:IsActionInitial()::" + ex.Message, ex.InnerException);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 public void SpawnElementsInList(List <DTO.SpawnElement> list, DTO.Program program, string userId, Phytel.API.DataDomain.Program.DTO.ProgramAttributeData progAttr)
 {
     try
     {
         list.ForEach(r =>
         {
             if (r.ElementType < 10)
             {
                 SetElementEnabledState(r.ElementId, program);
             }
             else
             {
                 SetProgramAttributes(r, program, userId, progAttr);
             }
         });
     }
     catch (Exception ex)
     {
         throw new Exception("AD:PlanElementUtil:SpawnElementsInList()::" + ex.Message, ex.InnerException);
     }
 }
コード例 #5
0
 public void FindSpawnIdInSteps(DTO.Program program, string p, DTO.Actions a)
 {
     try
     {
         if (a.Steps != null)
         {
             foreach (Step s in a.Steps)
             {
                 if (s.Id.Equals(p))
                 {
                     SetInitialProperties(program.AssignToId, s, false);
                     OnProcessIdEvent(s);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("AD:PlanElementUtil:FindIdInSteps()::" + ex.Message, ex.InnerException);
     }
 }
コード例 #6
0
 public bool UpdatePlanElementAttributes(DTO.Program pg, PlanElement planElement, string userId, PlanElements planElems)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
 public PlanElement InitializePlanElementSettings(PlanElement pe, PlanElement p, DTO.Program program)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 public void SetProgramInformation(Phytel.API.DataDomain.Program.DTO.ProgramAttributeData _programAttributes, DTO.Program p)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
        public void SetProgramAttributes(DTO.SpawnElement r, DTO.Program program, string userId, Phytel.API.DataDomain.Program.DTO.ProgramAttributeData progAttr)
        {
            try
            {
                if (r.ElementType == 10)
                {
                    try
                    {
                        if (r.Tag == null)
                        {
                            throw new ArgumentException("Cannot set attribute of type " + r.ElementType +
                                                        ". Tag value is null.");
                        }

                        progAttr.Eligibility = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToInt32(r.Tag) : 0;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::Eligibility" + ex.Message, ex.InnerException);
                    }

                    int state; // no = 1, yes = 2
                    var isNum = int.TryParse(r.Tag, out state);
                    if (!isNum)
                    {
                        return;
                    }

                    // program is closed due to ineligibility
                    switch (state)
                    {
                    case 1:
                        program.ElementState   = (int)DataDomain.Program.DTO.ElementState.Completed;   //5;
                        program.StateUpdatedOn = System.DateTime.UtcNow;
                        progAttr.Eligibility   = 1;
                        program.AttrEndDate    = System.DateTime.UtcNow;
                        break;

                    case 2:
                        program.ElementState   = (int)DataDomain.Program.DTO.ElementState.InProgress;   //4;
                        program.StateUpdatedOn = System.DateTime.UtcNow;
                        progAttr.Eligibility   = 2;
                        break;
                    }
                }
                else if (r.ElementType == 11)
                {
                    // eligibility reason
                    try
                    {
                        if (r.Tag == null)
                        {
                            throw new ArgumentException("Cannot set attribute of type " + r.ElementType +
                                                        ". Tag value is null.");
                        }

                        progAttr.IneligibleReason = (!string.IsNullOrEmpty(r.Tag)) ? r.Tag : null;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::IneligibleReason" + ex.Message,
                                            ex.InnerException);
                    }
                }
                else if (r.ElementType == 12)
                {
                    try
                    {
                        if (r.Tag == null)
                        {
                            throw new ArgumentException("Cannot set attribute of type " + r.ElementType +
                                                        ". Tag value is null.");
                        }

                        program.ElementState   = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToInt32(r.Tag) : 0;
                        program.StateUpdatedOn = System.DateTime.UtcNow;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::ElementState" + ex.Message, ex.InnerException);
                    }
                }
                else if (r.ElementType == 13)
                {
                    try
                    {
                        // need to revisit in the future.
                        //if (r.Tag == null)
                        //    throw new ArgumentException("Cannot set attribute of type " + r.ElementType + ". Tag value is null.");

                        if (string.IsNullOrEmpty(r.Tag))
                        {
                            //progAttr.AttrStartDate = System.DateTime.UtcNow;
                            program.AttrStartDate = System.DateTime.UtcNow;
                        }
                        else
                        {
                            DateTime date;
                            if (DateTime.TryParse(r.Tag.ToString(), out date))
                            {
                                //progAttr.AttrStartDate = date;
                                program.AttrStartDate = date;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::StartDate" + ex.Message, ex.InnerException);
                    }
                }
                else if (r.ElementType == 14)
                {
                    //progAttr.AttrEndDate = System.DateTime.UtcNow;
                    program.AttrEndDate = System.DateTime.UtcNow;
                }
                else if (r.ElementType == 15)
                {
                    try
                    {
                        if (r.Tag == null)
                        {
                            throw new ArgumentException("Cannot set attribute of type " + r.ElementType +
                                                        ". Tag value is null.");
                        }

                        progAttr.Enrollment = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToInt32(r.Tag) : 0;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::Enrollment" + ex.Message, ex.InnerException);
                    }
                }
                else if (r.ElementType == 16)
                {
                    try
                    {
                        if (r.Tag == null)
                        {
                            throw new ArgumentException("Cannot set attribute of type " + r.ElementType +
                                                        ". Tag value is null.");
                        }

                        progAttr.OptOut = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToBoolean(r.Tag) : false;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::OptOut" + ex.Message, ex.InnerException);
                    }
                }
                else if (r.ElementType == 19)
                {
                    try
                    {
                        if (r.Tag == null)
                        {
                            throw new ArgumentException("Cannot set attribute of type " + r.ElementType +
                                                        ". Tag value is null.");
                        }

                        if (progAttr == null)
                        {
                            throw new ArgumentException(" ProgramAttributes is null.");
                        }

                        progAttr.GraduatedFlag = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToInt32(r.Tag) : 0;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::GraduatedFlag:" + ex.Message, ex.InnerException);
                    }
                }
                else if (r.ElementType == 20)
                {
                    try
                    {
                        if (r.Tag == null)
                        {
                            throw new ArgumentException("Cannot set attribute of type " + r.ElementType +
                                                        ". Tag value is null.");
                        }

                        progAttr.Locked = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToInt32(r.Tag) : 0;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("AD:SetProgramAttributes()::Locked" + ex.Message, ex.InnerException);
                    }
                }
                //else if (r.ElementType == 21)
                //{
                //    try
                //    {
                //        if (r.Tag == null)
                //            throw new ArgumentException("Cannot set attribute of type " + r.ElementType + ". Tag value is null.");

                //        progAttr.EligibilityOverride = (!string.IsNullOrEmpty(r.Tag)) ? Convert.ToInt32(r.Tag) : 0;
                //    }
                //    catch (Exception ex)
                //    {
                //        throw new Exception("AD:SetProgramAttributes()::EligibilityOverride" + ex.Message, ex.InnerException);
                //    }
                //}
            }
            catch (Exception ex)
            {
                throw new Exception("AD:PlanElementUtil:SetProgramAttributes()::" + ex.Message, ex.InnerException);
            }
        }
コード例 #10
0
 public bool IsProgramCompleted(DTO.Program p, string userId)
 {
     return(true);
 }
コード例 #11
0
 public DTO.PlanElement ActivatePlanElement(string p, DTO.Program program)
 {
     throw new NotImplementedException();
 }