Example #1
0
        public void Insert(GrupoDTO entityDTO)
        {
            TGrupo entity = Builders.
                            GenericBuilder.builderDTOEntity <TGrupo, GrupoDTO>
                                (entityDTO);

            repository.Save(entity);
        }
        public void Delete(Guid GrupoId)
        {
            TGrupo dbEntry = context.TGrupo
                             .FirstOrDefault(p => p.Id == GrupoId);

            if (dbEntry != null)
            {
                context.TGrupo.Remove(dbEntry);
                context.SaveChanges();
            }
        }
        public void Delete(Guid itemId)
        {
            TGrupo dbEntry = Context.TGrupo
                             .FirstOrDefault(p => p.Id == itemId);

            if (dbEntry != null)
            {
                Context.TGrupo.Remove(dbEntry);
                Context.SaveChanges();
            }
        }
 public void Save(TGrupo grupo)
 {
     if (grupo.Id == Guid.Empty)
     {
         grupo.Id = Guid.NewGuid();
         context.TGrupo.Add(grupo);
     }
     else
     {
         TGrupo dbEntry = context.TGrupo
                          .FirstOrDefault(p => p.Id == grupo.Id);
         if (dbEntry != null)
         {
             dbEntry.Id = grupo.Id;
         }
     }
     context.SaveChangesAsync();
 }
 public void Save(TGrupo item)
 {
     if (item.Id == Guid.Empty)
     {
         item.Id = Guid.NewGuid();
         Context.TGrupo.Add(item);
     }
     else
     {
         TGrupo dbEntry = Context.TGrupo
                          .FirstOrDefault(p => p.Id == item.Id);
         if (dbEntry != null)
         {
             dbEntry.GrupoNom  = item.GrupoNom;
             dbEntry.GrupoFoto = item.GrupoFoto;
             dbEntry.GrupoProm = item.GrupoProm;
         }
     }
     Context.SaveChangesAsync();
 }
Example #6
0
        private void BSeguir_Click(object sender, EventArgs e)
        {
            string sql   = "";
            string Error = "";

            errorProvider1.Clear();
            string mensaje = "ESTE CAMPO NO PUEDE ESTAR EN BLANCO";

            if (string.IsNullOrWhiteSpace(tid.Text.ToString().Trim()))
            {
                MessageBox.Show(mensaje);
                errorProvider1.SetError(tid, mensaje);
                tid.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(tdescr.Text.ToString().Trim()))
            {
                MessageBox.Show(mensaje);
                errorProvider1.SetError(tdescr, mensaje);
                tdescr.Focus();
            }
            if (string.IsNullOrWhiteSpace(Tcat.Text.ToString().Trim()))
            {
                MessageBox.Show(mensaje);
                errorProvider1.SetError(Tcat, mensaje);
                Tcat.Focus();
            }
            if (string.IsNullOrWhiteSpace(TGrupo.Text.ToString().Trim()))
            {
                MessageBox.Show(mensaje);
                errorProvider1.SetError(TGrupo, mensaje);
                TGrupo.Focus();
            }
            if (string.IsNullOrWhiteSpace(TTipo.Text.ToString().Trim()))
            {
                MessageBox.Show(mensaje);
                errorProvider1.SetError(TTipo, mensaje);
                TTipo.Focus();
            }
            Pasa_Datos();
            if (aa_modo.ToUpper().Trim() == "A")
            {
                if (CB_Estado.SelectedIndex != 0)
                {
                    MessageBox.Show("NO PUEDE REGISTRAR CON ESTADO DIFERENTE DE ACTIVO");
                    return;
                }
            }

            if (!funciones.Inserta_Articulo(aa_modo, aa_Articulo, FileName, ref Error))
            {
                MessageBox.Show(Error);
                return;
            }
            if (aa_modo.Trim().ToLower() == "a")
            {
                Limpia();
            }
            else
            {
                this.DialogResult = DialogResult.OK;
            }
        }