Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string constr = ConfigurationManager.ConnectionStrings["CadenaConexion"].ConnectionString;
                using (SqlConnection con = new SqlConnection(constr))
                {
                    using (SqlCommand CmdObtenerResponsables = new SqlCommand("ObtenerResponsable"))
                    {
                        CmdObtenerResponsables.Connection  = con;
                        CmdObtenerResponsables.CommandType = CommandType.StoredProcedure;
                        using (SqlDataAdapter sdaObtenerResponsables = new SqlDataAdapter(CmdObtenerResponsables))
                        {
                            DataTable dtObtenerResponsables = new DataTable();
                            sdaObtenerResponsables.Fill(dtObtenerResponsables);
                            DropResponsable.DataSource     = dtObtenerResponsables;
                            DropResponsable.DataTextField  = "NombreResponsable";
                            DropResponsable.DataValueField = "Id";
                            DropResponsable.DataBind();
                            DropResponsable.Items.Insert(0, "(Seleccionar)");
                        }
                    }
                }

                ObtenerResponsables();
                ObtenerDetalleResponsables();
            }
        }
Esempio n. 2
0
        /*
         * public void LlenarDropDownEstado()
         * {
         *  DropEstado.DataSource = consultar("SELECT * FROM ESTADO_TAREA");
         *  DropEstado.DataTextField = "ESTADO";
         *  DropEstado.DataValueField = "ID_ESTADO";
         *  DropEstado.DataBind();
         *  DropEstado.Items.Insert(0, new ListItem("[Seleccionar]", "[0]"));
         * }
         */

        public void LlenarDropDownResponsable()
        {
            DropResponsable.DataSource     = consultar("SELECT* FROM USUARIO WHERE ID_ROL = 2");
            DropResponsable.DataTextField  = "NOMBRE_USUARIO";
            DropResponsable.DataValueField = "RUN";
            DropResponsable.DataBind();
            DropResponsable.Items.Insert(0, new ListItem("[Selecionar]", "[0]"));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.User.Identity.IsAuthenticated)
            {
                FormsAuthentication.RedirectToLoginPage();
            }
            else
            {
                int TipoUsuario = Convert.ToInt32(Session["TipoUsuario"]);
                if (TipoUsuario == 3)
                {
                    DivBackOffice.Visible  = false;
                    DivCargarDatos.Visible = false;
                }
                else
                {
                    DivBackOffice.Visible  = true;
                    DivCargarDatos.Visible = true;
                }

                ObetnerOrdenes();
                ObetnerContadorOrdenes();

                try
                {
                    if (!IsPostBack)
                    {
                        using (SqlConnection con = new SqlConnection(strConnection))
                        {
                            using (SqlCommand CmdObtenerResponsables = new SqlCommand("ObtenerResponsable"))
                            {
                                CmdObtenerResponsables.Connection  = con;
                                CmdObtenerResponsables.CommandType = CommandType.StoredProcedure;
                                using (SqlDataAdapter sdaObtenerResponsables = new SqlDataAdapter(CmdObtenerResponsables))
                                {
                                    DataTable dtObtenerResponsables = new DataTable();
                                    sdaObtenerResponsables.Fill(dtObtenerResponsables);
                                    DropResponsable.DataSource     = dtObtenerResponsables;
                                    DropResponsable.DataTextField  = "NombreResponsable";
                                    DropResponsable.DataValueField = "Id";
                                    DropResponsable.DataBind();
                                    DropResponsable.Items.Insert(0, "(Seleccionar)");
                                }
                            }
                        }
                        using (SqlConnection con = new SqlConnection(strConnection))
                        {
                            using (SqlCommand CmdObtenerDepartamentos = new SqlCommand("ObtenerDepartamentos"))
                            {
                                CmdObtenerDepartamentos.Connection  = con;
                                CmdObtenerDepartamentos.CommandType = CommandType.StoredProcedure;
                                using (SqlDataAdapter sdaObtenerDepartamentos = new SqlDataAdapter(CmdObtenerDepartamentos))
                                {
                                    DataTable dtObtenerDepartamentos = new DataTable();
                                    sdaObtenerDepartamentos.Fill(dtObtenerDepartamentos);
                                    DropDepartamento.DataSource     = dtObtenerDepartamentos;
                                    DropDepartamento.DataTextField  = "NombreDepartamento";
                                    DropDepartamento.DataValueField = "Id";
                                    DropDepartamento.DataBind();
                                    DropDepartamento.Items.Insert(0, "(Seleccionar)");
                                }
                            }
                        }
                        using (SqlConnection con = new SqlConnection(strConnection))
                        {
                            using (SqlCommand CmdObtenerBackOffice = new SqlCommand("ObtenerBackOffice"))
                            {
                                CmdObtenerBackOffice.Connection  = con;
                                CmdObtenerBackOffice.CommandType = CommandType.StoredProcedure;
                                using (SqlDataAdapter DaObtenerBackOffice = new SqlDataAdapter(CmdObtenerBackOffice))
                                {
                                    DataTable DtObtenerBackOffice = new DataTable();
                                    DaObtenerBackOffice.Fill(DtObtenerBackOffice);
                                    DropBuscarBackoffice.DataSource    = DtObtenerBackOffice;
                                    DropBuscarBackoffice.DataTextField = "Backoffice";
                                    DropBuscarBackoffice.DataBind();
                                    DropBuscarBackoffice.Items.Insert(0, "(Seleccionar)");
                                }
                            }
                        }

                        using (SqlConnection con = new SqlConnection(strConnection))
                        {
                            using (SqlCommand CmdObtenerBackOffice = new SqlCommand("ObtenerProyeccion"))
                            {
                                CmdObtenerBackOffice.Connection  = con;
                                CmdObtenerBackOffice.CommandType = CommandType.StoredProcedure;
                                using (SqlDataAdapter DaObtenerBackOffice = new SqlDataAdapter(CmdObtenerBackOffice))
                                {
                                    DataTable DtObtenerBackOffice = new DataTable();
                                    DaObtenerBackOffice.Fill(DtObtenerBackOffice);
                                    DropProyeccion.DataSource    = DtObtenerBackOffice;
                                    DropProyeccion.DataTextField = "Proyeccion";
                                    DropProyeccion.DataBind();
                                    DropProyeccion.Items.Insert(0, "(Seleccionar)");
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterStartupScript(GetType(), "hwa", "alert('" + ex.Message + "');", true);
                }
            }
        }