コード例 #1
0
ファイル: NewsRepo.cs プロジェクト: tforsberg/z
        public IEnumerable<News> All(int pageIndex, int pageSize, out long totalRows)
        {
            using (var db = new MainDb())
            {
                var query = Query<News>.EQ(x=>x.Status,(int)GlobalStatus.Actived);
                var sort = SortBy<News>.Descending(x=>x.Created);

                return db.Find<News>(query, sort, pageIndex, pageSize, out totalRows);
            }
        }
コード例 #2
0
        //
        public List <BusinessServiceLookupVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.businessServiceLookups
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #3
0
 public UserService
 (
     MainDb db,
     IUserRepository userRepository,
     PasswordHashService passwordHashService
 )
 {
     _db                  = db;
     _userRepository      = userRepository;
     _passwordHashService = passwordHashService;
 }
コード例 #4
0
        private IQueryable <AnalyseTypeModel> MakeSelect(MainDb db)
        {
            var query = from analysetype in db.AnalyseType
                        select new AnalyseTypeModel
            {
                Id   = analysetype.Id,
                Name = analysetype.Name
            };

            return(query);
        }
コード例 #5
0
        public ActionResult RemoveFromCart(int id)
        {
            OrderDetail od = MainDb.OrderDetails.Where(x => x.ProductID == id).FirstOrDefault();

            MainDb.OrderDetails.Remove(od);
            MainDb.SaveChanges();

            TempData["OrderDetail"] = MainDb.OrderDetails.ToList();
            TempData["message"]     = "Ürün sepetinizden silindi!";
            return(RedirectToAction("Cart"));
        }
コード例 #6
0
        public ActionResult RemoveFromWishlist(int id)
        {
            Wishlist wish = MainDb.Wishlists.Where(x => x.ProductID == id).FirstOrDefault();

            MainDb.Wishlists.Remove(wish);
            MainDb.SaveChanges();

            TempData["Wishlist"] = MainDb.Wishlists.ToList();
            TempData["message"]  = "Ürün izleme listenizden silindi!";
            return(RedirectToAction("Wishlist"));
        }
コード例 #7
0
        /// <summary>
        /// Find Member matching the memberId (primary key)
        /// </summary>
        public MemberVo get(int memberId)
        {
            using (var db = new MainDb())
            {
                var res = db.members
                          .Include(a => a.memberRoleLookupses.Select(c => c.memberRoleType))
                          .FirstOrDefault(p => p.memberId == memberId);

                return(res);
            }
        }
コード例 #8
0
        //
        public List <MemberVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.members
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #9
0
        //
        public List <ContactInfoVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.contactInfos
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #10
0
        //
        public List <OptionTypeVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.optionTypes
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #11
0
        public IEnumerable <News> All(int pageIndex, int pageSize, out long totalRows)
        {
            using (var db = new MainDb())
            {
                var query = Query <News> .EQ(x => x.Status, (int)GlobalStatus.Actived);

                var sort = SortBy <News> .Descending(x => x.Created);

                return(db.Find <News>(query, sort, pageIndex, pageSize, out totalRows));
            }
        }
コード例 #12
0
        private IQueryable <JobModel> MakeSelect(MainDb db)
        {
            var query = from job in db.Job
                        select new JobModel
            {
                Id   = job.Id,
                Name = job.Name,
            };

            return(query);
        }
コード例 #13
0
        //
        public List <CompanyCategoryTypeVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.companyCategoryTypes
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #14
0
        /// <summary>
        /// Get First Item
        /// </summary>
        public ReferralVo getFirst()
        {
            using (var db = new MainDb())
            {
                var res = db.referrals
                          .Include(a => a.surveyAnswerses)
                          .FirstOrDefault();

                return(res);
            }
        }
コード例 #15
0
 public bool delete(int clientId)
 {
     using (var db = new MainDb())
     {
         var res = db.clients
                   .Include(i => i.contactInfo)
                   .Include(o => o.clientOrganizationLookupses)
                   .Where(e => e.clientId == clientId)
                   .Delete();
         return(true);
     }
 }
コード例 #16
0
        /// <summary>
        /// Get First Item
        /// </summary>
        public MemberVo getFirst()
        {
            using (var db = new MainDb())
            {
                var res = db.members
                          .Include(i => i.contactInfo)
                          .Include(a => a.memberRoleLookupses)
                          .FirstOrDefault();

                return(res);
            }
        }
コード例 #17
0
        //
        public List <SurveyAnswerVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.surveyAnswers
                           .Include(a => a.questionType)
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #18
0
        public List <OrganizationVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.organizations
                           .Include(i => i.contactInfo)
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #19
0
        public SearchFilterVm searchForOrgOverviewMembers(int orgID, SearchFilterVm input)
        {
            int keywordInt = 0;

            int.TryParse(input.keyword, out keywordInt);
            if (keywordInt < 0)
            {
                keywordInt = 0;
            }
            List <int>           clientsOrgLookupIDs;
            ContactInfoVo        contact;
            List <ContactInfoVo> query = new List <ContactInfoVo>();

            using (var db = new MainDb())
            {
                clientsOrgLookupIDs = db.clientOrganizationLookups
                                      .Where(e => (e.organizationId == orgID))
                                      .Select(e => e.clientId)
                                      .ToList();
                if (clientsOrgLookupIDs.Count() > 0)
                {
                    foreach (int i in clientsOrgLookupIDs)
                    {
                        contact = db.clients
                                  .Where(c => (c.clientId == i))
                                  .Select(c => c.contactInfo).FirstOrDefault();
                        query.Add(contact);
                    }
                }
                if (query.Count() > 0)
                {
                    foreach (ContactInfoVo con in query)
                    {
                        con.feeAmount = db.clients
                                        .Where(c => (c.contactInfoId == con.contactInfoId))
                                        .Select(c => c.feeAmount).FirstOrDefault();
                    }
                }
            }
            var query1 = query.AsQueryable();

            if (input.paging != null)
            {
                input.paging.totalCount = query1.Count();
                query1 = query1
                         .Skip(input.paging.skip)
                         .Take(input.paging.rowCount);
            }

            input.result = query1.ToList <object>();

            return(input);
        }
コード例 #20
0
        private IQueryable <ProcTypeModel> MakeSelect(MainDb db)
        {
            var query = from proctype in db.ProcType
                        select new ProcTypeModel
            {
                Id     = proctype.Id,
                Name   = proctype.Name,
                Job_Id = proctype.Job_Id
            };

            return(query);
        }
コード例 #21
0
ファイル: MemberManager.cs プロジェクト: osamaazam9/CodeRepo
        public MemberVo getByUsername(string usernameOrEmail)
        {
            using (var db = new MainDb())
            {
                var mem = db.members
                          .Include(i => i.contactInfo)
                          .Include(a => a.memberRoleLookupses.Select(c => c.memberRoleType))
                          .FirstOrDefault(p => p.username == usernameOrEmail);

                return(mem);
            }
        }
コード例 #22
0
        /// <summary>
        /// Find Client matching the contactMembershipId (primary key)
        /// </summary>
        public ClientVo get(int clientId)
        {
            using (var db = new MainDb())
            {
                var res = db.clients
                          .Include(i => i.contactInfo)
                          .Include(a => a.clientOrganizationLookupses.Select(c => c.organization))
                          .FirstOrDefault(p => p.clientId == clientId);

                return(res);
            }
        }
コード例 #23
0
ファイル: ReportManager.cs プロジェクト: osamaazam9/CodeRepo
        public IEnumerable <ClientVo> getAllClients()
        {
            using (var db = new MainDb())
            {
                var list = db.clients
                           .Include(i => i.contactInfo)
                           .Include(o => o.clientOrganizationLookupses)
                           .OrderBy(i => i.contactInfo.firstName).ToList();

                return(list);
            }
        }
コード例 #24
0
        public static int getOrgIDForClient(int clientID)
        {
            int orgID;

            using (var db = new MainDb())
            {
                orgID = db.clientOrganizationLookups
                        .Where(e => (e.clientId == clientID))
                        .Select(e => e.organizationId).FirstOrDefault();
            }
            return(orgID);
        }
コード例 #25
0
        //
        public List <ReferralVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.referrals
                           .Include(a => a.surveyAnswerses)
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #26
0
        /// <summary>
        /// Find Referral matching the referralId (primary key)
        /// </summary>
        public ReferralVo get(int referralId)
        {
            using (var db = new MainDb())
            {
                var res = db.referrals
                          .Include(a => a.surveyAnswerses)
                          .Include(q => q.surveyAnswerses.Select(c => c.questionType))
                          .FirstOrDefault(p => p.referralId == referralId);

                return(res);
            }
        }
コード例 #27
0
        /// <summary>
        /// Get First Item
        /// </summary>
        public ClientVo getFirst()
        {
            using (var db = new MainDb())
            {
                var res = db.clients
                          .Include(i => i.contactInfo)
                          .Include(o => o.clientOrganizationLookupses)
                          .FirstOrDefault();

                return(res);
            }
        }
コード例 #28
0
        private IQueryable <DateModel> MakeSelect(MainDb db)
        {
            var query = from date in db.Date
                        select new DateModel
            {
                Id   = date.Id,
                Day  = date.Day,
                Time = date.Time
            };

            return(query);
        }
コード例 #29
0
        //
        public List <MemberRoleLookupVo> getAll(bool?isActive = true)
        {
            using (var db = new MainDb())
            {
                var list = db.memberRoleLookups
                           .Include(r => r.memberRoleType)
                           .Where(e => isActive == null || e.isActive == isActive)
                           .ToList();

                return(list);
            }
        }
コード例 #30
0
        public static string getOrgNameByID(int orgID)
        {
            string orgName = "";

            using (var db = new MainDb())
            {
                orgName = db.organizations
                          .Where(e => (e.organizationId == orgID))
                          .Select(e => e.name).FirstOrDefault();
            }
            return(orgName);
        }
コード例 #31
0
        /// <summary>
        /// Get First Item
        /// </summary>
        public CompanyVo getFirst()
        {
            using (var db = new MainDb())
            {
                var res = db.companies
                          .Include(i => i.contactInfo)
                          .Include(c => c.companyCategoryLookupses)
                          .FirstOrDefault();

                return(res);
            }
        }
コード例 #32
0
ファイル: NewsRepo.cs プロジェクト: tforsberg/z
        public IEnumerable<News> QuickSearch(ObjectId catid, string kwd, int pageIndex, int pageSize,
                                                    out long totalRows)
        {

            using (var db = new MainDb())
            {
                var _query =
                    Query.Or(
                        Query.Matches("title", BsonRegularExpression.Create(new Regex(kwd, RegexOptions.IgnoreCase))),
                        Query.Matches("html", BsonRegularExpression.Create(new Regex(kwd, RegexOptions.IgnoreCase))),
                        Query.In("tags", new BsonArray(kwd))
                        );

                return db.Find<News>(_query, SortBy.Descending("crt"), pageIndex, pageSize, out totalRows);
            }
        }