private void SwitchPanelByState(ListingState state) { CurrentState = state; switch (CurrentState) { case ListingState.SelectTemplate: uxListingTemplatePanel.Visible = true; uxCheckConditionPanel.Visible = false; uxShowFeePanel.Visible = false; break; case ListingState.CheckCondition: uxListingTemplatePanel.Visible = false; uxCheckConditionPanel.Visible = true; uxShowFeePanel.Visible = false; break; case ListingState.ShowFee: uxListingTemplatePanel.Visible = false; uxCheckConditionPanel.Visible = false; uxShowFeePanel.Visible = true; break; default: break; } PopulateByState(); }
private void PopulateByState() { uxNext.Visible = true; uxListing.Visible = false; try { if (CurrentState == ListingState.SelectTemplate) { uxListingTemplate.PopulateControls(); } else if (CurrentState == ListingState.CheckCondition) { uxHiddenSelectedTemplateID.Value = uxListingTemplate.GetSelectedEBayTemplateID(); if (!uxHiddenSelectedTemplateID.Value.Equals("-1")) { Boolean isFixDateValid = false; Boolean isScheduleDate = false; uxHiddenScheduleDateTime.Value = uxListingTemplate.GetListingSchedule(out isFixDateValid, out isScheduleDate).ToString(); uxHiddenIsSchedule.Value = isScheduleDate.ToString(); if (isFixDateValid) { if (!uxCheckCondition.PopulateControls(uxHiddenSelectedTemplateID.Value, ProductIDList)) { uxNext.Visible = false; } } else { CurrentState = ListingState.SelectTemplate; uxMessage.DisplayError("Error : Please select schedule date."); } } else { CurrentState = ListingState.SelectTemplate; uxMessage.DisplayError("Error : Please select listing template."); } } else if (CurrentState == ListingState.ShowFee) { uxShowFee.PopulateControls( uxHiddenSelectedTemplateID.Value, ProductIDList, ConvertUtilities.ToBoolean(uxHiddenIsSchedule.Value), ConvertUtilities.ToDateTime(uxHiddenScheduleDateTime.Value)); uxNext.Visible = false; uxListing.Visible = true; } } catch (Exception ex) { uxMessage.DisplayError("Error : " + ex.Message); } }