Esempio n. 1
0
        public UserLogin LoginUser(string email, string password, string companyId)
        {
            UserLogin loggedUser = null;

            if (!_commonService.IsCompanyActive(companyId))
            {
                throw new Exception(String.Format("Selected [{0}] institute has not valid licence.", companyId));
            }

            using (var db = ObjectFactory.CreateDbContext(_commonService.GetCompanyDbFilePath(companyId)))
            {
                loggedUser = db.GetQueryData <UserLogin>(SQL.UserLoginCheck, new { Email = email, Password = password }).FirstOrDefault();
            }

            return(loggedUser);
        }
Esempio n. 2
0
        public List <Company> GetAllCompanies(string query)
        {
            var data = new List <Company>();

            using (var db = ObjectFactory.CreateDbContext(commonService.GetCompanyDbFilePath(this.company)))
            {
                data = db.GetQueryData <Company>(SQL.SelectAllCompanyLike, new { Term = "%" + query + "%" }).ToList();
            }
            return(data);
        }