private void Page_Load(object sender, System.EventArgs e)
        {
            #region IsAuthenticated
            if (Session["Usuario"] != null)
            {
                usuario = (IUsuarios)Session["Usuario"];
            }

            if (User.Identity.IsAuthenticated)
            {
                string sOpcion = "categoriaPersonalConsulMasiva";
                Menu   oMenu   = (Menu)this.FindControl("Menu1");
                this.ValidarSeguridad(oMenu, sOpcion);
            }
            #endregion

            if (!Page.IsPostBack)
            {
                Session["Personal"] = null;
                txtCategoriaID.Text = Request.QueryString["CategoriaID"];
                ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();
                categoria.CategoriaID = Utiles.Validaciones.obtieneEntero(txtCategoriaID.Text);
                categoria.Consultar();
                lblDescripcion.Text = categoria.Descripcion;
                BindGrid();
            }
            lblCategoria.Text = "Categoría";
        }
 private void BindGrid()
 {
     try
     {
         ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();
         categoria.CategoriaID = Utiles.Validaciones.obtieneEntero(txtCategoriaID.Text);
         AdministrarGrillas.Configurar(dtgPersonal, "PersonalID", CantidadOpciones, true, false);
         dtgPersonal.CurrentPageIndex = Utiles.Validaciones.obtieneEntero(txtPagina.Text);
         DsPersonal ds = new DsPersonal();
         //if(Session["Personal"] == null)
         ds = categoria.GetPersonal(txtLegajo.Text, txtNombre.Text, txtApellido.Text);
         //else
         //	ds = (DsPersonal)Session["Personal"];
         foreach (DataGridItem item in dtgPersonal.Items)
         {
             DsPersonal.DatosRow dr  = (DsPersonal.DatosRow)ds.Datos.Rows[item.DataSetIndex];
             CheckBox            chk = (CheckBox)item.FindControl("chkAsigando");
             dr.Asignado = chk.Checked;
         }
         Session["Personal"]    = ds;
         dtgPersonal.DataSource = ds.Datos;
         dtgPersonal.DataBind();
     }
     catch (Exception ex)
     {
         ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message);
     }
 }
 private void butGuardar_Click(object sender, System.EventArgs e)
 {
     #region Validadores
     BaseValidator bv;
     bv         = (BaseValidator)phDescripcion.FindControl("descripcionReq");
     bv.Enabled = true;
     bv.Validate();
     if (!bv.IsValid)
     {
         return;
     }
     bv         = (BaseValidator)phNivel.FindControl("nivelReq");
     bv.Enabled = true;
     bv.Validate();
     if (!bv.IsValid)
     {
         return;
     }
     bv         = (BaseValidator)phNivel.FindControl("nivelValid");
     bv.Enabled = true;
     if (!bv.IsValid)
     {
         return;
     }
     #endregion
     try
     {
         BindGridObjetivos();
         ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();
         categoria.CategoriaID       = Utiles.Validaciones.obtieneEntero(txtCategoriaID.Text);
         categoria.Descripcion       = txtDescripcion.Text;
         categoria.Nivel             = Utiles.Validaciones.obtieneEntero(txtNivel.Text);
         categoria.DependenciaID     = Utiles.Validaciones.obtieneEntero(Categoria1.CategoriaID);
         categoria.EsEjecutivoCuenta = chkEsEjecutivo.Checked;
         DsObjetivoIncentivoDescrip ds = new DsObjetivoIncentivoDescrip();
         DataSet dsObjetivo            = (DataSet)Session["Objetivos"];
         foreach (DataRow drObjetivo in dsObjetivo.Tables[0].Select("Chk = True"))
         {
             DsObjetivoIncentivoDescrip.DatosRow dr = ds.Datos.NewDatosRow();
             dr.ObjetivoIncentivoID      = Convert.ToInt32(drObjetivo["ObjetivoIncentivoID"]);
             dr.ObjetivoIncentivoDescrip = drObjetivo["ObjetivoIncentivoDescrip"].ToString();
             ds.Datos.AddDatosRow(dr);
         }
         categoria.DsObejtivos = ds;
         categoria.Guardar();
         if (txtCategoriaID.Text != "")
         {
             Response.Redirect("CategoriaPersonalConsul.aspx");
         }
         else
         {
             Response.Redirect("CategoriaPersonal.aspx");
         }
     }
     catch (Exception ex)
     {
         ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message);
     }
 }
Esempio n. 4
0
        private void BindGrid()
        {
            AdministrarGrillas.Configurar(dtgCategoria, "CategoriaID", CantidadOpciones, true, false);
            ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();

            categoria.Nivel               = Utiles.Validaciones.obtieneEntero(txtNivel.Text);
            categoria.Descripcion         = txtCategoria.Text;
            dtgCategoria.CurrentPageIndex = Utiles.Validaciones.obtieneEntero(txtPagina.Text);
            dtgCategoria.DataSource       = categoria.GetCategorias();
            dtgCategoria.DataBind();
        }
Esempio n. 5
0
 private void dtgCategoria_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();
         categoria.CategoriaID = Utiles.Validaciones.obtieneEntero(e.Item.Cells[0].Text);
         categoria.Eliminar();
         BindGrid();
     }
     catch (Exception ex)
     {
         ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message);
     }
 }
 private void BindGridObjetivos()
 {
     try
     {
         AdministrarGrillas.Configurar(dtgObjetivos, "ObjetivoIncentivoID", CantidadOpciones, true, false);
         ICategoriaPersonal categoria   = CategoriaPersonalFactory.GetCategoriaPersonalFactory();
         DataSet            dsObjetivos = new DataSet();
         if (Session["Objetivos"] == null)
         {
             DsObjetivoIncentivoDescrip ds = categoria.GetObjetivos();
             dsObjetivos.Tables.Add();
             dsObjetivos.Tables[0].Columns.Add("ObjetivoIncentivoID");
             dsObjetivos.Tables[0].Columns.Add("ObjetivoIncentivoDescrip");
             dsObjetivos.Tables[0].Columns.Add("Chk");
             foreach (DsObjetivoIncentivoDescrip.DatosRow dr in ds.Datos)
             {
                 DataRow drObjetivo = dsObjetivos.Tables[0].NewRow();
                 drObjetivo["ObjetivoIncentivoID"]      = dr.ObjetivoIncentivoID;
                 drObjetivo["ObjetivoIncentivoDescrip"] = dr.ObjetivoIncentivoDescrip;
                 drObjetivo["Chk"] = false;
                 dsObjetivos.Tables[0].Rows.Add(drObjetivo);
             }
         }
         else
         {
             dsObjetivos = (DataSet)Session["Objetivos"];
             if (txtCategoriaID.Text == "" || txtPrimero.Text != "")
             {
                 foreach (DataGridItem item in dtgObjetivos.Items)
                 {
                     DataRow  drObjetivo = (DataRow)dsObjetivos.Tables[0].Rows[item.DataSetIndex];
                     CheckBox chk        = (CheckBox)item.FindControl("chkObjetivo");
                     drObjetivo["Chk"] = chk.Checked;
                 }
             }
             txtPrimero.Text = "N";
         }
         Session["Objetivos"]          = dsObjetivos;
         dtgObjetivos.CurrentPageIndex = Utiles.Validaciones.obtieneEntero(txtPagina.Text);
         dtgObjetivos.DataSource       = dsObjetivos.Tables[0];
         dtgObjetivos.DataBind();
     }
     catch (Exception ex)
     {
         ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message);
     }
 }
 private void BindGrid()
 {
     try
     {
         SisPackController.AdministrarGrillas.Configurar(dtgCategoriaPersonal, "CategoriaID", 20, true, false);
         ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();
         categoria.Nivel       = Utiles.Validaciones.obtieneEntero(txtNivel.Text);
         categoria.Descripcion = txtDescripcion.Text;
         DsCategoriaPersonal ds = categoria.GetCategorias();
         dtgCategoriaPersonal.DataSource       = ds;
         dtgCategoriaPersonal.CurrentPageIndex = Utiles.Validaciones.obtieneEntero(txtPagina.Text);
         dtgCategoriaPersonal.DataBind();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
 private void Buscar()
 {
     try
     {
         ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();
         categoria.Nivel       = Utiles.Validaciones.obtieneEntero(nivel);
         categoria.Descripcion = descripcion;
         DsCategoriaPersonal ds = categoria.GetCategorias();
         if (ds.Datos.Count == 1)
         {
             foreach (DsCategoriaPersonal.DatosRow dr in ds.Datos)
             {
                 txtNivel.Text       = dr.Nivel.ToString();
                 txtDescripcion.Text = dr.Descripcion;
                 txtCategoriaID.Text = dr.CategoriaID.ToString();
                 txtEjecutivo.Text   = dr.EsEjecutivoCuenta.ToString();
                 txtErrorMsg.Text    = "";
                 txtOpen.Text        = "";
             }
         }
         else if (ds.Datos.Count > 1)
         {
             txtNivel.Text       = nivel;
             txtDescripcion.Text = descripcion;
             txtCategoriaID.Text = "";
             txtOpen.Text        = "S";
         }
         else
         {
             txtCategoriaID.Text = "";
             txtNivel.Text       = nivel;
             txtDescripcion.Text = descripcion;
             txtEjecutivo.Text   = "";
             txtErrorMsg.Text    = "No se encontraron datos";
             txtOpen.Text        = "";
         }
     }
     catch (Exception ex)
     {
         txtErrorMsg.Text = "Error al consultar datos " + ex.Message;
     }
 }
        private void CargarDatos()
        {
            ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();

            categoria.CategoriaID = Utiles.Validaciones.obtieneEntero(txtCategoriaID.Text);
            categoria.Consultar();
            txtDescripcion.Text    = categoria.Descripcion;
            txtNivel.Text          = categoria.Nivel.ToString();
            chkEsEjecutivo.Checked = categoria.EsEjecutivoCuenta;
            Categoria1.CategoriaID = categoria.DependenciaID.ToString();
            Categoria1.Nivel       = categoria.NivelDependenciaID.ToString();
            Categoria1.Descripcion = categoria.Depende;
            DataSet dsObjetivos            = new DataSet();
            DsObjetivoIncentivoDescrip ds  = categoria.GetObjetivos();
            DsObjetivoIncentivoDescrip dsA = categoria.DsObejtivos;

            dsObjetivos.Tables.Add();
            dsObjetivos.Tables[0].Columns.Add("ObjetivoIncentivoID");
            dsObjetivos.Tables[0].Columns.Add("ObjetivoIncentivoDescrip");
            dsObjetivos.Tables[0].Columns.Add("Chk");
            foreach (DsObjetivoIncentivoDescrip.DatosRow dr in ds.Datos)
            {
                DataRow drObjetivo = dsObjetivos.Tables[0].NewRow();
                drObjetivo["ObjetivoIncentivoID"]      = dr.ObjetivoIncentivoID;
                drObjetivo["ObjetivoIncentivoDescrip"] = dr.ObjetivoIncentivoDescrip;
                DsObjetivoIncentivoDescrip.DatosRow drA = dsA.Datos.FindByObjetivoIncentivoID(dr.ObjetivoIncentivoID);
                if (drA != null)
                {
                    drObjetivo["Chk"] = true;
                }
                else
                {
                    drObjetivo["Chk"] = false;
                }
                dsObjetivos.Tables[0].Rows.Add(drObjetivo);
            }
            Session["Objetivos"] = dsObjetivos;
        }
Esempio n. 10
0
        private void ValidarEjecutivo(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
        {
            ICategoriaPersonal categoria = CategoriaPersonalFactory.GetCategoriaPersonalFactory();

            categoria.CategoriaID = Utiles.Validaciones.obtieneEntero(Categoria1.CategoriaID);
            categoria.Consultar();
            if (categoria.EsEjecutivoCuenta && (rbtExterno.Checked || rbtInterno.Checked))
            {
                args.IsValid = true;
                return;
            }
            else if (!categoria.EsEjecutivoCuenta)
            {
                args.IsValid = true;
                return;
            }
            else
            {
                args.IsValid = false;
                ((CustomValidator)source).ErrorMessage = "Debe seleccionar un tipo de ejecutivo de cuentas, es obligatorio";
                return;
            }
        }