Пример #1
0
        protected void Desplegar_CATEGORIAS()
        {
            DB_Usuario          r      = new DB_Usuario();
            List <VT_Categoria> listaR = r.DB_Desplegar_CATEGORIA();

            DDLCategoria.DataSource     = listaR;
            DDLCategoria.DataValueField = "Id_Categoria";
            DDLCategoria.DataTextField  = "Nombre_Categoria";
            DDLCategoria.DataBind();
            //DDLCategoria.Items.Insert(0, new ListItem("Seleccione la Regional", "0", true));
        }
Пример #2
0
        private void Buscar_USUARIO(string idUsiario)
        {
            DataTable  us  = new DataTable();
            DB_Usuario nus = new DB_Usuario();

            us = nus.DB_Desplegar_USUARIO(Convert.ToInt32(LblIdRegional.Text), idUsiario, "USUARIO");
            if (us.Rows.Count != 0)
            {
                //if (us.Rows[0][0].ToString() == idUsiario)
                if (!string.IsNullOrEmpty(us.Rows[0][0].ToString()))
                {
                    //LblIdUsuario.Text = idUsiario;
                    LblIdUsuario.Text = us.Rows[0][0].ToString();
                    TxtCargo.Text     = us.Rows[0][5].ToString();
                    Cargo_Usuario     = us.Rows[0][5].ToString();//luis.rojas 24-05-2016
                    //*ini* lrojas: 03102016
                    //DDLRol.Items.Insert(0, new ListItem(us.Rows[0][8].ToString(), us.Rows[0][3].ToString(), true));
                    //DDLRol.DataBind();
                    //DDLCategoria.Items.Insert(0, new ListItem(us.Rows[0][9].ToString(), us.Rows[0][4].ToString(), true));
                    //DDLCategoria.DataBind();
                    //DDLEstado.Items.Insert(0, new ListItem(us.Rows[0][7].ToString(), us.Rows[0][7].ToString(), true));
                    //DDLEstado.DataBind();
                    DB_Usuario   r                = new DB_Usuario();
                    List <Roles> listaR           = r.DB_Obtener_Roles();
                    string       Sis_Seleccionado = listaR.Where(s => s.Id_Rol == Convert.ToInt32(us.Rows[0][3].ToString())).FirstOrDefault().Rol;
                    DDLSistema.SelectedValue = Sis_Seleccionado;
                    Desplegar_ROLES();
                    DDLRol.SelectedValue       = us.Rows[0][3].ToString();
                    DDLCategoria.SelectedValue = us.Rows[0][4].ToString();
                    DDLEstado.SelectedValue    = us.Rows[0][7].ToString();
                    DataTable DT_UsEst = new DataTable();
                    DT_UsEst             = r.DB_Obtener_UsuarioEstructura(idUsiario);
                    DDLSup.SelectedValue = DT_UsEst.Rows[0][0].ToString();
                    EventArgs e      = new EventArgs();
                    object    sender = new object();
                    DDLSup_SelectedIndexChanged(sender, e);
                    //*fin*
                    Buscar_CUENTAUSUARIO(idUsiario);
                }
                else
                {
                    limparCampos_PERSONA();
                }
            }
            else
            {
                LblIdUsuario.Text = string.Empty;
                TxtCargo.Text     = string.Empty;
                //DDLRol.Items.Insert(0, new ListItem(us.Rows[0][8].ToString(), us.Rows[0][3].ToString(), true));
                DDLRol.DataBind();
                //DDLCategoria.Items.Insert(0, new ListItem(us.Rows[0][9].ToString(), us.Rows[0][4].ToString(), true));
                DDLCategoria.DataBind();
            }
        }
Пример #3
0
 private void RellenarComboCategorias()
 {
     try
     {
         DDLCategoria.DataSource     = NegProductos.ListaCategorias();
         DDLCategoria.DataValueField = "IdCategoria";
         DDLCategoria.DataTextField  = "Nombre";
         DDLCategoria.DataBind();
     }
     catch (Exception ex)
     {
         LblMensaje.Text = ex.Message;
     }
 }
        private bool validarCampos(string tipo)
        {
            bool b = false;

            try
            {
                LogisticaN objBuscar = new LogisticaN();
                string     xcodigo   = TxtCod.Text.Trim();

                if (tipo == "insert")
                {
                    DataTable DTILogistica = objBuscar.BuscarLogistica(xcodigo);

                    if (DTILogistica.Rows.Count > 0)
                    {
                        TxtCod.Focus();
                        throw new Exception("El Codigo ya Existe");
                    }
                }
                else
                {
                    if (TxtCod.Text.Trim() != TxtCodigo.Text.Trim())
                    {
                        if (objBuscar.fun_validar_noRepetir_cod(xcodigo) > 0)
                        {
                            TxtCod.Focus();
                            throw new Exception("El Codigo ya Existe");
                        }
                    }
                }

                if (String.IsNullOrEmpty(TxtCod.Text))
                {
                    TxtCod.Focus();
                    throw new Exception("Ingrese el código");
                }

                if (String.IsNullOrEmpty(TxtDescripcion.Text))
                {
                    TxtDescripcion.Focus();
                    throw new Exception("Ingrese Descripción");
                }
                if (DDLSede.SelectedIndex == 0)
                {
                    DDLSede.Focus();
                    throw new Exception("Seleccione Sede");
                }

                if (String.IsNullOrEmpty(TxtArea.Text))
                {
                    TxtArea.Focus();
                    throw new Exception("Ingrese Area");
                }

                if (String.IsNullOrEmpty(TxtPiso.Text))
                {
                    TxtPiso.Focus();
                    throw new Exception("Ingrese Piso");
                }

                if (String.IsNullOrEmpty(txtEdificio.Text))
                {
                    txtEdificio.Focus();
                    throw new Exception("Ingrese Edificio");
                }

                if (String.IsNullOrEmpty(txtUsu.Text))
                {
                    txtUsu.Focus();
                    throw new Exception("Asigne un Usuario");
                }

                if (DDLCategoria.SelectedIndex == 0)
                {
                    DDLCategoria.Focus();
                    throw new Exception("Seleccione Categoria");
                }


                if (tipo == "insert")
                {
                    validar_campos_ruc();
                }
                else
                {
                    if (DateTime.Parse(hdFecha.Value) > DateTime.Parse("2018-12-31"))
                    {
                        validar_campos_ruc();
                    }
                }

                b = true;
                return(b);
            }
            catch (Exception ex)
            {
                this.Page.Response.Write("<script language ='JavaScript'>window.alert('" + ex.Message + "');</script>");
                return(false);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    CategoriaN objN   = new CategoriaN();
                    CondicionN ObjCon = new CondicionN();

                    if (!String.IsNullOrEmpty(this.Request.QueryString["cod"]))
                    {
                        var cod = this.Request.QueryString["cod"];
                        TxtCodigo.Text = cod;
                    }

                    //if (Session["Perfil"] == null)
                    //{
                    //    return;
                    //}

                    //if (int.Parse(Session["Perfil"].ToString()) == 3) // si es perfil vigilancia
                    //{
                    //    this.Page.Response.Write("<script language ='JavaScript'>window.alert('<<Acceso Denegado>>');</script>");
                    //    Response.Redirect("~/login.aspx");

                    //}

                    // DateTime fecha = DateTime.Now;


                    //TxtFecha.Text = fecha.ToShortDateString();
                    //Listar Categoria
                    DDLCategoria.DataTextField  = "Descripcion";
                    DDLCategoria.DataValueField = "IdCategoria";
                    DDLCategoria.DataSource     = objN.ListarCategoria();
                    DDLCategoria.DataBind();
                    DDLCategoria.Items.Insert(0, " ----------------- Seleccione ----------------- ");
                    //Listar Sede
                    DDLSede.DataTextField  = "Descripcion";
                    DDLSede.DataValueField = "IdSede";
                    DDLSede.DataSource     = ObjSede.ListarSede("partida");
                    DDLSede.DataBind();
                    DDLSede.Items.Insert(0, " ----------------- Seleccione ----------------- ");
                    TxtCodigo.Focus();
                    //Listar Condicion
                    DDLCondicion.DataTextField  = "Descripcion";
                    DDLCondicion.DataValueField = "IdCondicion";
                    DDLCondicion.DataSource     = ObjCon.ListarCondicion();
                    DDLCondicion.DataBind();
                    //DDLCondicion.Items.Insert(0, " ----------------- Seleccione ----------------- ");
                    Bloquear();

                    columnasGrid();
                }
                else
                {
                    dt = (DataTable)ViewState["dt"];
                }
            }
            catch (Exception ex)
            {
                this.Page.Response.Write("<script language ='JavaScript'>window.alert('" + ex.Message + "');</script>");
            }
        }