protected void UserIDCode_Or_BillingCode_TextChanged(object sender, EventArgs e) { var provider = Master.DataProvider; var user = new BRBUser { UserCode = UserIDCode.Text, BillingCode = BillingCode.Text }; if (provider.GetUserProfile(ref user)) { Master.UpdateSession(user); EnableInputFields(); if (string.IsNullOrEmpty(Master.User.Question1) || string.IsNullOrEmpty(Master.User.Question2)) { Master.ShowErrorModal("Your profile does not have security questions assigned. Please contact the system administrator.", "Profile Error", 250); return; } Quest1.Text = Master.User.Question1; Quest2.Text = Master.User.Question2; Answer1.Focus(); } else { EnableInputFields(); Master.ShowErrorModal("Error: Invalid User ID or Billing Code.", "Reset Password"); } }
public SignInStatus Authenticate(ref BRBUser user, string password) { var signInStatus = SignInStatus.Failure; var soapRequest = new SoapRequest { Source = "UserAuth", StaticDataFile = "AuthenticateUser_Response.xml", Url = "AuthenticateUser/RTSClientPortalAPI_API_WSD_AuthenticateUser_Port", Action = "RTSClientPortalAPI_API_WSD_AuthenticateUser_Binder_authenticateUserLogin" }; try { soapRequest.Body.Append("<api:authenticateUserLogin>"); soapRequest.Body.Append("<authenticateUserReq>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.AppendFormat("<pwd>{0}</pwd>", SafeString(password)); soapRequest.Body.Append("</authenticateUserReq>"); soapRequest.Body.Append("</api:authenticateUserLogin>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("authenticateUserRes")) { if (detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS")) { signInStatus = SignInStatus.Success; if (detail.SelectSingleNode("relationship") != null) { user.Relationship = detail.SelectSingleNode("relationship").InnerText; } user.IsFirstlogin = detail.SelectSingleNode("isFirstLogin").InnerText.ToUpper() == "TRUE"; user.IsTemporaryPassword = detail.SelectSingleNode("isTemporaryPwd").InnerText.ToUpper() == "TRUE"; } else { ErrorMessage = detail.SelectSingleNode("errorMsg").InnerText; } } } catch (Exception ex) { SetErrorMessage("Authenticate", ex); } return(signInStatus); }
public bool ConfirmUserProfile(BRBUser user) { var isConfirmed = false; var soapRequest = new SoapRequest { Source = "ConfirmProfile", Url = "ConfirmUserProfileByDeclaration/RTSClientPortalAPI_API_WSD_ConfirmUserProfileByDeclaration_Port", Action = "RTSClientPortalAPI_API_WSD_ConfirmUserProfileByDeclaration_Binder_confirmProfileInformation" }; try { soapRequest.Body.Append("<api:confirmProfileInformation>"); soapRequest.Body.Append("<profileConfirmationReq>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.AppendFormat("<securityQuestion1>{0}</securityQuestion1>", user.Question1.EscapeXMLChars()); soapRequest.Body.AppendFormat("<securityAnswer1>{0}</securityAnswer1>", user.Answer1.EscapeXMLChars()); soapRequest.Body.AppendFormat("<securityQuestion2>{0}</securityQuestion2>", user.Question2.EscapeXMLChars()); soapRequest.Body.AppendFormat("<securityAnswer2>{0}</securityAnswer2>", user.Answer2.EscapeXMLChars()); soapRequest.Body.AppendFormat("<declarationInitial>{0}</declarationInitial>", SafeString(user.DeclarationInitials)); soapRequest.Body.Append("</profileConfirmationReq>"); soapRequest.Body.Append("</api:confirmProfileInformation>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { isConfirmed = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!isConfirmed) { ErrorMessage = detail.ChildNodes[1].InnerText; } } } catch (Exception ex) { SetErrorMessage("ConfirmUserProfile", ex); } return(isConfirmed); }
public bool UpdateSecurityQuestions(ref BRBUser user) { var wasUpdated = false; var soapRequest = new SoapRequest { Source = "UpdateSecurityQuestions", Url = "UpdateUserProfileSecurityQA/RTSClientPortalAPI_API_WSD_UpdateUserProfileSecurityQA_Port", Action = "RTSClientPortalAPI_API_WSD_UpdateUserProfileSecurityQA_Binder_updateUserProfileSecurityQA" }; try { soapRequest.Body.Append("<api:updateUserProfileSecurityQA>"); soapRequest.Body.Append("<UpdateSecurityQAReq>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.AppendFormat("<securityQuestion1>{0}</securityQuestion1>", user.Question1.EscapeXMLChars()); soapRequest.Body.AppendFormat("<securityAnswer1>{0}</securityAnswer1>", user.Answer1.EscapeXMLChars()); soapRequest.Body.AppendFormat("<securityQuestion2>{0}</securityQuestion2>", user.Question2.EscapeXMLChars()); soapRequest.Body.AppendFormat("<securityAnswer2>{0}</securityAnswer2>", user.Answer2.EscapeXMLChars()); soapRequest.Body.Append("</UpdateSecurityQAReq>"); soapRequest.Body.Append("</api:updateUserProfileSecurityQA>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { wasUpdated = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!wasUpdated) { ErrorMessage = detail.ChildNodes[1].InnerText; } } } catch (Exception ex) { SetErrorMessage("ConfirmUserProfile", ex); } return(wasUpdated); }
public bool ResetUserPassword(ref BRBUser user) { var canReset = false; var soapRequest = new SoapRequest { Source = "ValidateReset", Url = "ValidateResetPasswordRequest/RTSClientPortalAPI_API_WSD_ValidateResetPasswordRequest_Port", Action = "RTSClientPortalAPI_API_WSD_ValidateResetPasswordRequest_Binder_validateResetUserPassword" }; try { soapRequest.Body.Append("<api:validateResetUserPassword>"); soapRequest.Body.Append("<resetUserPwdReq>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.AppendFormat("<securityQuestion1>{0}</securityQuestion1>", SafeString(user.Question1)); soapRequest.Body.AppendFormat("<securityAnswer1>{0}</securityAnswer1>", SafeString(user.Answer1)); soapRequest.Body.AppendFormat("<securityQuestion2>{0}</securityQuestion2>", SafeString(user.Question2)); soapRequest.Body.AppendFormat("<securityAnswer2>{0}</securityAnswer2>", SafeString(user.Answer2)); soapRequest.Body.Append("</resetUserPwdReq>"); soapRequest.Body.Append("</api:validateResetUserPassword>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { canReset = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!canReset) { ErrorMessage = detail.ChildNodes[1].InnerText; } } } catch (Exception ex) { SetErrorMessage("ResetUserPassword", ex); } return(canReset); }
public bool UpdateUserPassword(BRBUser user, string currentPassword, string newPassword, string reTypePwd) { var wasUpdated = false; var soapRequest = new SoapRequest { Source = "UpdatePassword", Url = "UpdatePassword/RTSClientPortalAPI_API_WSD_UpdatePassword_Port", Action = "RTSClientPortalAPI_API_WSD_UpdatePassword_Binder_updateUserPassword" }; try { soapRequest.Body.Append("<api:updateUserPassword>"); soapRequest.Body.Append("<updateUserPwdReq>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.AppendFormat("<currentPwd>{0}</currentPwd>", SafeString(currentPassword)); soapRequest.Body.AppendFormat("<newPwd>{0}</newPwd>", SafeString(newPassword)); soapRequest.Body.AppendFormat("<retypeNewPwd>{0}</retypeNewPwd>", SafeString(reTypePwd)); soapRequest.Body.Append("</updateUserPwdReq>"); soapRequest.Body.Append("</api:updateUserPassword>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { wasUpdated = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!wasUpdated) { ErrorMessage = detail.ChildNodes[1].InnerText; } } } catch (Exception ex) { SetErrorMessage("UpdateUserPassword", ex); } return(wasUpdated); }
public bool UpdateUserProfile(ref BRBUser user) { var wasUpdated = false; var soapRequest = new SoapRequest { Source = "UpdateProfile", Url = "UpdateUserProfile/RTSClientPortalAPI_API_WSD_UpdateUserProfile_Port", Action = "RTSClientPortalAPI_API_WSD_UpdateUserProfile_Binder_updateUserProfile" }; try { soapRequest.Body.Append("<api:updateUserProfile>"); soapRequest.Body.Append("<updateUserProfileReq>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.Append("<name>"); soapRequest.Body.AppendFormat("<first>{0}</first>", SafeString(user.FirstName)); soapRequest.Body.AppendFormat("<!--Optional:--><middle>{0}</middle>", SafeString(user.MiddleName)); soapRequest.Body.AppendFormat("<last>{0}</last>", SafeString(user.LastName)); soapRequest.Body.AppendFormat("<suffix>{0}</suffix>", SafeString(user.Suffix)); soapRequest.Body.Append("<!--Optional:--><nameLastFirstDisplay></nameLastFirstDisplay>"); soapRequest.Body.Append("</name>"); soapRequest.Body.Append("<mailingAddress>"); soapRequest.Body.AppendFormat("<!--Optional:--><streetNumber>{0}</streetNumber>", SafeString(user.StreetNumber)); soapRequest.Body.AppendFormat("<!--Optional:--><streetName>{0}</streetName>", SafeString(user.StreetName)); soapRequest.Body.AppendFormat("<!--Optional:--><unitNumber>{0}</unitNumber>", SafeString(user.UnitNumber)); soapRequest.Body.AppendFormat("<!--Optional:--><fullAddress>{0}</fullAddress>", SafeString(user.FullAddress)); soapRequest.Body.AppendFormat("<!--Optional:--><city>{0}</city>", SafeString(user.City)); soapRequest.Body.AppendFormat("<!--Optional:--><state>{0}</state>", SafeString(user.StateCode)); soapRequest.Body.AppendFormat("<!--Optional:--><zip>{0}</zip>", SafeString(user.ZipCode)); soapRequest.Body.AppendFormat("<!--Optional:--><country>{0}</country>", SafeString(user.Country)); soapRequest.Body.Append("</mailingAddress>"); soapRequest.Body.AppendFormat("<emailAddress>{0}</emailAddress>", SafeString(user.Email)); soapRequest.Body.AppendFormat("<phone>{0}</phone>", user.PhoneNumber); soapRequest.Body.AppendFormat("<securityQuestion1>{0}</securityQuestion1>", SafeString(user.Question1)); soapRequest.Body.AppendFormat("<securityAnswer1>{0}</securityAnswer1>", SafeString(user.Answer1)); soapRequest.Body.AppendFormat("<securityQuestion2>{0}</securityQuestion2>", SafeString(user.Question2)); soapRequest.Body.AppendFormat("<securityAnswer2>{0}</securityAnswer2>", SafeString(user.Answer2)); soapRequest.Body.Append("</updateUserProfileReq>"); soapRequest.Body.Append("<!--Optional:--><isActive>Y</isActive>"); soapRequest.Body.Append("</api:updateUserProfile>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { wasUpdated = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!wasUpdated) { ErrorMessage = detail.ChildNodes[2].InnerText; } } } catch (Exception ex) { Status = "FAILURE"; SetErrorMessage("UpdateUserProfile", ex); } return(wasUpdated); }
public bool UpdateUnit(ref BRBUser user) { var wasSaved = false; var soapRequest = new SoapRequest { Source = "SaveUnit", Url = "UpdateUnitStatusChange/RTSClientPortalAPI_API_WSD_UpdateUnitStatusChange_Port", Action = "RTSClientPortalAPI_API_WSD_UpdateUnitStatusChange_Binder_updateUnitStatusChange" }; try { var unit = user.CurrentUnit; soapRequest.Body.Append("<api:updateUnitStatusChange>"); soapRequest.Body.Append("<unitStatusChangeReq>"); soapRequest.Body.AppendFormat("<userId>{0}</userId>", user.UserCode); soapRequest.Body.AppendFormat("<propertyId>{0}</propertyId>", user.CurrentProperty.PropertyID); soapRequest.Body.AppendFormat("<unitId>{0}</unitId>", user.CurrentUnit.UnitID); soapRequest.Body.AppendFormat("<clientPortalUnitStatusCode>{0}</clientPortalUnitStatusCode>", unit.ClientPortalUnitStatusCode); soapRequest.Body.AppendFormat("<unitStatus>{0}</unitStatus>", unit.ClientPortalUnitStatusCode); soapRequest.Body.AppendFormat("<!--Optional:--><exemptionReason>{0}</exemptionReason>", unit.ExemptionReason); soapRequest.Body.AppendFormat("<declarationInitial>{0}</declarationInitial>", unit.DeclarationInitials); soapRequest.Body.Append("<questions>"); if (unit.StartDate.HasValue) { soapRequest.Body.AppendFormat("<!--Optional:--><dateStarted>{0}</dateStarted>", unit.StartDate.Value.AsShortDateFormat()); } else { soapRequest.Body.Append("<!--Optional:--><dateStarted></dateStarted>"); } if (unit.AsOfDate.HasValue) { soapRequest.Body.AppendFormat("<!--Optional:--><asOfDate>{0}</asOfDate>", unit.AsOfDate.Value.AsShortDateFormat()); } else { soapRequest.Body.AppendFormat("<!--Optional:--><asOfDate>{0}</asOfDate>", DateTime.Now.AsShortDateFormat()); } soapRequest.Body.AppendFormat("<!--Optional:--><occupiedBy>{0}</occupiedBy>", unit.OccupiedBy); soapRequest.Body.AppendFormat("<!--Optional:--><contractNo>{0}</contractNo>", unit.ContractNo); soapRequest.Body.AppendFormat("<!--Optional:--><commeUseDesc>{0}</commeUseDesc>", unit.CommUseDesc); soapRequest.Body.AppendFormat("<!--Optional:--><isCommeUseZoned>{0}</isCommeUseZoned>", unit.CommZoneUse); soapRequest.Body.AppendFormat("<!--Optional:--><isExclusivelyForCommeUse>{0}</isExclusivelyForCommeUse>", unit.CommResYN); // Next 3 removed when Owner Occupied Exempt Duplex was removed from the Other dropdown soapRequest.Body.Append("<!--Optional:--><_x0035_0PercentAsOf31Dec1979></_x0035_0PercentAsOf31Dec1979>"); soapRequest.Body.Append("<!--Optional:--><ownerOccupantName></ownerOccupantName>"); // OK: vb.net is same soapRequest.Body.Append("<!--Zero or more repetitions:--><namesOfownersOfRecord></namesOfownersOfRecord>"); soapRequest.Body.AppendFormat("<!--Optional:--><nameOfPropertyManagerResiding>{0}</nameOfPropertyManagerResiding>", unit.PropMgrName); soapRequest.Body.AppendFormat("<!--Optional:--><emailOfPhoneOfPropertyManagerResiding>{0}</emailOfPhoneOfPropertyManagerResiding>", unit.PMEmailPhone); soapRequest.Body.AppendFormat("<!--Optional:--><IsOwnersPrinciplePlaceOfResidence>{0}</IsOwnersPrinciplePlaceOfResidence>", unit.PrincResYN); soapRequest.Body.AppendFormat("<!--Optional:--><doesOwnerResideInOtherUnitOfThisUnitProperty>{0}</doesOwnerResideInOtherUnitOfThisUnitProperty>", unit.MultiUnitYN); soapRequest.Body.Append("<!--Zero or more repetitions:--><tenantsAndContactInfo>"); // OK: vb.net is same soapRequest.Body.AppendFormat("<name>{0}</name>", unit.TenantNames); soapRequest.Body.AppendFormat("<contactInfo>{0}</contactInfo>", unit.TenantContacts); soapRequest.Body.Append("</tenantsAndContactInfo>"); soapRequest.Body.Append("</questions>"); soapRequest.Body.Append("</unitStatusChangeReq>"); soapRequest.Body.Append("</api:updateUnitStatusChange>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { wasSaved = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!wasSaved) { ErrorMessage = detail.ChildNodes[1].InnerText; } } } catch (Exception ex) { SetErrorMessage("UpdateUnit", ex); } return(wasSaved); }
public void UpdateSession(BRBUser user) { this.User = user; }
public bool GetPropertyUnits(ref BRBUser user, string unitID = "") { var gotPropertyUnits = false; var soapRequest = new SoapRequest { Source = "GetPropertyUnits", StaticDataFile = "GetPropertyAndUnitDetails_Response.xml", Url = "GetPropertyAndUnitDetails/RTSClientPortalAPI_API_WSD_GetPropertyAndUnitDetails_Port", Action = "RTSClientPortalAPI_API_WSD_GetPropertyAndUnitDetails_Binder_getPropertyAndUnitDetails" }; try { soapRequest.Body.Append("<api:getPropertyAndUnitDetails>"); soapRequest.Body.AppendFormat("<propertyId>{0}</propertyId>", SafeString(user.CurrentProperty.PropertyID)); soapRequest.Body.Append("<request>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.Append("</request>"); soapRequest.Body.Append("</api:getPropertyAndUnitDetails>"); var xmlDoc = GetXmlResponse(soapRequest); user.CurrentProperty.Units = new List <BRBUnit>(); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("propertyAndUnitsRes")) { user.CurrentProperty.OwnerContactName = detail.SelectSingleNode("ownerContactName").SelectSingleNode("nameLastFirstDisplay").InnerText; user.CurrentProperty.BillingAddress = detail.SelectSingleNode("billingDetails").SelectSingleNode("billingAddress").SelectSingleNode("mainStreetAddress").InnerText; if (detail.SelectSingleNode("agentDetails") != null) { if (detail.SelectSingleNode("agentDetails").SelectSingleNode("agentContactName") != null) { user.AgencyName = detail.SelectSingleNode("agentDetails").SelectSingleNode("agentContactName").SelectSingleNode("nameLastFirstDisplay").InnerText.UnescapeXMLChars(); } if (user.AgencyName.Length < 1) { if (detail.SelectSingleNode("agentDetails").SelectSingleNode("agencyName") != null) { user.AgencyName = detail.SelectSingleNode("agentDetails").SelectSingleNode("agencyName").InnerText.UnescapeXMLChars(); } } } // Needed so we can get update amounts after any Unit/Tenancy updates foreach (XmlElement balanceAmounts in detail.GetElementsByTagName("balanceAmounts")) { decimal currentFees = 0; decimal priorFees = 0; decimal currentPenalty = 0; decimal priorPenalty = 0; decimal credit = 0; decimal totalBalance = 0; Decimal.TryParse(balanceAmounts.SelectSingleNode("currentFees").InnerText, out currentFees); Decimal.TryParse(balanceAmounts.SelectSingleNode("priorFees").InnerText, out priorFees); Decimal.TryParse(balanceAmounts.SelectSingleNode("currentPenalty").InnerText, out currentPenalty); Decimal.TryParse(balanceAmounts.SelectSingleNode("priorPenalties").InnerText, out priorPenalty); Decimal.TryParse(balanceAmounts.SelectSingleNode("credit").InnerText, out credit); Decimal.TryParse(balanceAmounts.SelectSingleNode("totalBalance").InnerText, out totalBalance); #if DEBUG if (totalBalance == 0) { totalBalance = 10.0M; if (currentFees == 0) { currentFees = 10.0M; } } #endif user.CurrentProperty.CurrentFee = currentFees; user.CurrentProperty.PriorFee = priorFees; user.CurrentProperty.CurrentPenalty = currentPenalty; user.CurrentProperty.PriorPenalty = priorPenalty; user.CurrentProperty.Credits = credit; user.CurrentProperty.Balance = totalBalance; } foreach (XmlElement detailUnits in detail.GetElementsByTagName("units")) { DateTime unitStatusAsOfDate = DateTime.MinValue; DateTime tenancyStartDate = DateTime.MinValue; Decimal rentCeiling = 0; var exemptionReason = ""; var cpUnitStatDisp = ""; var hServices = ""; var occupiedBy = ""; var unit = new BRBUnit(); if (detailUnits.SelectSingleNode("unitStatusAsOfDate") != null) { if (!string.IsNullOrEmpty(detailUnits.SelectSingleNode("unitStatusAsOfDate").InnerText)) { DateTime.TryParse(detailUnits.SelectSingleNode("unitStatusAsOfDate").InnerText, out unitStatusAsOfDate); } } if (detailUnits.SelectSingleNode("tenancyStartDate") != null) { if (!string.IsNullOrEmpty(detailUnits.SelectSingleNode("tenancyStartDate").InnerText)) { DateTime.TryParse(detailUnits.SelectSingleNode("tenancyStartDate").InnerText, out tenancyStartDate); } } if ((detailUnits.SelectSingleNode("rentCeiling").InnerText.Length > 0)) { Decimal.TryParse(detailUnits.SelectSingleNode("rentCeiling").InnerText, out rentCeiling); } foreach (XmlElement detailService in detailUnits.GetElementsByTagName("housingServices")) { if (hServices.Length > 0) { hServices += (", " + detailService.SelectSingleNode("serviceName").InnerText); } else { hServices = detailService.SelectSingleNode("serviceName").InnerText; } } switch (unit.UnitStatCode.ToUpper()) { case "OOCC": cpUnitStatDisp = "Owner-Occupied"; break; case "SEC8": cpUnitStatDisp = "Section 8"; break; case "RENTED": cpUnitStatDisp = "Rented or Available for Rent"; break; case "FREE": cpUnitStatDisp = "Rent-Free"; break; case "NAR": cpUnitStatDisp = "Not Available for Rent"; break; case "SPLUS": cpUnitStatDisp = "Shelter Plus"; break; case "DUPLEX": cpUnitStatDisp = "Owner-occupied Duplex"; break; case "COMM": cpUnitStatDisp = "Commercial"; break; case "SHARED": cpUnitStatDisp = "Owner Shares Kit/Bath"; break; case "MISC": cpUnitStatDisp = "Miscellaneous Exempt"; break; } foreach (XmlElement detailOccBy in detailUnits.GetElementsByTagName("occupants")) { if (occupiedBy.Length > 0) { occupiedBy += (", " + detailOccBy.SelectSingleNode("name").SelectSingleNode("nameLastFirstDisplay").InnerText); } else { occupiedBy = detailOccBy.SelectSingleNode("name").SelectSingleNode("nameLastFirstDisplay").InnerText; } } switch (unit.UnitStatCode.ToUpper()) { case "OOCC": exemptionReason = "Owner-Occupied"; break; case "SEC8": exemptionReason = "Section 8"; break; case "RENTED": exemptionReason = "Rented or Available for Rent"; break; case "FREE": exemptionReason = "Rent-Free"; break; case "NAR": exemptionReason = "Not Available for Rent"; break; case "SPLUS": exemptionReason = "Shelter Plus"; break; case "DUPLEX": exemptionReason = "Owner-occupied Duplex"; break; case "COMM": exemptionReason = "Commercial"; break; case "SHARED": exemptionReason = "Owner Shares Kit/Bath"; break; case "MISC": exemptionReason = "Miscellaneous Exempt"; break; } unit.ClientPortalUnitStatusCode = detailUnits.SelectSingleNode("clientPortalUnitStatusCode").InnerText; //unit.CommResYN = ""; //unit.CommUseDesc = ""; //unit.CommZoneUse = ""; //unit.ContractNo = ""; unit.CPUnitStatDisp = cpUnitStatDisp; //unit.DatePriorTenancyEnded = ""; //unit.DeclarationInitials = ""; unit.ExemptionReason = exemptionReason; unit.HServices = hServices; unit.InitialRent = ""; // part of <occupancy> unit.MultiUnitYN = ""; //unit.NumberOfTenants = ""; unit.OccupiedBy = occupiedBy; unit.OtherUnits = ""; unit.PMEmailPhone = ""; unit.PrincResYN = ""; unit.PropMgrName = ""; unit.ReasonPriorTenancyEnded = ""; unit.RentCeiling = rentCeiling; unit.SmokeDetector = ""; //unit.SmokingProhibitionEffectiveDate = ""; unit.SmokingProhibitionInLeaseStatus = ""; unit.UnitID = detailUnits.SelectSingleNode("unitId").InnerText; unit.UnitNo = detailUnits.SelectSingleNode("unitNumber").InnerText; unit.UnitStatCode = detailUnits.SelectSingleNode("unitStatusCode").InnerText; unit.UnitStatID = detailUnits.SelectSingleNode("unitStatusId").InnerText; if (unitStatusAsOfDate != DateTime.MinValue) { unit.UnitStatusAsOfDate = unitStatusAsOfDate; } if (tenancyStartDate != DateTime.MinValue) { unit.TenancyStartDate = tenancyStartDate; } unit.StreetAddress = detailUnits.SelectSingleNode("unitStreetAddress").InnerText; unit.TenantContacts = ""; unit.TenantNames = unit.TenantNames; unit.TenantContacts = unit.TenantContacts; unit.TenantCount = 0; if (detailUnits.SelectNodes("occupancy").Count > 0) { if (detailUnits.GetElementsByTagName("noOfOccupants").Item(0) != null) { unit.TenantCount = int.Parse(detailUnits.GetElementsByTagName("noOfOccupants").Item(0).InnerText); } } unit.TerminationReason = ""; if (string.IsNullOrEmpty(unitID) || unitID == unit.UnitID) { user.CurrentProperty.Units.Add(unit); } } } gotPropertyUnits = true; } catch (Exception ex) { SetErrorMessage("GetPropertyUnits", ex); } return(gotPropertyUnits); }
public bool GetProperties(ref BRBUser user) { var gotUserProperties = false; var soapRequest = new SoapRequest { Source = "GetUserProperties", StaticDataFile = "GetUserProperties_Response.xml", Url = "GetUserProfilePropertiesList/RTSClientPortalAPI_API_WSD_GetUserProfilePropertiesList_Port", Action = "RTSClientPortalAPI_API_WSD_GetUserProfilePropertiesList_Binder_getProfileProperties" }; try { soapRequest.Body.Append("<api:getProfileProperties>"); soapRequest.Body.Append("<request>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.Append("</request>"); soapRequest.Body.Append("</api:getProfileProperties>"); var xmlDoc = GetXmlResponse(soapRequest); user.Properties = new List <BRBProperty>(); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { foreach (XmlElement detailProperty in detail.GetElementsByTagName("profileProperty")) { foreach (XmlElement balanceAmounts in detailProperty.GetElementsByTagName("balanceAmounts")) { decimal currentFees = 0; decimal priorFees = 0; decimal currentPenalty = 0; decimal priorPenalty = 0; decimal credit = 0; decimal totalBalance = 0; var myProperty = new BRBProperty(); Decimal.TryParse(balanceAmounts.SelectSingleNode("currentFees").InnerText, out currentFees); Decimal.TryParse(balanceAmounts.SelectSingleNode("priorFees").InnerText, out priorFees); Decimal.TryParse(balanceAmounts.SelectSingleNode("currentPenalty").InnerText, out currentPenalty); Decimal.TryParse(balanceAmounts.SelectSingleNode("priorPenalties").InnerText, out priorPenalty); Decimal.TryParse(balanceAmounts.SelectSingleNode("credit").InnerText, out credit); Decimal.TryParse(balanceAmounts.SelectSingleNode("totalBalance").InnerText, out totalBalance); gotUserProperties = detail.SelectSingleNode("status").InnerText.ToUpper().Equals("SUCCESS"); if (!gotUserProperties) { ErrorMessage = detail.SelectSingleNode("errorMsg").InnerText; } else { #if DEBUG if (totalBalance == 0) { totalBalance = 10.0M; if (currentFees == 0) { currentFees = 10.0M; } } #endif myProperty.PropertyID = detailProperty.SelectSingleNode("propertyId").InnerText; myProperty.PropertyAddress = detailProperty.SelectSingleNode("address").SelectSingleNode("mainStreetAddress").InnerText; myProperty.CurrentFee = currentFees; myProperty.PriorFee = priorFees; myProperty.CurrentPenalty = currentPenalty; myProperty.PriorPenalty = priorPenalty; myProperty.Credits = credit; myProperty.Balance = totalBalance; user.Properties.Add(myProperty); } } } } } catch (Exception ex) { SetErrorMessage("GetProperties", ex); } return(gotUserProperties); }
protected void LogIn(object sender, EventArgs e) { Session.Clear(); var user = new BRBUser(); var provider = Master.DataProvider; if (IsValid) { try { if (UserIDOrBillCode.SelectedValue == "UserID") { user.UserCode = UserIDCode.Text ?? ""; } else { user.BillingCode = BillCode.Text ?? ""; } if (provider.Authenticate(ref user, Password.Text ?? "") == SignInStatus.Success) { user.Password = Password.Text; Master.UpdateSession(user); if (user.IsTemporaryPassword) { Session["NextPage"] = user.IsFirstlogin ? "ProfileConfirm" : "Home"; Response.Redirect("~/Account/ManagePassword", false); } else { var claims = new List <Claim>(); claims.Add(new Claim(ClaimTypes.Name, user.BillingCode)); Request.GetOwinContext().Authentication.SignIn(new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie)); if (user.IsFirstlogin) { Session["NextPage"] = "Home"; Response.Redirect("~/Account/ProfileConfirm", false); } else if (provider.GetUserProfile(ref user)) { Master.UpdateSession(user); Response.Redirect("~/Home", false); } else { Session.Clear(); Logger.Log("Login", provider.ErrorMessage); Master.ShowErrorModal("Error getting User Profile.", "Login Error"); } } } else { Session.Clear(); Logger.Log("Login", provider.ErrorMessage); Master.ShowErrorModal("Authentication Error.", "Login Error"); } } catch (Exception ex) { Session.Clear(); Logger.LogException("Login", ex); Master.ShowErrorModal("Please contact your system administrator.", "System Error"); } } }
public bool SaveCart(BRBUser user) { var wasSaved = false; var soapRequest = new SoapRequest { Source = "SaveCart", StaticDataFile = "SaveCart_Response.xml", Url = "SavePaymentCartDetails/RTSClientPortalAPI_API_WSD_SavePaymentCartDetails_Port", Action = "RTSClientPortalAPI_API_WSD_SavePaymentCartDetails_Binder_savePaymentCart" }; try { soapRequest.Body.Append("<api:savePaymentCart>"); soapRequest.Body.Append("<savePaymentToCart>"); soapRequest.Body.AppendFormat("<cartId>{0}</cartId>", user.Cart.ID); soapRequest.Body.AppendFormat("<!--Optional:--><paymentConfirmationNo>{0}</paymentConfirmationNo>", user.Cart.PaymentConfirmationNo); soapRequest.Body.AppendFormat("<!--Optional:--><paymentMethod>{0}</paymentMethod>", SafeString(user.Cart.PaymentMethod)); soapRequest.Body.AppendFormat("<paymentReceivedAmt>{0}</paymentReceivedAmt>", user.Cart.PaymentReceivedAmt); soapRequest.Body.AppendFormat("<isFeeOnlyPaid>{0}</isFeeOnlyPaid>", user.Cart.isFeeOnlyPaid ? "true" : "false"); soapRequest.Body.Append("<!--1 or more repetitions:-->"); foreach (var cartItem in user.Cart.Items) { soapRequest.Body.Append("<items>"); soapRequest.Body.AppendFormat("<itemId>{0}</itemId>", cartItem.ID); soapRequest.Body.AppendFormat("<propertyId>{0}</propertyId>", SafeString(cartItem.PropertyId)); soapRequest.Body.AppendFormat("<propertyMainStreetAddress>{0}</propertyMainStreetAddress>", SafeString(cartItem.PropertyAddress)); soapRequest.Body.AppendFormat("<fee>{0}</fee>", cartItem.SumCurrentFees()); soapRequest.Body.AppendFormat("<penalties>{0}</penalties>", cartItem.SumPenalties(user.Cart.isFeeOnlyPaid)); soapRequest.Body.AppendFormat("<balance>{0}</balance>", cartItem.SumBalance(user.Cart.isFeeOnlyPaid)); soapRequest.Body.Append("</items>"); } soapRequest.Body.Append("</savePaymentToCart>"); soapRequest.Body.Append("<request>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.Append("</request>"); soapRequest.Body.Append("</api:savePaymentCart>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { wasSaved = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!wasSaved) { ErrorMessage = detail.ChildNodes[1].InnerText; } } if (wasSaved) { foreach (XmlElement el in xmlDoc.DocumentElement.GetElementsByTagName("cartId")) { user.Cart.ID = el.InnerText; } } } catch (Exception ex) { SetErrorMessage("SaveCart", ex); } return(wasSaved); }
public bool UpdateUnitTenancy(ref BRBUser user) { var wasSaved = false; var property = user.CurrentProperty; var unit = user.CurrentUnit; var soapRequest = new SoapRequest { Source = "SaveTenant", Url = "UpdateUnitTenancy/RTSClientPortalAPI_API_WSD_UpdateUnitTenancy_Port", Action = "RTSClientPortalAPI_API_WSD_UpdateUnitTenancy_Binder_updateUnitTenancy" }; try { soapRequest.Body.Append("<api:updateUnitTenancy>"); soapRequest.Body.Append("<unitTenancyUpdateReq>"); soapRequest.Body.AppendFormat("<userId>{0}</userId>", user.UserCode); soapRequest.Body.AppendFormat("<propertyId>{0}</propertyId>", property.PropertyID); soapRequest.Body.AppendFormat("<unitId>{0}</unitId>", unit.UnitID); soapRequest.Body.AppendFormat("<unitStatus>{0}</unitStatus>", unit.ClientPortalUnitStatusCode); soapRequest.Body.AppendFormat("<initialRent>{0}</initialRent>", unit.InitialRent); soapRequest.Body.AppendFormat("<tenancyStartDate>{0}</tenancyStartDate>", unit.TenancyStartDate.Value.AsShortDateFormat()); soapRequest.Body.AppendFormat("<priorTenancyEndDate>{0}</priorTenancyEndDate>", unit.DatePriorTenancyEnded.Value.AsShortDateFormat()); soapRequest.Body.Append("<!--Zero or more repetitions:-->"); foreach (var service in unit.HServices.Split(',')) { soapRequest.Body.Append("<housingServices>"); soapRequest.Body.AppendFormat("<serviceName>{0}</serviceName>", service); soapRequest.Body.Append("</housingServices>"); } soapRequest.Body.AppendFormat("<!--Optional:--><otherHousingService>{0}</otherHousingService>", unit.OtherHServices); soapRequest.Body.AppendFormat("<noOfTenants>{0}</noOfTenants>", unit.Tenants.Count); soapRequest.Body.AppendFormat("<smokingProhibitionInLeaseStatus>{0}</smokingProhibitionInLeaseStatus>", unit.SmokingProhibitionInLeaseStatus); if (unit.SmokingProhibitionEffectiveDate.HasValue) { soapRequest.Body.AppendFormat("<smokingProhibitionEffectiveDate>{0}</smokingProhibitionEffectiveDate>", unit.SmokingProhibitionEffectiveDate.Value.AsShortDateFormat()); } else { soapRequest.Body.Append("<smokingProhibitionEffectiveDate></smokingProhibitionEffectiveDate>"); } soapRequest.Body.AppendFormat("<reasonForTermination>{0}</reasonForTermination>", unit.TerminationReason); soapRequest.Body.AppendFormat("<otherReasonForTermination>{0}</otherReasonForTermination>", unit.OtherTerminationReason); soapRequest.Body.AppendFormat("<!--Optional:--><explainInvoluntaryTermination>{0}</explainInvoluntaryTermination>", unit.OtherTerminationReason); soapRequest.Body.Append("<!--Zero or more repetitions:-->"); foreach (var tenant in unit.Tenants) { soapRequest.Body.Append("<tenants>"); soapRequest.Body.Append("<code></code>"); soapRequest.Body.Append("<name>"); soapRequest.Body.AppendFormat("<first>{0}</first>", tenant.FirstName); soapRequest.Body.Append("<!--Optional:--><middle></middle>"); soapRequest.Body.AppendFormat("<last>{0}</last>", tenant.LastName); soapRequest.Body.Append("<suffix></suffix>"); soapRequest.Body.Append("<!--Optional:--><nameLastFirstDisplay></nameLastFirstDisplay>"); soapRequest.Body.Append("<!--Optional:--><agencyName></agencyName>"); soapRequest.Body.Append("</name>"); soapRequest.Body.AppendFormat("<phoneNumber>{0}</phoneNumber>", tenant.PhoneNumber); soapRequest.Body.AppendFormat("<emailAddress>{0}</emailAddress>", tenant.Email); soapRequest.Body.Append("</tenants>"); } soapRequest.Body.AppendFormat("<declarationInitial>{0}</declarationInitial>", unit.DeclarationInitials); soapRequest.Body.Append("</unitTenancyUpdateReq>"); soapRequest.Body.Append("</api:updateUnitTenancy>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { wasSaved = detail.ChildNodes[0].InnerText.ToUpper().Equals("SUCCESS"); if (!wasSaved) { ErrorMessage = detail.ChildNodes[1].InnerText; } } } catch (Exception ex) { SetErrorMessage("UpdateUnitTenancy", ex); } return(wasSaved); }
public bool GetUnitTenants(ref BRBUser user) { var gotTenants = false; var soapRequest = new SoapRequest { Source = "GetPropertyTenants", StaticDataFile = "GetPropertyAndUnitDetails_Response.xml", Url = "GetPropertyAndUnitDetails/RTSClientPortalAPI_API_WSD_GetPropertyAndUnitDetails_Port", Action = "RTSClientPortalAPI_API_WSD_GetPropertyAndUnitDetails_Binder_getPropertyAndUnitDetails" }; try { user.CurrentUnit.Tenants = new List <BRBTenant>(); soapRequest.Body.Append("<api:getPropertyAndUnitDetails>"); soapRequest.Body.AppendFormat("<propertyId>{0}</propertyId>", SafeString(user.CurrentProperty.PropertyID)); soapRequest.Body.Append("<request>"); soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); soapRequest.Body.Append("</request>"); soapRequest.Body.Append("</api:getPropertyAndUnitDetails>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("propertyAndUnitsRes")) { foreach (XmlElement detailUnits in detail.GetElementsByTagName("units")) { var unitID = detailUnits.SelectSingleNode("unitId").InnerText; if (user.CurrentUnit.UnitID == detailUnits.SelectSingleNode("unitId").InnerText) { // // OCCUPANCY // if (detailUnits.SelectNodes("occupancy").Count > 0) // some Rented Units have no Occupants -- bad data? { if (detailUnits.GetElementsByTagName("noOfOccupants").Item(0) != null) { user.CurrentUnit.TenantCount = int.Parse(detailUnits.GetElementsByTagName("noOfOccupants").Item(0).InnerText); } if (detailUnits.GetElementsByTagName("initialRent").Item(0) != null) { user.CurrentUnit.InitialRent = detailUnits.GetElementsByTagName("initialRent").Item(0).InnerText; } if (detailUnits.GetElementsByTagName("datePriorTenancyEnded").Item(0) != null) { user.CurrentUnit.DatePriorTenancyEnded = DateTime.Parse(detailUnits.GetElementsByTagName("datePriorTenancyEnded").Item(0).InnerText); } if (detailUnits.GetElementsByTagName("reasonPriorTenancyEnded").Item(0) != null) { user.CurrentUnit.ReasonPriorTenancyEnded = detailUnits.GetElementsByTagName("reasonPriorTenancyEnded").Item(0).InnerText; } if (detailUnits.GetElementsByTagName("smokingProhibitionInLeaseStatus").Item(0) != null) { user.CurrentUnit.SmokingProhibitionInLeaseStatus = detailUnits.GetElementsByTagName("smokingProhibitionInLeaseStatus").Item(0).InnerText; } if (detailUnits.GetElementsByTagName("smokingProhibitionEffectiveDate").Item(0) != null) { DateTime dtSmokingProhibitionEffectiveDate = DateTime.MinValue; if (DateTime.TryParse(detailUnits.GetElementsByTagName("smokingProhibitionEffectiveDate").Item(0).InnerText, out dtSmokingProhibitionEffectiveDate)) { user.CurrentUnit.SmokingProhibitionEffectiveDate = dtSmokingProhibitionEffectiveDate; } } // // TENANTS // foreach (XmlElement detailOccBy in detailUnits.GetElementsByTagName("occupants")) { var tenant = new BRBTenant(); tenant.TenantID = detailOccBy.SelectSingleNode("occupantId").InnerText; tenant.FirstName = detailOccBy.SelectSingleNode("name").SelectSingleNode("firstName").InnerText; tenant.LastName = detailOccBy.SelectSingleNode("name").SelectSingleNode("lastName").InnerText; tenant.PhoneNumber = detailOccBy.SelectSingleNode("contactInfo").SelectSingleNode("phoneNumber").InnerText; tenant.Email = detailOccBy.SelectSingleNode("contactInfo").SelectSingleNode("emailAddress").InnerText; user.CurrentUnit.Tenants.Add(tenant); } } } } } gotTenants = true; } catch (Exception ex) { SetErrorMessage("GetUnitTenants", ex); } return(gotTenants); }
public bool Register(ref BRBUser user) { bool wasRegistered = false; var soapRequest = new SoapRequest { Source = "Register", Url = "ValidateRegistrationRequest/RTSClientPortalAPI_API_WSD_ValidateRegistrationRequest_Port", Action = "RTSClientPortalAPI.API.WSD.ValidateRegistrationRequest" }; try { soapRequest.Body.Append("<api:validateRegistrationRequest>"); soapRequest.Body.Append("<registrationRequestReq>"); soapRequest.Body.Append("<profileDetails>"); soapRequest.Body.AppendFormat("<userId>{0}</userId>", user.UserCode.EscapeXMLChars()); soapRequest.Body.AppendFormat("<billingCode>{0}</billingCode>", user.BillingCode.EscapeXMLChars()); soapRequest.Body.Append("<name>"); soapRequest.Body.Append("<!--Optional:--><first></first>"); soapRequest.Body.Append("<!--Optional:--><middle></middle>"); soapRequest.Body.AppendFormat("<last>{0}</last>", SafeString(user.LastName)); soapRequest.Body.Append("<suffix></suffix>"); soapRequest.Body.Append("<!--Optional:--><nameLastFirstDisplay></nameLastFirstDisplay>"); soapRequest.Body.Append("</name>"); soapRequest.Body.Append("<mailingAddress>"); soapRequest.Body.AppendFormat("<!--Optional:--><streetNumber>{0}</streetNumber>", SafeString(user.StreetNumber)); soapRequest.Body.AppendFormat("<!--Optional:--><streetName>{0}</streetName>", SafeString(user.StreetName)); soapRequest.Body.Append("<!--Optional:--><unitNumber></unitNumber>"); soapRequest.Body.Append("<fullAddress></fullAddress>"); soapRequest.Body.AppendFormat("<!--Optional:--><city>{0}</city>", SafeString(user.City)); soapRequest.Body.AppendFormat("<!--Optional:--><state>{0}</state>", SafeString(user.StateCode)); soapRequest.Body.AppendFormat("<!--Optional:--><zip>{0}</zip>", SafeString(user.ZipCode)); soapRequest.Body.Append("<!--Optional:--><country></country>"); soapRequest.Body.Append("</mailingAddress>"); soapRequest.Body.AppendFormat("<emailAddress>{0}</emailAddress>", SafeString(user.Email)); soapRequest.Body.AppendFormat("<phone>{0}</phone>", SafeString(user.PhoneNumber)); soapRequest.Body.Append("<securityQuestion1></securityQuestion1>"); soapRequest.Body.Append("<securityAnswer1></securityAnswer1>"); soapRequest.Body.Append("<securityQuestion2></securityQuestion2>"); soapRequest.Body.Append("<securityAnswer2></securityAnswer2>"); soapRequest.Body.Append("</profileDetails>"); soapRequest.Body.Append("<propertyDetails>"); soapRequest.Body.AppendFormat("<relationship>{0}</relationship>", SafeString(user.Relationship)); soapRequest.Body.AppendFormat("<ownerLastName>{0}</ownerLastName>", SafeString(user.PropertyOwnerLastName)); soapRequest.Body.AppendFormat("<address>{0}</address>", SafeString(user.PropertyAddress)); soapRequest.Body.Append("<purchaseYear></purchaseYear>"); soapRequest.Body.Append("</propertyDetails>"); soapRequest.Body.Append("</registrationRequestReq>"); soapRequest.Body.Append("</api:validateRegistrationRequest>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("response")) { Status = detail.ChildNodes[0].InnerText; if (Status.ToUpper() != "SUCCESS") { ErrorMessage = detail.ChildNodes[1].InnerText; } } wasRegistered = Status.ToUpper().Equals("SUCCESS"); } catch (Exception ex) { SetErrorMessage("Register", ex); } return(wasRegistered); }
public bool GetUserProfile(ref BRBUser user) { var gotProfile = false; var soapRequest = new SoapRequest { Source = "GetProfile", StaticDataFile = "GetProfileDetails_Response.xml", Url = "GetUserProfile/RTSClientPortalAPI_API_WSD_GetUserProfile_Port", Action = "RTSClientPortalAPI_API_WSD_GetUserProfile_Binder_getProfileDetails" }; try { soapRequest.Body.Append("<api:getProfileDetails>"); soapRequest.Body.Append("<request>"); if (string.IsNullOrEmpty(user.BillingCode)) { soapRequest.Body.AppendFormat("<!--Optional:--><userId>{0}</userId>", SafeString(user.UserCode)); } else { soapRequest.Body.AppendFormat("<!--Optional:--><billingCode>{0}</billingCode>", SafeString(user.BillingCode)); } soapRequest.Body.Append("</request>"); soapRequest.Body.Append("</api:getProfileDetails>"); var xmlDoc = GetXmlResponse(soapRequest); foreach (XmlElement detail in xmlDoc.DocumentElement.GetElementsByTagName("profileDetails")) { foreach (XmlElement detailName in xmlDoc.DocumentElement.GetElementsByTagName("name")) { foreach (XmlElement detailAddr in xmlDoc.DocumentElement.GetElementsByTagName("mailingAddress")) { user.BillingCode = detail.SelectSingleNode("billingCode").InnerText; user.Relationship = detail.SelectSingleNode("relationship").InnerText; // Name user.FirstName = detailName.SelectSingleNode("first").InnerText.UnescapeXMLChars(); user.LastName = detailName.SelectSingleNode("last").InnerText.UnescapeXMLChars(); user.MiddleName = detailName.SelectSingleNode("middle").InnerText; user.Suffix = detailName.SelectSingleNode("suffix").InnerText; user.Email = detail.SelectSingleNode("emailAddress").InnerText; user.PhoneNumber = detail.SelectSingleNode("phone").InnerText; // Address user.StreetNumber = detailAddr.SelectSingleNode("streetNumber").InnerText.UnescapeXMLChars(); user.StreetName = detailAddr.SelectSingleNode("streetName").InnerText.UnescapeXMLChars(); user.UnitNumber = detailAddr.SelectSingleNode("unitNumber").InnerText; user.FullAddress = detailAddr.SelectSingleNode("fullAddress").InnerText; user.City = detailAddr.SelectSingleNode("city").InnerText; user.StateCode = detailAddr.SelectSingleNode("state").InnerText; user.ZipCode = detailAddr.SelectSingleNode("zip").InnerText; user.Country = detailAddr.SelectSingleNode("country").InnerText; if (detail.SelectSingleNode("securityQuestion1") != null) // not returned until confirmed { user.Question1 = detail.SelectSingleNode("securityQuestion1").InnerText; } if (detail.SelectSingleNode("securityQuestion2") != null) { user.Question2 = detail.SelectSingleNode("securityQuestion2").InnerText; } if ((detailName.SelectSingleNode("agencyName").InnerText.Length > 0)) { user.AgencyName = detailName.SelectSingleNode("agencyName").InnerText.UnescapeXMLChars(); } gotProfile = true; } } } } catch (Exception ex) { SetErrorMessage("GetUserProfile", ex); } return(gotProfile); }