Ejemplo n.º 1
0
        public ActionResult Profile()
        {
            UserProfileModel objUserProfile = new UserProfileModel();

            //_repoFile.GetList(x=>x.
            if (CurrentRole != "Administrator")
            {
                var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId);
                if (objProfile != null)
                {
                    ViewBag.DisciplineId = new SelectList(_repoDiscipline.GetList(x => x.CategoryId == objProfile.CategoryId).ToList(), "Id", "DisciplineName", objProfile.DisciplineId);
                    ViewBag.ProvinceId   = new SelectList(_repoProvince.GetList(x => x.Country == objProfile.CountryName).ToList(), "Id", "Name_1", objProfile.StateId);

                    objUserProfile       = UserProfileMap.Map(objProfile);
                    objUserProfile.IsNew = false;

                    var objEntityFile = _repoEntityFile.GetSingle(x => x.EntityId == objProfile.Id && x.SectionId == 1);
                    if (objEntityFile != null)
                    {
                        objUserProfile.FileId = objEntityFile.FileId.GetValueOrDefault();
                    }
                }
                else
                {
                    objUserProfile.IsNew = true;
                }
            }
            else
            {
                var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId);
                if (objProfile == null) ////This condition is to check if user has a profile or not
                {
                    objUserProfile.IsNew = true;
                }
                List <UserProfileModel> lstUserProfile = UserProfileMap.Map(_repoUserProfile.GetList(x => x.StatusId == 0).ToList());
                ViewBag.TotalUserList = lstUserProfile.Count;
            }


            ViewBag.CurrentMainTab     = "Home";
            ViewBag.CurrentSubTab      = "ControlPanel";
            ViewBag.CurrentSuperSubTab = "Profile";

            ProfileSearchModel objProfileSearch = new ProfileSearchModel();

            objUserProfile.ProfileSearch = objProfileSearch;

            return(View(objUserProfile));
        }
Ejemplo n.º 2
0
        //
        // GET: /Group/

        public ActionResult Index()
        {
            ViewBag.CurrentMainTab = "Front";
            ViewBag.CurrentSubTab  = "Groups";

            PopulateViewBags();

            //long profileId = 0;
            //if (CurrentUser != null)
            //{
            //    var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId);
            //    GroupModel objGroup = new GroupModel();
            //    if (objProfile != null)
            //    {
            //        profileId = objProfile.Id;
            //    }
            //}
            //ViewData["ProfileId"] = profileId;
            //ViewData["Url"] = Request.RawUrl;
            //ViewData["EntityId"] = 1;
            //ViewData["SectionId"] = 2;

            GroupModel objGroups    = new GroupModel();
            string     VideoLinkUrl = "";

            if (_repoVideoLink.GetSingle(x => x.SectionId == 1) != null)
            {
                VideoLinkUrl = _repoVideoLink.GetSingle(x => x.SectionId == 2).VideoLinkUrl;
            }
            var lstBannerImage = _repoFrontEntityFile.GetList(x => x.SectionId == 2).OrderByDescending(x => x.Id).ToList();

            //if (_repFrontEntityFile.GetList(x => x.SectionId == 1).Count() > 0)
            //{
            //    lstBannerImage = _repFrontEntityFile.GetList(x => x.SectionId == 1).OrderByDescending(x => x.Id).ToList();
            //}
            if (_repoEntityFile.GetSingle(x => x.SectionId == 25) != null)
            {
                objGroups.AdvertisingBanner = _repoEntityFile.GetSingle(x => x.SectionId == 25).FileId;
            }
            objGroups.VideoUrl   = VideoLinkUrl;
            objGroups.BannerList = lstBannerImage;
            return(View(objGroups));

            //return View(new GroupIndexModel());
        }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            ViewBag.CurrentMainTab = "Front";
            HomeIndexModel homeIndexModel = new HomeIndexModel();

            string VideoLinkUrl = "";

            if (_repVideoLink.GetSingle(x => x.SectionId == 0) != null)
            {
                VideoLinkUrl = _repVideoLink.GetSingle(x => x.SectionId == 0).VideoLinkUrl;
            }

            var lstBannerImage = _repFrontEntityFile.GetList(x => x.SectionId == 0).OrderByDescending(x => x.Id).ToList();

            if (_repEntityFile.GetSingle(x => x.Section.SectionName == "Advertisement") != null)
            {
                homeIndexModel.AdvertisingBanner = _repEntityFile.GetList(x => x.Section.SectionName == "Advertisement").Select(x => x.FileId).Max();
            }
            homeIndexModel.VideoUrl   = VideoLinkUrl;
            homeIndexModel.BannerList = lstBannerImage;
            return(View(homeIndexModel));
        }
Ejemplo n.º 4
0
        public ActionResult Index()
        {
            ViewBag.CurrentMainTab = "User";
            UserIndexModel objUsers     = new UserIndexModel();
            string         VideoLinkUrl = "";

            if (_repVideoLink.GetSingle(x => x.SectionId == 1) != null)
            {
                VideoLinkUrl = _repVideoLink.GetSingle(x => x.SectionId == 1).VideoLinkUrl;
            }
            var lstBannerImage = _repFrontEntityFile.GetList(x => x.SectionId == 1).OrderByDescending(x => x.Id).ToList();

            //if (_repFrontEntityFile.GetList(x => x.SectionId == 1).Count() > 0)
            //{
            //    lstBannerImage = _repFrontEntityFile.GetList(x => x.SectionId == 1).OrderByDescending(x => x.Id).ToList();
            //}
            if (_repoEntityFile.GetSingle(x => x.SectionId == 25) != null)
            {
                objUsers.AdvertisingBanner = _repoEntityFile.GetSingle(x => x.SectionId == 25).FileId;
            }
            objUsers.VideoUrl   = VideoLinkUrl;
            objUsers.BannerList = lstBannerImage;
            return(View(objUsers));
        }
Ejemplo n.º 5
0
        public JsonResult Get(string commentUrl = "", long entityId = 0, long sectionId = 0)
        {
            if (Request.IsAjaxRequest())
            {
                CommentThread thread = null;
                if (!string.IsNullOrEmpty(commentUrl))
                {
                    thread = _repoThread.GetSingle(x => x.SectionId == sectionId && x.EntityID == entityId);
                }

                long fileId = 0;
                if (thread != null)
                {
                    var lstcomments = _repoComments.GetList(x => x.ThreadID == thread.ID).OrderByDescending(x => x.Date).ToList();
                    var comments    = new List <CommentModel>();

                    foreach (Comment comment in lstcomments)
                    {
                        bool showLike      = false;
                        int  likeCount     = 0;
                        var  objEntityFile = _repoEntityFile.GetSingle(x => x.EntityId == comment.ProfileId && x.SectionId == 1);
                        if (objEntityFile != null)
                        {
                            fileId = objEntityFile.FileId ?? 0;
                        }
                        else
                        {
                            fileId = 0;
                        }


                        long currentProfileId = 0;
                        if (_repoUserProfile != null)
                        {
                            if (CurrentUser != null)
                            {
                                currentProfileId = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId).Id;
                            }
                        }

                        var objLike = _repoLike.GetSingle(x => x.ProfileId == currentProfileId && x.EntityName == "comment" && x.EntityId == comment.ID);
                        if (objLike == null)
                        {
                            showLike = true;
                        }
                        //else
                        //{
                        likeCount = _repoLike.GetList(x => x.EntityName == "comment" && x.EntityId == comment.ID).Count();
                        //}
                        comments.Add(new CommentModel
                        {
                            ID              = comment.ID,
                            Body            = comment.Body,
                            Date            = String.Format("{0:d}", comment.Date),
                            ThreadID        = comment.ThreadID,
                            UserID          = comment.UserID,
                            UserName        = comment.UserName,
                            Email           = comment.Email,
                            ProfileId       = comment.ProfileId,
                            FileId          = fileId,
                            ShowLike        = showLike,
                            LikeCount       = likeCount,
                            CurrentUserRole = CurrentRole
                        });
                    }



                    // var allfiles = new Dictionary<string, List<object>>();
                    //////long fileId = 0;
                    //////if (thread != null)
                    //////{
                    //////    var lstcomments = _repoComments.GetList(x => x.ThreadID == thread.ID).OrderBy(x => x.ID).ToList();
                    //////    var comments = new List<CommentModel>();
                    //////    lstcomments.ForEach(x =>
                    //////    {
                    //////        var objEntityFile = _repoEntityFile.GetSingle(y => y.EntityId == x.ProfileId && y.SectionId == 1);
                    //////        if (objEntityFile != null)
                    //////        {
                    //////            fileId = objEntityFile.FileId ?? 0;
                    //////        }

                    //////        comments.Add(new CommentModel
                    //////        {
                    //////            ID = x.ID,
                    //////            Body = x.Body,
                    //////            Date = String.Format("{0:F}", x.Date),
                    //////            ThreadID = x.ThreadID,
                    //////            UserID = x.UserID,
                    //////            UserName = x.UserName,
                    //////            Email = x.Email,
                    //////            ProfileId = x.ProfileId,
                    //////            FileId = fileId
                    //////        });

                    //////        //allfiles.Add(x.ID.ToString(), GetFilesForComment(x.ID));
                    //////    });


                    return(Json(new { comments = comments, commentcount = comments.Count }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { commentcount = 0 }, JsonRequestBehavior.AllowGet));
            }
            return(null);
        }
Ejemplo n.º 6
0
        public PartialViewResult UserList(string name, string countryName, int?provinceId, int?disciplineId, string sex, int?categoryId, int?sortOrder, int?pageNumber = null, int?itemsPerPage = null)
        {
            int listCount = 0;
            int offset    = 0;

            offset = (((int)pageNumber - 1) * (int)itemsPerPage);
            List <UserProfileModel> lstUserProfile         = new List <UserProfileModel>();
            List <UserProfileModel> lstNewUserProfileModel = new List <UserProfileModel>();

            if (sortOrder == 1)
            {
                lstUserProfile = UserProfileMap.Map(_repoUserProfile.GetList(x => x.IsLeonniTeam == true).OrderBy(x => x.FirstName).Skip(offset).Take((int)itemsPerPage).ToList());
                listCount      = _repoUserProfile.GetList().ToList().Count;
            }
            else if (sortOrder == 2)
            {
                lstUserProfile = UserProfileMap.Map(_repoUserProfile.GetList(x => x.IsLeonniTeam == true).OrderByDescending(x => x.FirstName).Skip(offset).Take((int)itemsPerPage).ToList());
                listCount      = _repoUserProfile.GetList().ToList().Count;
            }
            else
            {
                lstUserProfile = UserProfileMap.Map(_repoUserProfile.GetList(x => x.IsLeonniTeam == true).OrderBy(x => x.FirstName).Skip(offset).Take((int)itemsPerPage).ToList());
                listCount      = _repoUserProfile.GetList().ToList().Count;
            }

            if (categoryId != null)
            {
                if (categoryId != 0)
                {
                    lstUserProfile = lstUserProfile.Where(x => x.CategoryId == categoryId).ToList();
                    listCount      = _repoUserProfile.GetList(x => x.CategoryId == categoryId).ToList().Count;
                }
            }

            if (!string.IsNullOrEmpty(sex))
            {
                if (sex != "Sex")
                {
                    lstUserProfile = lstUserProfile.Where(x => x.Sex == sex).ToList();
                    listCount      = _repoUserProfile.GetList(x => x.Sex == sex).ToList().Count;
                }
            }

            if (disciplineId != null)
            {
                if (disciplineId != 0)
                {
                    lstUserProfile = lstUserProfile.Where(x => x.DisciplineId == disciplineId).ToList();
                    listCount      = _repoUserProfile.GetList(x => x.DisciplineId == disciplineId).ToList().Count;
                }
            }


            if (!string.IsNullOrEmpty(countryName))
            {
                if (countryName != "Country")
                {
                    lstUserProfile = lstUserProfile.Where(x => x.CountryName == countryName).ToList();
                    listCount      = _repoUserProfile.GetList(x => x.CountryName == countryName).ToList().Count;
                }
            }


            if (provinceId != null)
            {
                if (provinceId != 0)
                {
                    lstUserProfile = lstUserProfile.Where(x => x.StateId == provinceId).ToList();
                    listCount      = _repoUserProfile.GetList(x => x.StateId == provinceId).ToList().Count;
                }
            }

            if (!string.IsNullOrEmpty(name))
            {
                lstUserProfile = lstUserProfile.Where(x => x.FirstName == name).ToList();
                listCount      = _repoUserProfile.GetList(x => x.FirstName == name).ToList().Count;
            }

            foreach (var item in lstUserProfile.ToList())
            {
                var objEntityFile = _repoEntityFile.GetSingle(x => x.EntityId == item.Id && x.Section.SectionName == "profile");
                if (objEntityFile != null)
                {
                    item.FileId = objEntityFile.FileId;
                }
                lstNewUserProfileModel.Add(item);
            }

            ViewBag.PagedListofUsers = lstNewUserProfileModel ?? new List <UserProfileModel>();
            ViewBag.TotalUserCount   = listCount;

            return(PartialView("_UsersList", lstNewUserProfileModel));
        }