Esempio n. 1
0
 private void cleanForm()
 {
     FormUtils.clearTextbox(textControls());
     rdbFemale.Checked  = true;
     rdbMale.Checked    = false;
     btnSaveModify.Text = "Guardar";
     selectedSection    = null;
     errorProvider.Clear();
 }
Esempio n. 2
0
 private void fillSelectedData(Seccione currentSection)
 {
     txtName.Text       = currentSection.Nombre;
     txtGroup.Text      = currentSection.Descripcion;
     txtStartRange.Text = currentSection.rangoInicio.ToString();
     txtEndRange.Text   = currentSection.rangoFin.ToString();
     chbStatus.Checked  = currentSection.baja;
     rdbFemale.Checked  = currentSection.sexo.ToUpper() == "F";
     rdbMale.Checked    = currentSection.sexo.ToUpper() == "M";
 }
Esempio n. 3
0
        public Seccione RetrieveByIdSeccion(string idSeccion)
        {
            Seccione Result = null;

            using (var r = new Repositorio <Seccione>())
            {
                Result = r.Retrieve(p => p.idSeccion == idSeccion);
            }

            return(Result);
        }
Esempio n. 4
0
        private void updateData(Seccione currentSection)
        {
            Operation <Seccione> operation = sectionController.updateRecord(currentSection);

            if (operation.State)
            {
                MessageBox.Show("Seccion actualizada con exito");
                loadTable();
                cleanForm();
            }
            else
            {
                MessageBox.Show(operation.Error);
            }
        }
Esempio n. 5
0
 private void dgvSections_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try {
         int index = e.RowIndex;
         if (index >= 0)
         {
             selectedSection    = sections[index];
             btnSaveModify.Text = "Modificar";
             fillSelectedData(selectedSection);
         }
     }
     catch (Exception ex)
     {
         FormUtils.defaultErrorMessage(ex);
     }
 }
Esempio n. 6
0
        public bool Update(Seccione seccione)
        {
            bool Result = false;

            using (var r = new Repositorio <Seccione>())
            {
                Seccione item = r.Retrieve(p => p.seccion == seccione.seccion && p.casilla == seccione.casilla && p.idSeccion != seccione.idSeccion);
                if (item == null)
                {
                    Result = r.Update(seccione);
                }
                else
                {
                    throw (
                              new Exception("La Sección ya existe.")
                              );
                }
            }
            return(Result);
        }
Esempio n. 7
0
        public Seccione Create(Seccione seccion)
        {
            Seccione Result = null;

            using (var r = new Repositorio <Seccione>())
            {
                Seccione s = r.Retrieve(p => p.seccion == seccion.seccion && p.casilla == seccion.casilla);
                if (s == null)
                {
                    Result = r.Create(seccion);
                }
                else
                {
                    throw (
                              new Exception("La sección ya existe.")
                              );
                }
            }

            return(Result);
        }
Esempio n. 8
0
        private void saveData()
        {
            Seccione tempSec = new Seccione
            {
                Nombre      = txtName.Text,
                Descripcion = txtGroup.Text,
                sexo        = rdbFemale.Checked ? "F" : "M",
                baja        = chbStatus.Checked,
                rangoInicio = Int32.Parse(txtStartRange.Text),
                rangoFin    = Int32.Parse(txtEndRange.Text)
            };
            Operation <Seccione> operation = sectionController.addRecord(tempSec);

            if (operation.State)
            {
                MessageBox.Show("Seccion agregada con exito");
                loadTable();
                cleanForm();
            }
            else
            {
                MessageBox.Show(operation.Error);
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Método desusado para agregar un nuevo objeto al EntitySet Secciones. Considere la posibilidad de usar el método .Add de la propiedad ObjectSet&lt;T&gt; asociada.
 /// </summary>
 public void AddToSecciones(Seccione seccione)
 {
     base.AddObject("Secciones", seccione);
 }
Esempio n. 10
0
 /// <summary>
 /// Crear un nuevo objeto Seccione.
 /// </summary>
 /// <param name="id">Valor inicial de la propiedad Id.</param>
 /// <param name="nombre">Valor inicial de la propiedad Nombre.</param>
 /// <param name="orden">Valor inicial de la propiedad Orden.</param>
 public static Seccione CreateSeccione(global::System.Int32 id, global::System.String nombre, global::System.Int32 orden)
 {
     Seccione seccione = new Seccione();
     seccione.Id = id;
     seccione.Nombre = nombre;
     seccione.Orden = orden;
     return seccione;
 }