/// <summary> /// Method Name : SetStatusCode /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : Set Status code using mapping set in MoveDataDisplayResource resource file /// Revision : /// </summary> /// <param name="customerMoveData"></param> /// <param name="moveData"></param> private void SetStatusCode(MoveDataModel customerMoveData, GetMoveDataResponse moveData) { if (!string.IsNullOrEmpty(moveData.StatusReason)) { customerMoveData.StatusReason = UtilityPCL.GetMoveDataDisplayValue(moveData.StatusReason, MoveDataDisplayResource.msgMoveCode); } }
/// <summary> /// Method Name : GetMoveData /// Author : Hiren Patel /// Creation Date : 30 Dec 2017 /// Purpose : To get Move data from services /// Revision : /// </summary> private MoveDataModel GetMoveData(GetMoveDataResponse moveData) { UtilityPCL.SetCustomerMoveData(moveData); MoveDataModel CustomerMoveData = SetMoveDataModel(moveData); SetCity(CustomerMoveData, moveData); SetDestinationAddress(CustomerMoveData, moveData); SetOriginAddress(CustomerMoveData, moveData); SetDays(CustomerMoveData, moveData); SetMoveDetails(CustomerMoveData, moveData); CustomerMoveData.WhatMattersMost = moveData.WhatMattersMost; SetValuation(CustomerMoveData, moveData); SetStatusCode(CustomerMoveData, moveData); SetServiceCode(CustomerMoveData, moveData); return(CustomerMoveData); }
/// <summary> /// Method Name : ValidatePrivacyPolicyModel /// Author : Hiren Patel /// Creation Date : 20 Feb 2018 /// Purpose : Validates the privacy policy model. /// Revision : /// </summary> public string ValidatePrivacyPolicyModel(PrivacyPolicyModel privacyPolicyModel) { string errorMessage = string.Empty; if (UtilityPCL.IsNullOrEmptyOrWhiteSpace(privacyPolicyModel.Phone)) { errorMessage = Resource.msgPhoneNumberIsRequired; } else if (privacyPolicyModel.Phone.Length < 10) { errorMessage = Resource.msgPleaseEnterValidPhoneNo; } return(errorMessage); }
/// <summary> /// Method Name : ValidateEmailModel /// Author : Hiren Patel /// Creation Date : 5 Dec 2017 /// Purpose : Validate email model. /// Revision : /// </summary> /// <param name="emailModel"></param> /// <returns></returns> public string ValidateEmailModel(EmailModel emailModel) { string errorMessage = string.Empty; if (string.IsNullOrEmpty(emailModel.EmailID)) { errorMessage = string.Format(Resource.msgFieldRequired, Resource.msgRequiredEmailId); } else if (!UtilityPCL.ValidateEmail(emailModel.EmailID)) // IsValid Email ID { errorMessage = Resource.msgInvalidEmail; } return(errorMessage); }
/// <summary> /// Method Name : GetDateForDiplay /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : sub method to set dates as per require format for estimate /// Revision : /// </summary> /// <param name="date"></param> /// <returns></returns> private string GetDateForDiplay(string date) { string dateValue = string.Empty; if (!string.IsNullOrEmpty(date)) { DateTime datetime = UtilityPCL.ConvertDateTimeInUSFormat(date); if (datetime != DateTime.MinValue) { dateValue = UtilityPCL.DisplayDateFormatForEstimate(datetime, Resource.MMddyyyyDateFormat); } } return(dateValue); }
/// <summary> /// Method Name : SetValuation /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : Set specific currency formats for valuation fields /// Revision : /// </summary> /// <param name="customerMoveData"></param> /// <param name="moveData"></param> private void SetValuation(MoveDataModel customerMoveData, GetMoveDataResponse moveData) { if (!string.IsNullOrEmpty(moveData.ExcessValuation)) { customerMoveData.ExcessValuation = UtilityPCL.CurrencyFormat(moveData.ExcessValuation); } if (!string.IsNullOrEmpty(moveData.ValuationDeductible)) { customerMoveData.ValuationDeductible = UtilityPCL.GetMoveDataDisplayValue(moveData.ValuationDeductible, MoveDataDisplayResource.msgValuationDeductible); } if (!string.IsNullOrEmpty(moveData.ValuationCost)) { customerMoveData.ValuationCost = UtilityPCL.CurrencyFormat(moveData.ValuationCost); } }
/// <summary> /// Method Name : SetDays /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : calculate days left & set date format /// Revision : /// </summary> /// <param name="customerMoveData"></param> /// <param name="moveData"></param> private void SetDays(MoveDataModel customerMoveData, GetMoveDataResponse moveData) { DateTime tempDateObject; if (!string.IsNullOrEmpty(moveData.MoveStartDate)) { tempDateObject = UtilityPCL.ConvertDateTimeInUSFormat(moveData.MoveStartDate); customerMoveData.daysLeft = UtilityPCL.CalulateMoveDays(tempDateObject).ToString(); customerMoveData.MoveStartDate = GetDateForDiplay(moveData.MoveStartDate); } if ((!string.IsNullOrEmpty(moveData.MoveEndDate)) && moveData.MoveEndDate != Resource.DateTBD) { customerMoveData.MoveEndDate = GetDateForDiplay(moveData.MoveEndDate); } else { customerMoveData.MoveEndDate = Resource.DateTBD; } }
/// <summary> /// Method Name : SetMoveContactInfo /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : Refatoring : sub method to set contact info into response /// Revision : /// </summary> /// <param name="apiResponse"></param> private void SetMoveContactInfo(APIResponse <GetContactListForMoveResponse> apiResponse) { apiResponse.STATUS = true; if (!string.IsNullOrEmpty(apiResponse.DATA.internalemailaddress)) { apiResponse.DATA.internalemailaddress = apiResponse.DATA.internalemailaddress.ToLower(); } else { apiResponse.DATA.internalemailaddress = GetDefaultContactListForMove().internalemailaddress; } if (!string.IsNullOrEmpty(apiResponse.DATA.address1_telephone1)) { apiResponse.DATA.address1_telephone1 = UtilityPCL.DisplayPhoneFormat(apiResponse.DATA.address1_telephone1); } else { apiResponse.DATA.address1_telephone1 = GetDefaultContactListForMove().address1_telephone1; } }
/// <summary> /// Method Name : GenerateCustomerProfileResponseAsync /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : sub method to generate response based on input http response message for customer profile /// Revision : /// </summary> /// <param name="customerId"></param> /// <param name="httpResponseMessage"></param> /// <returns></returns> private async Task <APIResponse <CustomerModel> > GetCustomerProfileResponseAsync(string customerId, HttpResponseMessage httpResponseMessage) { APIResponse <CustomerModel> apiResponse; string httpResponseString = await httpResponseMessage.Content.ReadAsStringAsync(); httpResponseString = JToken.Parse(httpResponseString).ToString(); apiResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <APIResponse <CustomerModel> >(httpResponseString); if (apiResponse.DATA is null) { apiResponse.STATUS = false; apiResponse.Message = Resource.msgDefaultServieMessage; } else { apiResponse.DATA.CustomerId = customerId; apiResponse.STATUS = true; apiResponse.Message = Resource.msgGetCustomerService; UtilityPCL.SetLoginCustomerProfileData(apiResponse.DATA); } return(apiResponse); }