Esempio n. 1
0
 public static void AddLookupValue(Lookup lookupValue)
 {
     Dictionary<int, string> whole = cachedLookups[lookupValue.LookupName];
     if (whole.ContainsKey(lookupValue.ID))
         return;
     whole.Add(lookupValue.ID, lookupValue.Value);
 }
Esempio n. 2
0
 public static void Update(Lookup lookup)
 {
     using (LibraryDataContext ctx = new LibraryDataContext())
     {
         ctx.Lookups.Attach(lookup);
         ctx.Entry(lookup).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Esempio n. 3
0
        public static void Add(Lookup lookup)
        {
            using (LibraryDataContext ctx = new LibraryDataContext())
            {
                using (DbContextTransaction transaction = ctx.Database.BeginTransaction())
                {
                    int nextID = ctx.Lookups.Where(l => l.LookupName == lookup.LookupName).Max(l => l.ID) + 1;
                    lookup.ID = nextID;

                    ctx.Lookups.Add(lookup);
                    ctx.SaveChanges();
                }
            }
        }
Esempio n. 4
0
 public static void UpdateLookupValue(Lookup lookupValue)
 {
     Dictionary<int, string> whole = cachedLookups[lookupValue.LookupName];
     if (whole.ContainsKey(lookupValue.ID))
         whole[lookupValue.ID] = lookupValue.Value;
     else
         whole.Add(lookupValue.ID, lookupValue.Value);
 }