protected void Page_Load(object sender, EventArgs e) { CustomerID = (string)Session["CusID"]; lblCus.Text = CustomerID.ToString(); Cust = BusinessLayer.GetCustomer(CustomerID); lblSub.Text = (string)Session["SubT"]; if (!this.IsPostBack) { shipaddress.Shipname = Cust.CompanyName; shipaddress.Address = Cust.Address; shipaddress.City = Cust.City; shipaddress.Country = Cust.Country; shipaddress.PostalCode = Cust.PostalCode; shipaddress.Region = Cust.Region; txtCompanyName.Text = Cust.CompanyName; txtAddress.Text = Cust.Address.ToString(); txtCountry.Text = Cust.Country.ToString(); txtPostalCode.Text = Cust.PostalCode.ToString(); txtCity.Text = Cust.City; } //txtRegion.Text = Cust.Region.ToString(); // txtRegion.Text = Cust.Region.ToString(); }
// Returns a customers information from a given ID public static Customer GetCustomer(string CustomerID) { DataRow c = DB.GetCustomer(CustomerID); Customer RetCustomer = new Customer((string)c["CustomerID"], (string)c["CompanyName"], (string)c["Address"], (string)c["City"], c["Region"] == DBNull.Value ? null : (string)c["Region"], c["PostalCode"] == DBNull.Value ? null : (string)c["PostalCode"], (string)c["Country"], (string)c["Pwd"]); CurrentUser = RetCustomer; return RetCustomer; }