/// <summary> /// Method which loads the gridview with all the Routes. /// </summary> protected void loadGridView() { Routes route = new Routes(); GridView1.DataSource = route.getAllRoutes(); GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { try { Routes route = new Routes(); DataTable dt; dt = route.getAllRoutes(); if (dt != null && dt.Rows.Count == 1) { showData = true; this.routeid = dt.Rows[0].ItemArray[0].ToString(); this.name = dt.Rows[0].ItemArray[1].ToString(); DetailsView1.DataSource = dt; DetailsView1.DataBind(); Customers customers = new Customers(); dt = customers.getCustomersAndAddressesByRoute(Convert.ToInt16(this.routeid)); if (dt != null && dt.Rows.Count > 0) { GridView1.DataSource = dt; GridView1.DataBind(); this.setNotification("nothing"); } } else { showData = false; this.setNotification("error", "No hay ruta asignada", "Todavía no te es asignada una ruta..."); } } catch (Exception ex) { this.setNotification("error", "No hay ruta asignada", "Todavía no te es asignada una ruta"); } }
/// <summary> /// Load the page and make some validations /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Routes routes = new Routes(); Users users = new Users(); DataTable data, data2, data3; data = routes.getAllRoutes(); if (data != null && data.Rows.Count > 0) { showNotification[0] = false; } else { showNotification[0] = true; } data2 = users.getAllSellers(); if (data2 != null && data2.Rows.Count > 0) { showNotification[1] = false; } else { showNotification[1] = true; } if (showNotification[0] && showNotification[1]) { this.hideForm = true; this.setNotification("error", "¡Ooooops!", "No hay ni rutas ni clientes"); } else if (showNotification[0] && !showNotification[1]) { this.hideForm = true; this.setNotification("error", "¡Ooooops!", "No hay rutas creadas"); } else if (!showNotification[0] && showNotification[1]) { this.hideForm = true; this.setNotification("error", "¡Ooooops!", "No hay vendedores"); } else if (!showNotification[0] && !showNotification[1]) { this.hideForm = false; this.setNotification("nothing"); DropDownList1.DataSource = data; DropDownList1.DataTextField = "Nombre"; DropDownList1.DataValueField = "ID"; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, "Selecciona una ruta"); DropDownList2.DataSource = data2; DropDownList2.DataTextField = "Nombre"; DropDownList2.DataValueField = "ID"; DropDownList2.DataBind(); DropDownList2.Items.Insert(0, "Selecciona un vendedor"); this.loadAssignedRoutes(); } } }