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.Admin { public partial class ViewCompanyDetails : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("AdminLogin.aspx"); } else { if (Session["username"].ToString() == "admin") { if (!IsPostBack) { ViewDetails(); } } else { Response.Redirect("AdminLogin.aspx"); } } } 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(); //Taglb.Text = ds.Tables[0].Rows[0]["Tag"].ToString(); if (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["Address1"].ToString()) && String.IsNullOrEmpty(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(); } // Parentlb.Text = ds.Tables[0].Rows[0]["ParentCompanyName"].ToString(); if (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["City"].ToString()) && String.IsNullOrEmpty(ds.Tables[0].Rows[0]["StateName"].ToString()) && String.IsNullOrEmpty(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 (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PaperAddress1"].ToString()) && String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PaperAddress2"].ToString())&& String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PaperCity"].ToString()) && String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PaperStateName"].ToString()) && String.IsNullOrEmpty(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 (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PartsAddress1"].ToString()) && String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PartsAddress2"].ToString()) && String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PartsCity"].ToString()) && String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PartsStateName"].ToString()) && String.IsNullOrEmpty(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 (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["ShippingCutoffTime"].ToString())) { ShipTime.Visible = false; } else { CutOffTimelb.Text = ds.Tables[0].Rows[0]["ShippingCutoffTime"].ToString(); } //TimeZonelb.Text = ds.Tables[0].Rows[0]["TimeZonename"].ToString(); if (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["WebSite"].ToString())) { websitevalue.Visible = false; } else { //websitevalue.Visible = true; // alink.Visible = true; 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 (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["EmailId"].ToString())) { Emailvalue.Visible = false; } else { Emaillb.Text = ds.Tables[0].Rows[0]["EmailId"].ToString(); } //PriceUrllb.Text = ds.Tables[0].Rows[0]["PriceList"].ToString(); if (String.IsNullOrEmpty(ds.Tables[0].Rows[0]["PricelistDate"].ToString())) { pricelistdate.Visible = false; } else { PriceDate.Text = ds.Tables[0].Rows[0]["PricelistDate"].ToString(); } //KeyWordslb.Text = ds.Tables[0].Rows[0]["Keywords"].ToString(); // ImageUrl.ImageUrl = "CompanyLogos/" + ds.Tables[0].Rows[0]["LogoUrl"].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 TechNum = ds.Tables[0].Rows[0]["CompanyTechArea"].ToString() + "-"; //TechNum += " " + ds.Tables[0].Rows[0]["CompanyTechPre"].ToString(); //TechNum += "-" + ds.Tables[0].Rows[0]["CompanyTechSuffix"].ToString(); //if (TechNum.Length > 10) //{ // TechSupNumlb.Text = TechNum.ToString(); //} //else //{ // TechSupNumlb.Text = ""; //} 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; } //string csNum = "(" + ds.Tables[0].Rows[0]["CompanyCSArea"].ToString() + ")"; //csNum += " " + ds.Tables[0].Rows[0]["CompanyCSPre"].ToString(); //csNum += "-" + ds.Tables[0].Rows[0]["CompanyCSSuffix"].ToString(); //if (csNum.Length > 10) //{ // CSNum.Text = csNum.ToString(); //} //else //{ // CSNum.Text = ""; //} //string RegionNames = ""; //string Regions = ""; //for (int i = 0; i < ds.Tables[1].Rows.Count; i++) //{ // Regions += ds.Tables[1].Rows[i]["RegionName"].ToString() + ", "; //} //if (Regions.Length > 0) //{ // RegionNames = Regions.Substring(0, Regions.LastIndexOf(", ")); //} // Regionslb.Text = RegionNames.ToString(); } catch (Exception ex) { throw new ArgumentException(ex.Message); } } } }