コード例 #1
0
        public List<COMPETIDOR> GetCompetidores()
        {
            List<COMPETIDOR> records;

            using (PLZ21KEntities db = new PLZ21KEntities())
            {
                records = db.COMPETIDORES.Where(c => c.ID > 50 && c.C01 == null).Take(40).OrderBy(c => c.ID).ToList();
            }

            return records;
        }
コード例 #2
0
        public void UpdateReenvio( string registro )
        {
            using (PLZ21KEntities db = new PLZ21KEntities())
            {
                try
                {
                    var record = db.COMPETIDORES.FirstOrDefault(a => a.REGISTRO == registro);

                    if (record != null)
                    {
                        record.C01 = "1";
                        record.C02 = System.DateTime.Now.ToString();
                        db.SaveChanges();
                    }

                }
                catch (DbEntityValidationException dbEx)
                {
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                        }
                    }

                    throw dbEx.InnerException;
                }

            }
        }