Exemple #1
0
 private void Borrar()
 {
     try
     {
         oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200104");
         if (oFuncion.Err)
         {
             MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
             return;
         }
         else
         {
             if (MessageBox.Show("Esta seguro de Borrar este Registro", "Atencion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 App_Code.Sistema.Sistema_Funciones oRegistro = new App_Code.Sistema.Sistema_Funciones(int.Parse(this.lblFicha.Text.ToString()));
                 oRegistro.Estatus = "Bloqueado";
                 oRegistro.Actualizar();
                 this.Nuevo();
                 MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        private void Guardar()
        {
            App_Code.Sistema.Sistema_Funciones oRegistro = new App_Code.Sistema.Sistema_Funciones(int.Parse(this.lblFicha.Text));

            oRegistro.Codigo   = this.txtCodigo.Text.ToString();
            oRegistro.Nombre   = this.txtNombre.Text.ToString();
            oRegistro.ModuloId = int.Parse(this.cmbModulo.SelectedValue.ToString());
            oRegistro.Estatus  = this.cmbEstatus.SelectedItem.ToString();

            try
            {
                if (!Validar())
                {
                    if (oRegistro.Err)
                    {
                        oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200102");
                        if (oFuncion.Err)
                        {
                            MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }
                        else
                        {
                            oRegistro.Insertar();
                        }
                    }
                    else
                    {
                        oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200103");
                        if (oFuncion.Err)
                        {
                            MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }
                        else
                        {
                            oRegistro.Actualizar();
                        }
                    }
                    MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Consulta();
                    this.Presentar(oRegistro.Id);
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #3
0
        private bool Validar()
        {
            if (this.txtCodigo.Text.Length == 0)
            {
                this.txtCodigo.BackColor = Color.Red;
                MessageBox.Show("Disculpe ingrese un codigo", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(true);
            }
            if (this.txtNombre.Text.Length == 0)
            {
                this.txtNombre.BackColor = Color.Red;
                MessageBox.Show("Disculpe ingrese un nombre", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(true);
            }
            if (this.lblFicha.Text == "0")
            {
                DataTable oTabla = new App_Code.Sistema.Sistema_Funciones().Buscar(
                    1,
                    "id",
                    "codigo = '" + this.txtCodigo.Text + "'",
                    "");
                if (oTabla.Rows.Count > 0)
                {
                    this.txtCodigo.BackColor = Color.Red;
                    MessageBox.Show("Disculpe ya el codigo existe", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(true);
                }
            }
            else
            {
                DataTable oTabla = new App_Code.Sistema.Sistema_Funciones().Buscar(
                    1,
                    "id",
                    "(codigo = '" + this.txtCodigo.Text + "') AND (id <> '" + this.lblFicha.Text + "')",
                    "");
                if (oTabla.Rows.Count > 0)
                {
                    this.txtCodigo.BackColor = Color.Red;
                    MessageBox.Show("Disculpe ya el usuario existe", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(true);
                }
            }



            return(false);
        }
Exemple #4
0
        private void Presentar(int id)
        {
            App_Code.Sistema.Sistema_Funciones oRegistro = new App_Code.Sistema.Sistema_Funciones(id);
            App_Code.Sistema.Sistema_Modulos   oModulo   = new App_Code.Sistema.Sistema_Modulos(oRegistro.ModuloId);
            App_Code.Sistema.Sistema_Grupos    oGrupo    = new App_Code.Sistema.Sistema_Grupos(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario);
            this.lblFicha.Text       = oRegistro.Id.ToString("0");
            this.txtCodigo.Text      = oRegistro.Codigo.ToString();
            this.txtNombre.Text      = oRegistro.Nombre.ToString();
            this.cmbModulo.Text      = oModulo.Nombre;
            this.cmbEstatus.Text     = oRegistro.Estatus;
            this.txtCodigo.Enabled   = false;
            this.txtCodigo.BackColor = Color.White;
            this.txtNombre.BackColor = Color.White;

            if (oGrupo.Codigo == "00004")
            {
                this.txtCodigo.Enabled = true;
            }
            oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "1200104");
            if (!oFuncion.Err)
            {
                this.btnEliminar.Enabled = true;
            }
        }