using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; namespace infoExpediters { public partial class viewcompanydetails : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewDetails(); } } //displays available company details public void ViewDetails() { try { viewCompanydetails objDetails = new viewCompanydetails(); DataSet ds = objDetails.ViewDetails(Convert.ToInt32(Request.QueryString["id"].ToString())); Namelb.Text = ds.Tables[0].Rows[0]["CompanyName"].ToString(); if (ds.Tables[0].Rows[0]["Address1"].ToString() == "" && ds.Tables[0].Rows[0]["Address2"].ToString() == "") { Addressvalues.Visible = false; } else { Address1lb.Text = ds.Tables[0].Rows[0]["Address1"].ToString(); Address2lb.Text = ds.Tables[0].Rows[0]["Address2"].ToString(); } if (ds.Tables[0].Rows[0]["City"].ToString() == "" && ds.Tables[0].Rows[0]["StateName"].ToString() == "" && ds.Tables[0].Rows[0]["Zip"].ToString() == "") { Cityvalue.Visible = false; } else { Citylb.Text = ds.Tables[0].Rows[0]["City"].ToString() + ","; Statelb.Text = ds.Tables[0].Rows[0]["StateName"].ToString(); Ziplb.Text = ds.Tables[0].Rows[0]["Zip"].ToString(); } if (ds.Tables[0].Rows[0]["PaperAddress1"].ToString() == "" && ds.Tables[0].Rows[0]["PaperAddress2"].ToString() == "" && ds.Tables[0].Rows[0]["PaperCity"].ToString() == "" && ds.Tables[0].Rows[0]["PaperStateName"].ToString() == "" && ds.Tables[0].Rows[0]["PaperZip"].ToString() == "") { Warpaperreadd.Visible = false; Papervalues.Visible = false; } else { WarPaperReAddrs1lb.Text = ds.Tables[0].Rows[0]["PaperAddress1"].ToString(); WarPaperReAddrs2lb.Text = ds.Tables[0].Rows[0]["PaperAddress2"].ToString(); WarPaperReCitylb.Text = ds.Tables[0].Rows[0]["PaperCity"].ToString(); WarPaperReStatelb.Text = ds.Tables[0].Rows[0]["PaperStateName"].ToString(); WarPaperReZiplb.Text = ds.Tables[0].Rows[0]["PaperZip"].ToString(); } if (ds.Tables[0].Rows[0]["PartsAddress1"].ToString() == "" && ds.Tables[0].Rows[0]["PartsAddress2"].ToString() == "" && ds.Tables[0].Rows[0]["PartsCity"].ToString() == "" && ds.Tables[0].Rows[0]["PartsStateName"].ToString() == "" && ds.Tables[0].Rows[0]["PartsZip"].ToString() == "") { Warrantypartsreadd.Visible = false; Partsvalues.Visible = false; } else { WarPartsReAddrs1lb.Text = ds.Tables[0].Rows[0]["PartsAddress1"].ToString(); WarPartsReAddrs2lb.Text = ds.Tables[0].Rows[0]["PartsAddress2"].ToString(); WarPartsReCitylb.Text = ds.Tables[0].Rows[0]["PartsCity"].ToString(); WarPartsReStatelb.Text = ds.Tables[0].Rows[0]["PartsStateName"].ToString(); WarPartsReZiplb.Text = ds.Tables[0].Rows[0]["PartsZip"].ToString(); } if (ds.Tables[0].Rows[0]["ShippingCutoffTime"].ToString() == "") { ShipTime.Visible = false; } else { CutOffTimelb.Text = ds.Tables[0].Rows[0]["ShippingCutoffTime"].ToString(); } if (ds.Tables[0].Rows[0]["WebSite"].ToString() == "") { websitevalue.Visible = false; } else { string Link = ds.Tables[0].Rows[0]["WebSite"].ToString(); string Linkval = Link.Substring(0, 1); if (Linkval == "h") { alink.HRef = ds.Tables[0].Rows[0]["WebSite"].ToString(); linklb.Text = alink.HRef; } else { alink.HRef = "http://" + ds.Tables[0].Rows[0]["WebSite"].ToString(); linklb.Text = alink.HRef; } } if (ds.Tables[0].Rows[0]["EmailId"].ToString() == "") { Emailvalue.Visible = false; } else { Emaillb.Text = ds.Tables[0].Rows[0]["EmailId"].ToString(); } if (ds.Tables[0].Rows[0]["PricelistDate"].ToString() == "") { pricelistdate.Visible = false; } else { PriceDate.Text = ds.Tables[0].Rows[0]["PricelistDate"].ToString(); } if (!String.IsNullOrEmpty(ds.Tables[0].Rows[0]["LogoUrl"].ToString())) { ImageUrl.ImageUrl = "CompanyLogos/" + ds.Tables[0].Rows[0]["LogoUrl"].ToString(); ImageUrl.Visible = true; } else { ImageUrl.Visible = false; } string PhoneNum = ds.Tables[0].Rows[0]["CompanyPhoneArea"].ToString() + "-"; PhoneNum += " " + ds.Tables[0].Rows[0]["CompanyPhonePre"].ToString(); PhoneNum += "-" + ds.Tables[0].Rows[0]["CompanyPhoneSuffix"].ToString(); if (PhoneNum.Length > 10) { PhoneNumlb.Text = PhoneNum.ToString(); } else { Phonevalue.Visible = false; } string FaxNum = ds.Tables[0].Rows[0]["CompanyFaxArea"].ToString() + "-"; FaxNum += " " + ds.Tables[0].Rows[0]["CompanyFaxPre"].ToString(); FaxNum += "-" + ds.Tables[0].Rows[0]["CompanyFaxSuffix"].ToString(); if (FaxNum.Length > 10) { FaxNumlb.Text = FaxNum.ToString(); } else { faxvalue.Visible = false; } string TollNum = ds.Tables[0].Rows[0]["CompanyTollArea"].ToString() + "-"; TollNum += " " + ds.Tables[0].Rows[0]["CompanyTollPre"].ToString(); TollNum += "-" + ds.Tables[0].Rows[0]["CompanyTollSuffix"].ToString(); if (TollNum.Length > 10) { TollFreeNum.Text = TollNum.ToString(); } else { Tollvalue.Visible = false; } } catch (Exception ex) { throw new ArgumentException(ex.Message); } } } }