private void ParseProperties() { try { _SearchControlType = (SearchControlType)Enum.Parse(typeof(SearchControlType), _Type); switch (_SearchControlType) { case SearchControlType.CategoryBrowsing: if (int.TryParse(_CityID, out _CtyID) && int.TryParse(_CategoryID, out _CatID)) { CityID = _CtyID; CategoryID = _CatID; pnlSearch.Visible = false; } break; case SearchControlType.CategorySearch: if (int.TryParse(_CityID, out _CtyID) && int.TryParse(_CategoryID, out _CatID)) { CityID = _CtyID; CategoryID = _CatID; } break; case SearchControlType.MainSearch: if (int.TryParse(_CityID, out _CtyID)) { CityID = _CtyID; } break; case SearchControlType.DemandType: if (int.TryParse(_CityID, out _CtyID) && int.TryParse(_DemandTypeID, out _DmdTyp)) { CityID = _CtyID; DemandTypeID = _DmdTyp; } break; case SearchControlType.Undefined: break; default: break; } _IsDatasourceProbable = true; } catch (Exception ex) { _IsDatasourceProbable = false; pnlSearch.Visible = false; ThrowError(this, new ControlErrorArgs() { InnerException = ex, Message = "Please provide valid parameters.", Severity = 5 }); } }
private void ParseProperties() { try { _SearchControlType = (SearchControlType)Enum.Parse(typeof(SearchControlType), _Type); switch (_SearchControlType) { case SearchControlType.CategoryBrowsing: if (int.TryParse(_CityID, out _CtyID) && int.TryParse(_CategoryID, out _CatID)) { CityID = _CtyID; CategoryID = _CatID; pnlSearch.Visible = false; } break; case SearchControlType.CategorySearch: if (int.TryParse(_CityID, out _CtyID) && int.TryParse(_CategoryID, out _CatID)) { CityID = _CtyID; CategoryID = _CatID; } break; case SearchControlType.DistanceSearch: if (int.TryParse(_CityID, out _CtyID) && decimal.TryParse(_Latitude, out _Lat) && decimal.TryParse(_Longitude, out _Lon) && bool.TryParse(_IsKilometer, out _IsKM)) { CityID = _CtyID; CategoryID = _CatID; Latitude = (double)_Lat; Longitude = (double)_Lon; IsKilometer = _IsKM; } break; case SearchControlType.MainSearch: if (int.TryParse(_CityID, out _CtyID)) { CityID = _CtyID; } break; case SearchControlType.NameSearch: if (int.TryParse(_CityID, out _CtyID)) { CityID = _CtyID; pnlSearch.Visible = false; } break; case SearchControlType.Undefined: break; default: break; } _IsDatasourceProbable = true; } catch (Exception ex) { _IsDatasourceProbable = false; pnlSearch.Visible = false; ThrowError(this, new ControlErrorArgs() { InnerException = ex, Message = "Please provide valid parameters.", Severity = 5 }); } }