/// <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 : UpdateMoveDataAsync /// Author : Hiren Patel /// Creation Date : 1 Feb 2018 /// Purpose : Use for Update move data /// Revision : /// </summary> public async Task UpdateMoveDataAsync() { Move move; move = new Move(); if (DTOConsumer.dtoEstimateData != null) { estimateModel = DTOConsumer.GetSelectedEstimate(); MoveDataModel dtoMoveData = DTOConsumer.dtoMoveData; dtoMoveData.StatusReason = GetMoveStatusReason(estimateModel); loadingOverlay = UIHelper.ShowLoadingScreen(View); APIResponse <MoveDataModel> aPIResponse = await move.PutMoveData(dtoMoveData, estimateModel.MoveNumber); if (aPIResponse.STATUS) { await DTOConsumer.BindMoveDataAsync(); PerformSegue("MoveConfirmedToDashBoard", this); } else { UIHelper.ShowMessage(aPIResponse.Message); } loadingOverlay.Hide(); } }
/// <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 : 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); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.LayoutFragmentMyMoveDetails, container, false); dtoMoveDataModel = DTOConsumer.dtoMoveData; UIReference(); PopulateData(); ApplyFont(); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.LayoutActivityMoveConfirmed); estimateModel = DTOConsumer.dtoEstimateData.FirstOrDefault(rc => rc.MoveNumber == UIHelper.SelectedMoveNumber); dtoMoveData = DTOConsumer.dtoMoveData; UIReference(); DisplayCount(); ApplyFont(); }
/// <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 : BindMoveData /// Author : Hiren Patel /// Creation Date : 30 Dec 2017 /// Purpose : To bind Move data with UI element /// Revision : /// </summary> private async Task BindMoveData() { string errorMessage = string.Empty; try { if (this.ParentViewController != null) { parent = this.ParentViewController as JKTabController; loadingOverlay = UIHelper.ShowLoadingScreen(parent.View); } APIResponse <MoveDataModel> response = await moveService.GetMoveData(UtilityPCL.LoginCustomerData.CustomerId); loadingOverlay.Hide(); if (response.STATUS) { if (UtilityPCL.IsMoveActive(response.DATA.IsActive)) { MoveDataModel moveDataModel = response.DATA; SetMoveAddressAndValueDataToUILabel(moveDataModel); if (moveDataModel.MyServices != null) { UIHelper.BindMyServiceData(moveDataModel.MyServices, scrollviewMyServices, View); } CheckStatusReason(moveDataModel); scrollview.Hidden = false; } else { scrollview.Hidden = true; UIHelper.ShowMessage(response.Message); } } else { scrollview.Hidden = true; errorMessage = response.Message; } } catch (Exception error) { errorMessage = error.Message; } finally { if (!string.IsNullOrEmpty(errorMessage)) { ResetDashBoardData(); UIHelper.ShowAlertMessage(this, errorMessage); } loadingOverlay.Hide(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.LayoutFragmentDashboard, container, false); dtoMoveData = DTOConsumer.dtoMoveData; UIReference(); BindMoveDataAsync(); ApplyFont(); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.LayoutFragmentMoveConfirmed, container, false); estimateModel = DTOConsumer.dtoEstimateData.FirstOrDefault(rc => rc.MoveNumber == UIHelper.SelectedMoveNumber); dtoMoveData = DTOConsumer.dtoMoveData; estimate = new Estimate(); UIReference(); ApplyFont(); view.Invalidate(); return(view); }
/// <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 : 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 : 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 : CheckStatusReason /// Author : Hiren Patel /// Creation Date : 3 Jan 2018 /// Purpose : To set scrollview property base on move statusReason data /// Revision : /// </summary> /// <param name="moveDataModel">Object move data.</param> private void CheckStatusReason(MoveDataModel moveDataModel) { if (string.IsNullOrEmpty(moveDataModel.StatusReason)) { scrollviewChart.Hidden = true; imgChartTruck.Hidden = true; lblMoveStatus.Hidden = true; } else { scrollviewChart.Hidden = false; imgChartTruck.Hidden = false; lblMoveStatus.Hidden = false; DrawChart(moveDataModel.StatusReason); } }
/// <summary> /// Method Name : PutMoveData /// Author : Vivek Bhavsar /// Creation Date : 23 Jan 2018 /// Purpose : update move status in crm /// Revision : /// </summary> /// <param name="moveDataModel"></param> /// <param name="moveID"></param> /// <returns></returns> public async Task <APIResponse <MoveDataModel> > PutMoveData(MoveDataModel moveDataModel, string moveID) { APIResponse <MoveDataModel> apiResponse = new APIResponse <MoveDataModel>(); APIResponse <MoveDataModel> putMoveIDResponse = await moveAPIService.PutMoveData(moveDataModel, moveID); if (putMoveIDResponse.STATUS) { apiResponse.STATUS = true; } else { apiResponse.Message = putMoveIDResponse.Message; } return(apiResponse); }
/// <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); } }
/// Method Name : SetAdapter /// Author : Sanket Prajapati /// Creation Date : 23 Jan 2018 /// Purpose : Use for Binding recylerView /// Revision : /// </summary> private void SetAdapter(MoveDataModel moveData) { List <ModelloadData> modelloadDataList = SetDataToCardview(moveData); if (modelloadDataList.Count > 0) { AdapterDashboard adapterDashboard = new AdapterDashboard(Activity, modelloadDataList); recylerViewDashboard.SetLayoutManager(new LinearLayoutManager(Activity)); recylerViewDashboard.SetItemAnimator(new DefaultItemAnimator()); recylerViewDashboard.NestedScrollingEnabled = false; recylerViewDashboard.HasFixedSize = false; recylerViewDashboard.SetAdapter(adapterDashboard); ItemTouchHelper.Callback callback = new ItemTouchHelperCallback(adapterDashboard); ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback); itemTouchHelper.AttachToRecyclerView(recylerViewDashboard); } }
/// <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 : 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> /// Event Name : BtnAlert_TouchUpInside /// Author : Hiren Patel /// Creation Date : 2 Dec 2017 /// Purpose : Populates the move details data. /// Revision : /// </summary> public void PopulateData() { if (DTOConsumer.dtoMoveData != null) { MoveDataModel dtoMoveData = DTOConsumer.dtoMoveData; lblPackDate.Text = dtoMoveData.MoveDetails_PackStartDate; lblLoadDate.Text = dtoMoveData.MoveDetails_LoadStartDate; if (!UtilityPCL.IsNullOrEmptyOrWhiteSpace(dtoMoveData.MoveDetails_DeliveryStartDate) && !UtilityPCL.IsNullOrEmptyOrWhiteSpace(dtoMoveData.MoveDetails_DeliveryEndDate)) { if (dtoMoveData.MoveDetails_DeliveryStartDate == dtoMoveData.MoveDetails_DeliveryEndDate) { lblDeliveryDate.Text = dtoMoveData.MoveDetails_DeliveryStartDate; } else { SetDeliverySpreadData(dtoMoveData.MoveDetails_DeliveryStartDate, dtoMoveData.MoveDetails_DeliveryEndDate); } } } }
/// <summary> /// Method Name : BindMoveDataAsync /// Author : Sanket Prajapati /// Creation Date : 22 jan 2018 /// Purpose : Binding move for data /// Revision : /// </summary> public static async Task BindMoveDataAsync() { string retMessage = string.Empty; dtoEstimateData = new List <EstimateModel>(); dtoMoveData = new MoveDataModel(); try { Move moveService = new Move(); APIResponse <MoveDataModel> response = await moveService.GetMoveData(UtilityPCL.LoginCustomerData.CustomerId); if (response is null) { retMessage = StringResource.msgDashboardNotLoad; } else { retMessage = MoveDataResponse(retMessage, response); if (response.IsNoMove) { await GetEstimateList(); } } } catch (Exception ex) { retMessage = ex.Message; dtoMoveData = null; } finally { if (!string.IsNullOrEmpty(retMessage)) { dtoMoveData = new MoveDataModel() { response_status = false, message = retMessage }; } } }
/// Method Name : SetMoveData /// Author : Sanket Prajapati /// Creation Date : 23 Jan 2018 /// Purpose : Use for move binding data and check active and inactive move /// Revision : /// </summary> private void SetMoveData(MoveDataModel dtoMoveData) { if (dtoMoveData is null) { relativeLayoutParentDashbord.Visibility = ViewStates.Invisible; progressDialog.Dismiss(); AlertMessage(StringResource.msgDashboardNotLoad); } else { progressDialog.Dismiss(); if (dtoMoveData.IsActive == "1") { relativeLayoutParentDashbord.Visibility = ViewStates.Invisible; AlertMessage(dtoMoveData.message); } else { if (!string.IsNullOrEmpty(dtoMoveData.StatusReason)) { if (dtoMoveData.StatusReason == "Invoiced" || dtoMoveData.StatusReason == "Booked") { PopulateChartBookAndInvoicedOrDelivered(dtoMoveData.StatusReason); } else { PopulateCharttPackedAndLoadedOrInTransit(dtoMoveData.StatusReason); } } else { relativeLayoutPieChart.Visibility = ViewStates.Invisible; } SetAdapter(dtoMoveData); SetDataToControl(dtoMoveData); } } }
/// <summary> /// Method Name : SetMoveAddressAndValueDataToUILabel /// Author : Hiren Patel /// Creation Date : 3 Jan 2018 /// Purpose : To set move address value and valuation data to UL label to display on screen /// Revision : /// </summary> /// <param name="moveDataModel">Object move data.</param> private void SetMoveAddressAndValueDataToUILabel(MoveDataModel moveDataModel) { lblOriginCity.Text = moveDataModel.Origin_City; lbldestinationCity.Text = moveDataModel.Destination_City; lblOriginAddress.Text = moveDataModel.CustomOriginAddress; lblDestinationAddress.Text = moveDataModel.CustomDestinationAddress; if (string.IsNullOrEmpty(moveDataModel.daysLeft)) { viewDaysLeft.Hidden = true; SetCenterFirstAndLastDate(); } else { viewDaysLeft.Hidden = false; lblDaysLeftNumber.Text = moveDataModel.daysLeft; } lblLoadFirstDay.Text = moveDataModel.MoveStartDate; lblLoadLastDay.Text = moveDataModel.MoveEndDate; txtViewWhatMattersMost.Text = moveDataModel.WhatMattersMost; lblDeclaredValue.Text = moveDataModel.ExcessValuation; lblCoverageValue.Text = moveDataModel.ValuationDeductible; lblCostValue.Text = moveDataModel.ValuationCost; }
/// Method Name : SetDataToControl /// Author : Sanket Prajapati /// Creation Date : 23 Jan 2018 /// Purpose : Use for move data set to control /// Revision : /// </summary> private void SetDataToControl(MoveDataModel dtoMoveData) { relativeLayoutParentDashbord.Visibility = ViewStates.Visible; tvFromCity.Text = dtoMoveData.Origin_City; tvToCity.Text = dtoMoveData.Destination_City; tvFromAddress.Text = dtoMoveData.CustomOriginAddress; tvToAddress.Text = dtoMoveData.CustomDestinationAddress; tvLeftDays.Text = dtoMoveData.daysLeft; tvStartDate.Text = dtoMoveData.MoveStartDate; tvEndDate.Text = dtoMoveData.MoveEndDate; if (string.IsNullOrEmpty(dtoMoveData.daysLeft)) { lnLeftDays.Visibility = ViewStates.Gone; } else { lnLeftDays.Visibility = ViewStates.Visible; tvLeftDays.Text = dtoMoveData.daysLeft; } if (!string.IsNullOrEmpty(dtoMoveData.CustomOriginAddress) && dtoMoveData.CustomOriginAddress.Length > 25) { tvFromAddress.Text = dtoMoveData.CustomOriginAddress.Substring(0, 25); } else { tvFromAddress.Text = dtoMoveData.CustomOriginAddress; } if (!string.IsNullOrEmpty(dtoMoveData.CustomDestinationAddress) && dtoMoveData.CustomDestinationAddress.Length > 25) { tvToAddress.Text = dtoMoveData.CustomDestinationAddress.Substring(0, 25); } else { tvToAddress.Text = dtoMoveData.CustomDestinationAddress; } }
/// Method Name : SetDataToCardview /// Author : Sanket Prajapati /// Creation Date : 23 Jan 2018 /// Purpose : Use for Binding data to card view (Myservices,valution, Whatmatermost) /// Revision : /// </summary> private List <ModelloadData> SetDataToCardview(MoveDataModel moveData) { List <ModelloadData> mModelloadDataList = new List <ModelloadData>(); //Set myservice data List <ModelloadData> mModelDummyDataServiceList = new List <ModelloadData>(); foreach (MyServicesModel myServicesmodal in moveData.MyServices) { mModelDummyDataServiceList.Add(new ModelloadData(myServicesmodal.ServicesCode, "")); } //Set valution data List <ModelloadData> mModelloadDataValuationList = new List <ModelloadData>(); mModelloadDataValuationList.Add(new ModelloadData(0, StringResource.msgDeclaredValue, moveData.ExcessValuation)); mModelloadDataValuationList.Add(new ModelloadData(1, StringResource.msgCoverage, moveData.ValuationDeductible)); mModelloadDataValuationList.Add(new ModelloadData(2, StringResource.msgCost, moveData.ValuationCost)); //Set fill cardview mModelloadDataList.Add(new ModelloadData(0, StringResource.msgMyServices, mModelDummyDataServiceList)); mModelloadDataList.Add(new ModelloadData(1, StringResource.msgWhatMattersMost, new ModelloadData(moveData.WhatMattersMost, ""))); mModelloadDataList.Add(new ModelloadData(2, StringResource.msgValuation, mModelloadDataValuationList)); return(mModelloadDataList); }