示例#1
0
        private void InsertarActualizar(string modo)
        {
            try
            {
                if (modo == "INSERT")
                {
                    Grado grado = new Grado();
                    grado.Nombre = TxtNombre.Text.Trim();
                    grado.Numero = Convert.ToInt32(TxtNumero.Text.Trim());

                    if (CtrlGrados.Insertar(grado) > 0)
                    {
                        XtraMessageBox.Show("Grado insertado con exito.", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                    }
                }
                else
                {
                    Grado grado = new Grado();
                    grado.Id     = Id;
                    grado.Nombre = TxtNombre.Text.Trim();
                    grado.Numero = Convert.ToInt32(TxtNumero.Text.Trim());

                    if (CtrlGrados.Actualizar(grado) > 0)
                    {
                        XtraMessageBox.Show("Grado actualizado con exito.", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
            }
        }
示例#2
0
        public void Eliminar()
        {
            if (DgvGeneral.RowCount > 0 && DgvGeneral.GetFocusedRow() != null)
            {
                int   idGeneral = Convert.ToInt32(DgvGeneral.GetFocusedRowCellValue("Id"));
                Grado grado     = new Grado();
                grado.Id = idGeneral;


                if (XtraMessageBox.Show("¿Esta seguro que desea eliminar el grado?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    CtrlGrados.Eliminar(grado);

                    if (!BkgwBuscar.IsBusy)
                    {
                        PrgBuscar.Visible = true;
                        BkgwBuscar.RunWorkerAsync();
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("Debe seleccionar un registro.", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#3
0
        private void CargarDatos(int id)
        {
            Grado gr = new Grado();

            gr.Id = id;
            DataSet ds = CtrlGrados.GetGradoOne(gr);
            DataRow dr = ds.Tables[0].Rows[0];

            TxtNombre.Text = dr["Nombre"].ToString();
            TxtNumero.Text = dr["Numero"].ToString();
        }
示例#4
0
        public void LlenarDsConsulta()
        {
            try
            {
                DataSet ds = CtrlGrados.GetGradoAll();

                dtConsulta = ds.Tables[0].Copy();
                dsConsulta.Tables.Clear();
                if (dsConsulta.Tables.Count == 0)
                {
                    dsConsulta.Tables.Add(dtConsulta);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
示例#5
0
        private void FrmGetCursos_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable dt1 = CtrlGrados.GetGradoAll().Tables[0];

                LueGrado.Properties.DataSource    = dt1;
                LueGrado.Properties.DisplayMember = "Nombre";
                LueGrado.Properties.ValueMember   = "CodigoGrado";

                DevExpress.XtraEditors.Controls.LookUpColumnInfo col;
                col = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Nombre", "Nombre", 100);
                LueGrado.Properties.Columns.Add(col);
                LueGrado.ItemIndex = -1;

                DataTable dt2 = CtrlGrupos.GetGrupoAll().Tables[0];
                LueGrupo.Properties.DataSource    = dt2;
                LueGrupo.Properties.DisplayMember = "Nombre";
                LueGrupo.Properties.ValueMember   = "CodigoGrupo";

                DevExpress.XtraEditors.Controls.LookUpColumnInfo col1;
                col1 = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Nombre", "Nombre", 100);
                LueGrupo.Properties.Columns.Add(col);
                LueGrupo.ItemIndex = -1;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                return;
            }

            TxtNombre.Focus();
            if (Modo == "E" && Id > 0)
            {
                CargarDatos(Id);
            }
        }