Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 2
0
 public void SetProgramInformation(Phytel.API.DataDomain.Program.DTO.ProgramAttributeData _programAttributes, DTO.Program p)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 3
0
 public void SaveReportingAttributes(Phytel.API.DataDomain.Program.DTO.ProgramAttributeData _programAttributes, Interface.IAppDomainRequest request)
 {
 }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
 public bool ModifyProgramAttributePropertiesForUpdate(Phytel.API.DataDomain.Program.DTO.ProgramAttributeData pAtt, Phytel.API.DataDomain.Program.DTO.ProgramAttributeData _pAtt)
 {
     throw new NotImplementedException();
 }