예제 #1
0
 public bool Save(tblProducto obj)
 {
     using (CalicoEntities context = new CalicoEntities())
     {
         try
         {
             context.tblProducto.Add(obj);
             context.SaveChanges();
         }
         catch (DbEntityValidationException e)
         {
             foreach (var eve in e.EntityValidationErrors)
             {
                 foreach (var ve in eve.ValidationErrors)
                 {
                     Console.Error.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
                 }
             }
             return(false);
         }
         catch (DbUpdateException dbe)
         {
             Console.WriteLine("Error insertando el producto: " + dbe.Message);
         }
         catch (Exception ee)
         {
             Console.WriteLine("Error desconocido insertando el producto: " + ee.Message);
         }
         return(true);
     }
 }
예제 #2
0
        public bool Save(tblSubCliente obj)
        {
            using (CalicoEntities context = new CalicoEntities())
            {
                context.tblSubCliente.Add(obj);
                context.SaveChanges();
            }


            return(true);
        }
 public void Delete(int id)
 {
     using (CalicoEntities context = new CalicoEntities())
     {
         BIANCHI_PROCESS obj = new BIANCHI_PROCESS {
             id = id
         };
         context.BIANCHI_PROCESS.Attach(obj);
         context.BIANCHI_PROCESS.Remove(obj);
         context.SaveChanges();
     }
 }
예제 #4
0
 public void Delete(int id)
 {
     using (CalicoEntities context = new CalicoEntities())
     {
         tblSubCliente obj = new tblSubCliente {
             subc_proc_id = id
         };
         context.tblSubCliente.Attach(obj);
         context.tblSubCliente.Remove(obj);
         context.SaveChanges();
     }
 }
 public void Update(BIANCHI_PROCESS obj)
 {
     using (CalicoEntities context = new CalicoEntities())
     {
         var result = context.BIANCHI_PROCESS.Find(obj.id);
         if (result == null)
         {
             return;
         }
         context.Entry(result).CurrentValues.SetValues(obj);
         context.SaveChanges();
     }
 }
예제 #6
0
 public void Update(tblSubCliente obj)
 {
     using (CalicoEntities context = new CalicoEntities())
     {
         var result = context.tblSubCliente.Find(obj.subc_proc_id);
         if (result == null)
         {
             return;
         }
         context.Entry(result).CurrentValues.SetValues(obj);
         context.SaveChanges();
     }
 }
 public bool Save(BIANCHI_PROCESS obj)
 {
     try
     {
         using (CalicoEntities context = new CalicoEntities())
         {
             context.BIANCHI_PROCESS.Add(obj);
             context.SaveChanges();
         }
     }
     catch (Exception e) {
         Console.WriteLine(e.Message);
         return(false);
     }
     return(true);
 }
예제 #8
0
 public bool Save(tblSubCliente obj)
 {
     try
     {
         using (CalicoEntities context = new CalicoEntities())
         {
             context.tblSubCliente.Add(obj);
             context.SaveChanges();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
     return(true);
 }
 public bool updateEnCurso(string interfaz)
 {
     using (CalicoEntities context = new CalicoEntities())
     {
         var query = from BP in context.BIANCHI_PROCESS
                     where BP.interfaz == interfaz
                     select BP;
         var result = query.FirstOrDefault <BIANCHI_PROCESS>();
         if (result == null)
         {
             return(false);
         }
         result.estado = Constants.ESTADO_EN_CURSO;
         context.Entry(result);
         context.SaveChanges();
         return(true);
     }
 }