/// <summary> /// Sets datasources and bind data. /// </summary> private void Bind() { var repository = new CustomerRepository(); GridViewCustomers.DataSource = repository.GetCustomers(SortExpression); GridViewCustomers.DataBind(); }
/// <summary> /// Sets datasources and bind data. /// </summary> private void Bind() { CustomerController controller = new CustomerController(); GridViewCustomers.DataSource = controller.GetCustomers(SortExpression); GridViewCustomers.DataBind(); }
private void BindData() { Model model = new Model(); List <customer> customers = model.getAllCustomers(); GridViewCustomers.DataSource = customers; GridViewCustomers.DataBind(); }
void Load_GridData() { SqlConnection conn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["dbaseconnection"].ConnectionString); SqlCommand command = new SqlCommand("SELECT ORDERGENERAL.Order_Num, ORDERGENERAL.Cust_Num, ORDERGENERAL.Order_Date, CUSTOMER.Cust_LName, CUSTOMER.Cust_FName, CUSTOMER.Cust_MName, CUSTOMER.Cust_General_Balance, ORDERGENERAL.Total_Price, ORDERGENERAL.Cust_Order_CurrentBalance, ORDERGENERAL.CreditCard, ORDERGENERAL.CreditCardNum FROM ORDERGENERAL INNER JOIN CUSTOMER ON ORDERGENERAL.Cust_Num = CUSTOMER.Cust_Num ORDER BY ORDERGENERAL.Order_Date", conn); SqlDataAdapter daimages = new SqlDataAdapter(command); DataTable dt = new DataTable(); daimages.Fill(dt); GridViewCustomers.DataSource = dt; GridViewCustomers.DataBind(); GridViewCustomers.Attributes.Add("bordercolor", "black"); }
protected void btnEdit_Click(object sender, EventArgs e) { editUser.Visible = true; addMovies.Visible = false; addPeople.Visible = false; int id = Convert.ToInt32(drpDownListCustomers.SelectedItem.Value); Model model = new Model(); List <customer> customer = model.getAllCustomerById(id); GridViewCustomers.DataSource = customer; GridViewCustomers.DataBind(); }
void Load_GridData() { string sesionid = (string)(Session["OrderNum"]); SqlConnection conn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["dbaseconnection"].ConnectionString); SqlCommand command = new SqlCommand("SELECT PRODUCT.Product_Name, ORDER_ITEM.Product_Current_Price, ORDER_ITEM.Product_Order_Quantity, ORDER_ITEM.Percent_Deduction, ORDER_ITEM.Total_Amount FROM ORDER_ITEM INNER JOIN PRODUCT ON ORDER_ITEM.Product_Num = PRODUCT.Product_Num WHERE ORDER_ITEM.Order_Num = '" + sesionid.ToString() + "'", conn); SqlDataAdapter daimages = new SqlDataAdapter(command); DataTable dt = new DataTable(); daimages.Fill(dt); GridViewCustomers.DataSource = dt; GridViewCustomers.DataBind(); GridViewCustomers.Attributes.Add("bordercolor", "black"); }
protected void addNewCustomer(object sender, EventArgs e) { if (ViewState["CurrentTable"] != null) { DataTable dtCT = (DataTable)ViewState["CurrentTable"]; if (dtCT.Columns.Count == 0) { dtCT.Columns.Add("Name", typeof(string)); dtCT.Columns.Add("Party Number", typeof(int)); dtCT.Columns.Add("Wait Time", typeof(int)); } int numCus = Convert.ToInt32(PartyNumber.Text); int waitTimeC = waitTime(numCus); DataRow newRow = dtCT.NewRow(); newRow[0] = CustomerName.Text; newRow[1] = Convert.ToInt32(PartyNumber.Text); newRow[2] = waitTimeC; dtCT.Rows.Add(newRow); GridViewCustomers.DataSource = dtCT; GridViewCustomers.DataBind(); } }
protected void btnShow_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Rutvik Kikani\source\repos\ADODatabaseDemo\ADODatabaseDemo\App_Data\Test.mdf;Integrated Security=True"; try { using (con) { string command = "Select * from Customer"; SqlCommand cmd = new SqlCommand(command, con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); GridViewCustomers.DataSource = rdr; GridViewCustomers.DataBind(); rdr.Close(); } } catch (Exception ex) { Response.Write("Errors: " + ex.Message); } }
protected void drpDwnListOption_SelectedIndexChanged(object sender, EventArgs e) { switch (drpDwnListOption.SelectedValue) { case "addUsers": addMovies.Visible = false; addPeople.Visible = true; editUser.Visible = false; break; case "addMovies": addMovies.Visible = true; addPeople.Visible = false; editUser.Visible = false; break; case "editUsers": editUser.Visible = true; addMovies.Visible = false; addPeople.Visible = false; Model model = new Model(); List <customer> customers = model.getAllCustomers(); GridViewCustomers.DataSource = customers; GridViewCustomers.DataBind(); foreach (customer cust in customers) { ListItem item = new ListItem(cust.First_name + " " + cust.Last_name, Convert.ToString(cust.Customer_id), true); drpDownListCustomers.Items.Add(item); } break; default: break; } }