/// <summary> /// Method Name : SetMoveData /// Author : Vivek Bhavsar /// Creation Date : 22 Dec 2017 /// Purpose : Bind Move data to customer move model /// Revision : Modified by Vivek Bhavsar on 05 Feb 2018 : Add try catch block /// </summary> /// <param name="moveDataModel"></param> private static void SetMoveData(GetMoveDataResponse moveDataModel) { try { if (CustomerMoveData is null) { CustomerMoveData = new MoveDataModel(); } CustomerMoveData.MoveId = moveDataModel.MoveId; CustomerMoveData.MoveNumber = moveDataModel.MoveNumber; CustomerMoveData.IsActive = moveDataModel.IsActive; CustomerMoveData.StatusReason = moveDataModel.StatusReason; CustomerMoveData.Destination_City = moveDataModel.Destination_City; CustomerMoveData.CustomDestinationAddress = moveDataModel.CustomDestinationAddress; CustomerMoveData.Origin_City = moveDataModel.Origin_City; CustomerMoveData.CustomOriginAddress = moveDataModel.CustomOriginAddress; CustomerMoveData.MoveStartDate = moveDataModel.MoveStartDate; CustomerMoveData.MoveEndDate = moveDataModel.MoveEndDate; CustomerMoveData.WhatMattersMost = moveDataModel.WhatMattersMost; CustomerMoveData.ExcessValuation = moveDataModel.ExcessValuation; CustomerMoveData.ValuationDeductible = moveDataModel.ValuationDeductible; CustomerMoveData.ValuationCost = moveDataModel.ValuationCost; CustomerMoveData.ServiceCode = moveDataModel.ServiceCode; } catch { //To be implemented } }
/// <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> /// /// </summary> /// <param name="moveData"></param> /// <returns></returns> private MoveDataModel SetMoveDataModel(GetMoveDataResponse moveData) { MoveDataModel customerMoveData = new MoveDataModel() { MoveId = moveData.MoveId, MoveNumber = moveData.MoveNumber, IsActive = moveData.IsActive }; return(customerMoveData); }
/// <summary> /// Method Name : SetCity /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : set origion and destination city /// Revision : /// </summary> /// <param name="customerMoveData"></param> /// <param name="moveData"></param> private void SetCity(MoveDataModel customerMoveData, GetMoveDataResponse moveData) { if (!string.IsNullOrEmpty(moveData.Destination_City) && moveData.Destination_City.Length > 3) { customerMoveData.Destination_City = moveData.Destination_City.Substring(0, 3).ToUpper(); } if (!string.IsNullOrEmpty(moveData.Origin_City) && moveData.Origin_City.Length > 3) { customerMoveData.Origin_City = moveData.Origin_City.Substring(0, 3).ToUpper(); } }
/// <summary> /// Method Name : SetCustomerMoveData /// Author : Hiren Patel /// Creation Date : 2 Dec 2017 /// Purpose : To store cutomer move information /// Revision : /// </summary> public static void SetCustomerMoveData(GetMoveDataResponse moveDataModel) { if (moveDataModel is null) { return; } else { SetMoveData(moveDataModel); SetMyServiceModel(moveDataModel); SetDaysLeft(moveDataModel); } }
/// <summary> /// Method Name : SetDestinationAddress /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : set destination address /// Revision : /// </summary> /// <param name="CustomerMoveData"></param> /// <param name="moveData"></param> private void SetDestinationAddress(MoveDataModel CustomerMoveData, GetMoveDataResponse moveData) { if (!string.IsNullOrEmpty(moveData.CustomDestinationAddress)) { if (moveData.CustomDestinationAddress.Length < 30) { CustomerMoveData.CustomDestinationAddress = moveData.CustomDestinationAddress; } else { CustomerMoveData.CustomDestinationAddress = moveData.CustomDestinationAddress.Substring(0, 30); } } }
/// <summary> /// Method Name : SetOriginAddress /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : set origion address /// Revision : /// </summary> /// <param name="customerMoveData"></param> /// <param name="moveData"></param> private void SetOriginAddress(MoveDataModel customerMoveData, GetMoveDataResponse moveData) { if (!string.IsNullOrEmpty(moveData.CustomOriginAddress)) { if (moveData.CustomOriginAddress.Length < 30) { customerMoveData.CustomOriginAddress = moveData.CustomOriginAddress; } else { customerMoveData.CustomOriginAddress = moveData.CustomOriginAddress.Substring(0, 30); } } }
/// <summary> /// Method Name : SetDaysLeft /// Author : Vivek Bhavsar /// Creation Date : 22 Dec 2017 /// Purpose : Bind days diff between load start & end date to customer move model days left /// Revision : Modified by Vivek Bhavsar on 05 Feb 2018 : Add try catch block /// </summary> /// <param name="moveDataModel"></param> private static void SetDaysLeft(GetMoveDataResponse moveDataModel) { try { if (string.IsNullOrEmpty(moveDataModel.MoveStartDate) && string.IsNullOrEmpty(moveDataModel.MoveEndDate)) { DateTime firstLoadDate = Convert.ToDateTime(moveDataModel.MoveStartDate); DateTime lastLoadDate = Convert.ToDateTime(moveDataModel.MoveEndDate); CustomerMoveData.daysLeft = Convert.ToString((firstLoadDate - lastLoadDate).TotalDays); } } catch { CustomerMoveData.daysLeft = ""; } }
/// <summary> /// Method Name : SetServiceCode /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : set list of services from comma seperated string /// Revision : /// </summary> /// <param name="customerMoveData"></param> /// <param name="moveData"></param> private void SetServiceCode(MoveDataModel customerMoveData, GetMoveDataResponse moveData) { if (!string.IsNullOrEmpty(moveData.ServiceCode)) { String[] myServicecode = moveData.ServiceCode.Split(','); customerMoveData.MyServices = new List <MyServicesModel>(); foreach (string serviceCode in myServicecode) { customerMoveData.MyServices.Add(new MyServicesModel() { ServicesCode = serviceCode }); } } }
/// <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 SetMoveDetails(MoveDataModel customerMoveData, GetMoveDataResponse moveData) { if (!string.IsNullOrEmpty(moveData.MoveDetails_PackStartDate)) { customerMoveData.MoveDetails_PackStartDate = GetDateForDiplay(moveData.MoveDetails_PackStartDate); } if (!string.IsNullOrEmpty(moveData.MoveDetails_LoadStartDate)) { customerMoveData.MoveDetails_LoadStartDate = GetDateForDiplay(moveData.MoveDetails_LoadStartDate); } if (!string.IsNullOrEmpty(moveData.MoveDetails_DeliveryStartDate)) { customerMoveData.MoveDetails_DeliveryStartDate = GetDateForDiplay(moveData.MoveDetails_DeliveryStartDate); } if (!string.IsNullOrEmpty(moveData.MoveDetails_DeliveryEndDate)) { customerMoveData.MoveDetails_DeliveryEndDate = GetDateForDiplay(moveData.MoveDetails_DeliveryEndDate); } }
/// <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 : SetMyServiceModel /// Author : Vivek Bhavsar /// Creation Date : 22 Dec 2017 /// Purpose : Bind service list in customer move model /// Revision : Modified by Vivek Bhavsar on 05 Feb 2018 : Add try catch block /// </summary> /// <param name="moveDataModel"></param> private static void SetMyServiceModel(GetMoveDataResponse moveDataModel) { try { CustomerMoveData.MyServices = new List <MyServicesModel>(); if (moveDataModel.MyServices != null && moveDataModel.MyServices.Count > 0) { MyServicesModel myServiceModel; foreach (MyServices myService in moveDataModel.MyServices) { myServiceModel = new MyServicesModel { ServicesCode = myService.ServicesCode }; CustomerMoveData.MyServices.Add(myServiceModel); } } } catch { //To be implemented } }