protected void cmdSave_Click(object sender, EventArgs e) { try { DistributorLocatorController controller = new DistributorLocatorController(); DistributorLocatorInfo item = new DistributorLocatorInfo(); item.ItemId = _RecordID; item.Distributor = txtDistributor.Text.ToString(); item.Contact = txtContact.Text.ToString(); item.Address = txtAddress.Text.ToString(); item.City = txtCity.Text.ToString(); item.State = ddlState.SelectedValue.ToString(); item.ZipCode = txtZipCode.Text.ToString(); item.Phone = txtPhone.Text.ToString(); item.Fax = txtFax.Text.ToString(); item.Email = txtEmail.Text.ToString(); item.Website = txtWebsite.Text.ToString(); item.Email2 = txtEmail2.Text.ToString(); if (cbxIsDistributor.Checked) { item.IsDistributor = "y"; } else { item.IsDistributor = "n"; } item.DistributorTypeID = Int32.Parse(ddlDistributorType.SelectedValue.ToString()); if (cbxIsActive.Checked) { item.IsActive = "y"; } else { item.IsActive = "n"; } item.Comments = txtComments.Text.ToString(); controller.Distributor_Update(item); Label1.Text = "UPDATE SUCCESSFUL"; } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
public void GetRecord(int _recordID) { try { DistributorLocatorController controller = new DistributorLocatorController(); DistributorLocatorInfo item = controller.Distributor_GetDistributor(_recordID); if (item != null) { txtDistributor.Text = item.Distributor; txtAddress.Text = item.Address; txtCity.Text = item.City; txtComments.Text = item.Comments; txtContact.Text = item.Contact; txtEmail.Text = item.Email; txtEmail2.Text = item.Email2; txtFax.Text = item.Fax; txtPhone.Text = item.Phone; txtWebsite.Text = item.Website; txtZipCode.Text = item.ZipCode; ddlState.SelectedValue = item.State; ddlDistributorType.SelectedValue = item.DistributorType; if (item.IsDistributor == "y") { cbxIsDistributor.Checked = true; } if (item.IsActive == "y") { cbxIsActive.Checked = true; } } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
public void SearchRadius() { try { DistributorLocatorController controller = new DistributorLocatorController(); // LOOK UP THE LAT/LONG of the ZipCode DistributorLocatorInfo item = controller.Distributor_GetLatLongByZipCode(_zipCode.ToString()); var iRadius = Int32.Parse(_radius.ToString()); var istartlat = item.Latitude; var istartlong = item.Longitude; var LatRange = iRadius / 69.04545; var LongRange = iRadius / (((System.Math.Cos(Convert.ToDouble(istartlat * 3.141592653589 / 180)) * 6076) / 5280) * 60); var LowLatitude = istartlat - LatRange; var HighLatitude = istartlat + LatRange; var LowLongitude = istartlong - LongRange; var HighLongitude = istartlong + LongRange; List <DistributorLocatorInfo> items; DistributorLocatorController controller1 = new DistributorLocatorController(); // Get all the ZipCodes with the radius items = controller1.Distributor_GetZipCodesByLatLong(LowLatitude, HighLatitude, LowLongitude, HighLongitude); var _ZipCodeString = ""; foreach (DistributorLocatorInfo info in items) { _ZipCodeString += info.ZipCode.ToString() + ","; } List <DistributorLocatorInfo> itemsResults; DistributorLocatorController controller2 = new DistributorLocatorController(); // GET Grid Results itemsResults = controller2.Distributor_Search_Zips(_ZipCodeString.ToString()); if (_ShowDataGrid == true) { GridView1.DataSource = itemsResults; GridView1.DataBind(); } else { GridView1.Visible = false; } // USED FOR TitleCase CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture; TextInfo textInfo = cultureInfo.TextInfo; ModuleConfiguration.ModuleTitle = "Results within " + _radius.ToString() + " miles of " + textInfo.ToTitleCase(item.City.ToString()) + ", " + item.State.ToString() + " " + _zipCode.ToString(); //DotNetNuke.Framework.CDefault GIBSpage1 = (DotNetNuke.Framework.CDefault)this.Page; //// NEED lookup for the city & state of the zipcode entered //string _vState = ConvertState(_state.ToString()); //GIBSpage1.Title = _pageTitle.ToString().Replace("[State]", _vState.ToString()); if (_ShowDataList == true) { if (Request.QueryString["currentpage"] != null) { _CurrentPage = Convert.ToInt32(Request.QueryString["currentpage"].ToString()); } else { _CurrentPage = 1; } PagedDataSource objPagedDataSource = new PagedDataSource(); objPagedDataSource.DataSource = itemsResults; if (objPagedDataSource.PageCount > 0) { objPagedDataSource.PageSize = PageSize; objPagedDataSource.CurrentPageIndex = _CurrentPage - 1; objPagedDataSource.AllowPaging = true; } DataList1.DataSource = objPagedDataSource; DataList1.DataBind(); if (PageSize == 0 || itemsResults.Count <= PageSize) { PagingControl1.Visible = false; } else { PagingControl1.Visible = true; PagingControl1.TotalRecords = itemsResults.Count; PagingControl1.PageSize = PageSize; PagingControl1.CurrentPage = _CurrentPage; PagingControl1.TabID = TabId; PagingControl1.QuerystringParams = GenerateQueryStringParameters(this.Request, "Radius", "ZipCode", "State", "pg"); } } else { DataList1.Visible = false; PagingControl1.Visible = false; } lblSearchSummary.Text = "Total Records Found: " + itemsResults.Count.ToString(); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
public void GetDistributor() { try { DistributorLocatorController controller = new DistributorLocatorController(); DistributorLocatorInfo item = controller.Distributor_GetDistributor(Int32.Parse(Request.QueryString["Distributor"].ToString())); if (item != null) { lblDistributor.Text = item.Distributor.ToString(); lblAddress.Text = item.FullAddress.ToString(); lblPhone.Text = "Phone: " + item.Phone.ToString(); lblFax.Text = "Fax: " + item.Fax.ToString(); if (item.Contact.ToString().Length > 3) { lblContact.Text = "Contact: " + item.Contact.ToString(); } //WebSite Link if (item.Website.ToString().Length > 6) { hyperlinkWebSite.NavigateUrl = "http://" + item.Website.ToString(); hyperlinkWebSite.Target = "_blank"; } else { hyperlinkWebSite.Visible = false; } // EMAIL LINK if (item.Email.ToString().Length > 6) { HyperLinkEmail.NavigateUrl = "mailto:" + item.Email.ToString() + "?subject=Product%20Inquiry"; } else { HyperLinkEmail.Visible = false; } ModuleConfiguration.ModuleTitle = item.Distributor.ToString() + " in " + item.City.ToString() + ", " + item.State.ToString(); DotNetNuke.Framework.CDefault GIBSpage = (DotNetNuke.Framework.CDefault) this.Page; GIBSpage.Title = _pageTitle.ToString().Replace("[Distributor]", item.Distributor.ToString()).Replace("[City]", item.City.ToString()).Replace("[State]", item.State.ToString()).ToString(); // GIBSpage.Title = "Lab-metal Distributor " + item.Distributor.ToString() + " in " + item.City.ToString() + ", " + item.State.ToString(); string _Address = item.Address.ToString() + ", " + item.City.ToString() + ", " + item.State.ToString() + " " + item.ZipCode.ToString(); _AddressToMap = _Address.ToString().Replace(" ", "+").Replace("&", "%26").ToString(); //BuildGoogleMap(_Address.ToString()); } else { Response.Redirect(Globals.NavigateURL(this.TabId, "", "ErrorMessage=Distributor+Removed"), true); // _AddressToMap = "10001"; // lblDistributor.Text = "Distributor Removed"; } } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }