protected void btnSave_Click(object sender, EventArgs e) { FrameWork.Customers cust = new FrameWork.Customers(); cust.Company = txtCompanyName.Text; cust.Address = txtNo.Text + " " + txtStreet.Text + " " + ddlCountry.SelectedValue + " " + txtZipCode.Text; cust.TIN = txtTIN.Text; cust.LastName = txtLastName.Text; cust.FirstName = txtFirstName.Text; cust.EmailAddress = txtEmail.Text; cust.JobTitle = ddlDesignation.Text; cust.BusinessPhone = txtTelephone.Text; cust.FaxNumber = txtFax.Text; cust.ZipPostal = txtZipCode.Text; cust.WebPage = txtWebsite.Text; BusinessRule.busCustomer custs = new BusinessRule.busCustomer(); custs.insertCustomer(cust); busCustomer buscust = new busCustomer(); DataTable dt = new DataTable("customer"); dt = buscust.allCustomer(); GridView1.DataSource = dt; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { busCustomer buscust = new busCustomer(); DataTable dt = new DataTable("User"); dt = buscust.allCustomer(); ViewState["Customer"] = dt; this.drpCustomer.Items.Clear(); this.drpCustomer.Items.Add(new ListItem("select one", "0")); foreach (DataRow dr in dt.Rows) { this.drpCustomer.Items.Add(new ListItem(dr["Company"].ToString(), dr["ID"].ToString())); } busProducts busProd = new busProducts(); dt = new DataTable("User"); dt = busProd.allProducts(); ViewState["Products"] = dt; this.drpProduct.Items.Clear(); this.drpProduct.Items.Add(new ListItem("select one", "0")); foreach (DataRow dr in dt.Rows) { this.drpProduct.Items.Add(new ListItem(dr["ProductName"].ToString(), dr["ID"].ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (!Page.IsPostBack) { BindCountry(); } if (!IsPostBack) { busCustomer buscust = new busCustomer(); DataTable dt = new DataTable("User"); dt = buscust.allCustomer(); GridView1.DataSource = dt; GridView1.DataBind(); } }