Esempio n. 1
0
        int NextTotal()
        {
            int nid = 0;

            using (DBIDBuilderContext context = new DBIDBuilderContext()) {
                IDSeedName idS = context.IDSeedName.Where(T => T.ID == ID).FirstOrDefault();
                idS.TotalCount += 1;
                nid             = idS.TotalCount;
                context.Entry <IDSeedName>(idS).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                context.SaveChanges();
            }
            return(nid);
        }
Esempio n. 2
0
        int AddSeed(string Name)
        {
            int id = 0;

            using (DBIDBuilderContext db = new DBIDBuilderContext()) {
                IDSeedName Seed = new IDSeedName()
                {
                    Name        = Name,
                    RefreshTime = DateTime.Now,
                    SeedDay     = DateTime.Now.Date
                };
                db.IDSeedName.Add(Seed);
                db.SaveChanges();
                id = Seed.ID;
            }
            return(id);
        }
Esempio n. 3
0
        int Next()
        {
            int nid = 0;

            using (DBIDBuilderContext context = new DBIDBuilderContext()) {
                IDSeedName idS = context.IDSeedName.Where(T => T.ID == ID).FirstOrDefault();
                if (idS.SeedDay.ToString("yyMMdd") != DateTime.Now.ToString("yyMMdd"))
                {
                    idS.SeedDay     = DateTime.Now.Date;
                    idS.RefreshTime = DateTime.Now;
                    idS.DayCount    = 0;
                }
                idS.DayCount   += 1;
                idS.TotalCount += 1;
                nid             = idS.DayCount;
                context.Entry <IDSeedName>(idS).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                context.SaveChanges();
            }
            return(nid);
        }
Esempio n. 4
0
 int FindSeed(string Name)
 {
     using (DBIDBuilderContext db = new DBIDBuilderContext()) {
         return(db.IDSeedName.Where(T => T.Name == Name).Select(T => T.ID).FirstOrDefault());
     }
 }