/// <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) { Products products = new Products(); Users users = new Users(); DataTable data, data2; data = users.getAllSellers(); if (data != null && data.Rows.Count > 0) { showNotification[0] = false; } else { showNotification[0] = true; } data2 = products.getAllProducts(); 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 vendedores ni productos"); } else if (showNotification[0] && !showNotification[1]) { this.hideForm = true; this.setNotification("error", "¡Ooooops!", "No hay vendedores"); } else if (!showNotification[0] && showNotification[1]) { this.hideForm = true; this.setNotification("error", "¡Ooooops!", "No hay productos"); } 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 vendedor"); GridView1.DataSource = data2; GridView1.DataBind(); } } }
/// <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(); } } }