コード例 #1
0
 public TransactionRepository(DbContextEntities dbContext, DbSet <Transactions> dbSetTransactions,
                              DbSet <Compte> dbSetCompte)
 {
     this.dbContext         = dbContext;
     this.dbSetTransactions = dbSetTransactions;
     this.dbSetCompte       = dbSetCompte;
 }
コード例 #2
0
        public override string[] GetRolesForUser(string username)
        //public string[] GetRolesForUser(string username)
        {
            using (DbContextEntities db = new DbContextEntities())
            {
                var  objUser = db.users.FirstOrDefault(x => x.username == username);
                user usr     = db.users.FirstOrDefault(u => u.username.Equals(username, StringComparison.CurrentCultureIgnoreCase) || u.username.Equals(username, StringComparison.CurrentCultureIgnoreCase));

                var roles = from ur in db.users
                            from r in db.access_level
                            where ur.access_level == r.accesslevel
                            select r.accesslevel_desc;

                if (objUser == null)
                {
                    return(null);
                }
                else
                {
                    //string[] ret = objUser.access_level.ToString(
                    return(null);
                }

                /*
                 * if (roles != null)
                 *  return roles.ToArray();
                 * else
                 *  return new string[] { };
                 */
            }
        }
コード例 #3
0
 public override string[] GetAllRoles()
 /// public string[] GetAllRoles()
 {
     using (var DbContextEntities = new DbContextEntities())
     {
         return(DbContextEntities.access_level.Select(r => r.accesslevel_desc).ToArray());
     }
 }
コード例 #4
0
 public TransfertRepository(DbContextEntities dbContext,
                            DbSet <Transfert> dbSetTransfert,
                            DbSet <Compte> dbSetCompte)
 {
     this.dbContext      = dbContext;
     this.dbSetCompte    = dbSetCompte;
     this.dbSetTransfert = dbSetTransfert;
 }
コード例 #5
0
 public void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_context != null)
         {
             _context.Dispose();
             _context = null;
         }
     }
 }
コード例 #6
0
        public static DbContext GetCuurentDbContext()
        {
            DbContext db = HttpContext.Current.Items["DbContext"] as DbContext;

            if (db == null)
            {
                db = new DbContextEntities();
                HttpContext.Current.Items.Add("DbContext", db);
            }
            return(db);
        }
コード例 #7
0
        public override bool IsUserInRole(string username, string roleName)
        ///public bool IsUserInRole(string username, string roleName)
        {
            using (DbContextEntities db = new DbContextEntities())
            {
                user usr = db.users.FirstOrDefault(u => u.username.Equals(username, StringComparison.CurrentCultureIgnoreCase) || u.device_id.Equals(roleName, StringComparison.CurrentCultureIgnoreCase));

                var roles = from ur in db.users
                            from r in db.access_level
                            where ur.access_level == r.accesslevel
                            select r.accesslevel_desc;
                if (usr != null)
                {
                    return(roles.Any(r => r.Equals(roleName, StringComparison.CurrentCultureIgnoreCase)));
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #8
0
 public TransactionRepository(DbContextEntities dbContext)
 {
     dbSetCompte       = dbContext.Compte;
     dbSetTransactions = dbContext.Transactions;
 }
コード例 #9
0
ファイル: CowRepository.cs プロジェクト: cassiodeon/MooCareVS
 public CowRepository()
 {
     db = new DbContextEntities();
 }
コード例 #10
0
 public TransactionRepository()
 {
     this.dbContext    = new DbContextEntities();
     dbSetCompte       = dbContext.Compte;
     dbSetTransactions = dbContext.Transactions;
 }
コード例 #11
0
 public PredictionRepository()
 {
     db = new DbContextEntities();
 }
コード例 #12
0
 public TransactionsService(DbContextEntities dbContext,
                            DbSet <Transactions> dbSetTransactions,
                            DbSet <Compte> dbSetCompte)
 {
     transactionRepository = new TransactionRepository(dbContext, dbSetTransactions, dbSetCompte);
 }
コード例 #13
0
 public TransfertRepository()
 {
     dbContext      = new DbContextEntities();
     dbSetCompte    = dbContext.Compte;
     dbSetTransfert = dbContext.Transfert;
 }
コード例 #14
0
 public TransfertService(DbContextEntities dbContext, DbSet <Transfert> dbSetTransfert, DbSet <Compte> dbSetCompte)
 {
     transfertRepository = new TransfertRepository(dbContext, dbSetTransfert, dbSetCompte);
 }
コード例 #15
0
 public UnitOfWork(DbContextEntities context)
 {
     this._context = new DbContextEntities();
 }
コード例 #16
0
 public NotificationRepository()
 {
     db = new DbContextEntities();
 }
コード例 #17
0
 public LactationRepository()
 {
     db = new DbContextEntities();
 }
コード例 #18
0
 public FoodRepository()
 {
     db = new DbContextEntities();
 }