public override int HandleRequest(ref int exitPath, ref XElement Application)
        {
            DateTime dtToday = DateTime.Today;
            if (((String)Application.Element("Birthdate")) == String.Empty) return 3;
            String Birthdate = ((String)Application.Element("Birthdate"));
            DateTime dtBirth=DateTime.Parse(Birthdate);

            int Age = dtToday.Year-dtBirth.Year;
            int formId=Convert.ToInt32(((String)Application.Element("FormId")));
            int relationshipid =Convert.ToInt32(((String)Application.Element("Relationship")));
            AgeInLimits ageinlimits = (from AgeInLimits ail in lstAgeInLimits
                                      where ail.FormId == formId && ail.RelationshipId == relationshipid
                                      select ail).Single();

            //List<AgeInLimits> AIL = new List<AgeInLimits>();
            //foreach (AgeInLimits a in ageinlimits) AIL.Add(a);
            //if((Age>=AIL[0].AgeMin)&& (Age<=AIL[0].AgeMax))
            if(Age>=ageinlimits.AgeMin && Age<=ageinlimits.AgeMax)
            {
                exitPath=1;
            }
            else
            {
                exitPath=2;
                ErrorLogging el = new ErrorLogging();
                el.AppId = (int)Application.Attribute("AppId");
                el.FormId = (int)Application.Element("FormId");
                el.ErrorDescription = "The Age is outside of the allowable range.";
                ErrorLogging.Insert_ErrorLogging(el);
            }
            return exitPath;
        }
 public static void Insert_ErrorLogging(ErrorLogging oError)
 {
     List<SqlParameter> spc = new List<SqlParameter>();
     spc.Add( new SqlParameter("AppId", oError.AppId));
     spc.Add(new SqlParameter("FormId", oError.FormId));
     spc.Add(new SqlParameter("ErrorDescription", oError.ErrorDescription));
     String SQL = "pr_App_ErrorLogging_Insert";
     DataAccess.ExecuteSQL(SQL, ConnectionString, spc);
 }
 public override int HandleRequest(ref int exitPath, ref XElement Application)
 {
     var vState = Application.Element("SignedAtState");
     if (((String)vState) == String.Empty)
     {
         exitPath = 3;
         ErrorLogging el = new ErrorLogging();
         var vAppId = Application.Attribute("AppId").Value;
         el.AppId = Convert.ToInt32(vAppId);
         var vFormId = Application.Element("FormId").Value;
         el.FormId = Convert.ToInt32(vFormId);
         el.ErrorDescription = "The value of SignedAtState was Empty";
         ErrorLogging.Insert_ErrorLogging(el);
         return exitPath;
     }
     Boolean TestIsTrue = false;
     string State = ((string)Application.Element("SignedAtState"));
     String FormId = (String)(Application.Element("FormId"));
     foreach (SignedAtState sas in lstSignedAtState)
     {
         if (sas.State == State && sas.FormId == Convert.ToInt32(FormId))
         {
             TestIsTrue = true;
         }
     }
     if (TestIsTrue)
     {
         exitPath = 1;
         return 1;
     }
     else
     {
         exitPath = 2;
         ErrorLogging el = new ErrorLogging();
         el.AppId = (int)Application.Attribute("AppId");
         el.FormId = (int)Application.Element("FormId");
         el.ErrorDescription = "The value of SignedAtState was not in the SignedAtState list";
         ErrorLogging.Insert_ErrorLogging(el);
         return 2;
     }
 }
        public override int HandleRequest(ref int exitPath, ref XElement Application)
        {
            var vBenefit = Application.Element("Benefit").Value;
            if (((String)vBenefit) == String.Empty)
            {
                exitPath = 3;
                ErrorLogging el = new ErrorLogging();
                var vAppId=Application.Attribute("AppId").Value;
                el.AppId = Convert.ToInt32(vAppId);
                var vFormId = Application.Element("FormId").Value;
                el.FormId = Convert.ToInt32(vFormId);
                el.ErrorDescription = "The empty value of Benefit caused a catatstrophic failure";
                ErrorLogging.Insert_ErrorLogging(el);
                return exitPath;
            }

            String Benefit = ((String)Application.Element("Benefit"));
            float iBenefit = Convert.ToSingle(Benefit);

            int formId=Convert.ToInt32(((String)Application.Element("FormId")));
            int relationshipid =Convert.ToInt32(((String)Application.Element("Relationship")));
            BenefitsInLimits benefitsinlimits = (from BenefitsInLimits bil in lstBenefitsInLimits
                                      where bil.FormId == formId && bil.RelationshipId == relationshipid
                                      select bil).Single();

            if(iBenefit>=benefitsinlimits.BenefitMin && iBenefit<=benefitsinlimits.BenefitMax)
            {
                exitPath=1;
            }
            else if((iBenefit < benefitsinlimits.BenefitMin) || (iBenefit > benefitsinlimits.BenefitMax))
            {
                exitPath=2;
                ErrorLogging el = new ErrorLogging();
                el.AppId = (int)Application.Attribute("AppId");
                el.FormId = (int)Application.Element("FormId");
                el.ErrorDescription = "The value of Benefit was outside the approved range";
                ErrorLogging.Insert_ErrorLogging(el);
            }
            return exitPath;
        }