Ejemplo n.º 1
0
    protected void lbtnRegistrarSucursal_Click(object sender, EventArgs e)
    {
        bool respuesta = oclsSucursal.Registrar_Sucursal(txtNombreSucursal.Text, txtTelefonoSucursal.Text, txtDireccionSucursal.Text);

        if (respuesta)
        {
            lblmensageModal.Text      = "Se registro correctamente el almacén";
            txtNombreSucursal.Text    = "";
            txtTelefonoSucursal.Text  = "";
            txtDireccionSucursal.Text = "";
        }
        CargarSucursalesGv();
        CerrarModalUpdatePanel();
        AbrirModal();
        DropDownListSucursal.Items.Clear();
        DropDownListSucursal.DataSource = oclsSucursal.ListarSucursal();
        DropDownListSucursal.Items.Add(new ListItem("Seleccione", "0"));
        DropDownListSucursal.AppendDataBoundItems = true;
        // Hace el enlace al atributo que posee el valor, es decir, el value.
        DropDownListSucursal.DataValueField = "Almacén";
        // Hace el enlace al atributo que mostrara los datos, es decir, el Text.
        DropDownListSucursal.DataTextField = "Nombre Almacen";
        // Llena el DropDownList con los datos de la fuente de datos
        DropDownListSucursal.DataBind();
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Trae la fecha actual del servidor y se la asignamos al "txtFechaRegistro" del modal "Registrar cliente"
        txtFechaRegistro.Text    = System.DateTime.Now.ToString("dd/MM/yyyy");
        txtFechaRegistro.Enabled = false;
        lblRegistrado.Visible    = false;
        CargarSucursalesGv();
        listarEmpleados();

        //Metodo para listar los municipios
        //Metodo para cargar los municipios en un DropDownlist

        if (!Page.IsPostBack)
        {
            Dt_Ingreso = (DataTable)Session["dataTable"];
            if (Dt_Ingreso == null)
            {
                Response.Redirect("FrmLogin.aspx");
            }
            else
            {
                if (Dt_Ingreso.Rows[0][3].ToString().Equals("Vendedor"))
                {
                    Response.Redirect("FrmVentas.aspx");
                }
                DropDownListSucursal.Enabled = true;
                listarMunicipios();


                DropDownListSucursal.DataSource = oclsSucursal.ListarSucursal();
                DropDownListSucursal.Items.Add(new ListItem("Seleccione", "0"));
                DropDownListSucursal.AppendDataBoundItems = true;
                // Hace el enlace al atributo que posee el valor, es decir, el value.
                DropDownListSucursal.DataValueField = "Almacén";
                // Hace el enlace al atributo que mostrara los datos, es decir, el Text.
                DropDownListSucursal.DataTextField = "Nombre Almacen";
                // Llena el DropDownList con los datos de la fuente de datos
                DropDownListSucursal.DataBind();
                RadioButtonList1.SelectedValue = "Vendedor";
                RadioButtonList2.SelectedValue = "Habilitado";
            }
        }
    }