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);
                }
            }
        }