Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }