Пример #1
0
        public ActionResult Index(int?id)
        {
            var userId = _userID;

            if (id != null)
            {
                userId = (int)id;
            }

            if (userId != _userID)
            {
                return(RedirectToAction("PermissionDenied", "Home"));
            }

            CardWhisperModel model        = new CardWhisperModel();
            CardHeaderModel  inbox_header = new CardHeaderModel()
            {
                _label = "Inbox", _class = "active", _link = "#tab_1"
            };
            CardHeaderModel sent_header = new CardHeaderModel()
            {
                _label = "Sent Items", _link = "#tab_2"
            };
            CardHeaderModel compose = new CardHeaderModel()
            {
                _label = "Compose", _icon = "fa fa-comment", _class = "pull-right", _link = Url.Action("Create", "Whisper"), _isbutton = true
            };

            if (userId == _userID)
            {
                model._header = new CardHeaderTabsModel()
                {
                    _header = new List <CardHeaderModel>()
                    {
                        inbox_header, sent_header, compose
                    }
                };
            }
            else
            {
                model._header = new CardHeaderTabsModel()
                {
                    _header = new List <CardHeaderModel>()
                    {
                        inbox_header, sent_header
                    }
                };
            }

            ColumnModel col_date = new ColumnModel()
            {
                _scope = "col", _name = "Date"
            };
            ColumnModel col_voicer = new ColumnModel()
            {
                _scope = "col", _name = "Voicer"
            };
            ColumnModel col_message = new ColumnModel()
            {
                _scope = "col", _name = "Message"
            };
            ColumnModel col_space = new ColumnModel()
            {
                _scope = "col", _class = "col-md-2"
            };

            CardBodyTableModel inbox_body = new CardBodyTableModel()
            {
                _cols = new List <ColumnModel>()
                {
                    col_date, col_voicer, col_message, col_space
                }, _class = "active", _html_id = "tab_1"
            };
            CardBodyTableModel sent_body = new CardBodyTableModel()
            {
                _cols = new List <ColumnModel>()
                {
                    col_date, col_voicer, col_message, col_space
                }, _html_id = "tab_2"
            };

            model._body = new CardBodyTabsTableModel()
            {
                _body = new List <CardBodyTableModel>()
                {
                    inbox_body, sent_body
                }
            };

            FillBaseModel(model);
            return(View(model));
        }
Пример #2
0
        public ActionResult Details(int Id)
        {
            var userRepo = _userRepository.FirstOrDefault(x => x.Id == Id, x => x, null);

            if (userRepo == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (Id != _userID && !userRepo.isPublic)
            {
                return(RedirectToAction("PermissionDenied", "Home"));
            }

            DetailsViewModel model = new DetailsViewModel();

            List <string> lastSpreadList = _userIPSpreadsRepository.GetAllIPSForUser(x => x.UserId == userRepo.Id, 0, int.MaxValue, this._userID)
                                           .Select(x => FormatIPForDetails(x)).ToList();

            List <string> lastActivityList = null;

            if (Id == _userID)
            {
                lastActivityList = _usersActivityRepository.LoadSortAndSelect(x => x.RowText == "Spread" && x.UsersIP.UserId == userRepo.Id && x.UserId == _userID,
                                                                              x => x, 9, Sorter <UsersActivity> .Get(x => x.Date, false))
                                   .Select(x => FormatActivityForDetails(x)).ToList();
            }
            else
            {
                lastActivityList = _usersActivityRepository.LoadSortAndSelect(x => x.RowText == "Spread" && x.UsersIP.UserId == userRepo.Id && x.UsersIP.Public && x.UserId == userRepo.Id,
                                                                              x => x, 9, Sorter <UsersActivity> .Get(x => x.Date, false))
                                   .Select(x => FormatActivityForDetails(x)).ToList();
            }

            List <int> connectedIds = _usersConnectionRepository.LoadAndSelect(x => x.UserId == userRepo.Id && x.Type == "CONNECTED", x => x.ConnectedUserId, false);

            List <string> ipSpreadList = _userIPSpreadsRepository.GetAllIPSForUser(x => x.UserId == userRepo.Id && !connectedIds.Contains(x.UserSentId), 0, int.MaxValue, _userID)
                                         .Select(x => FormatIPForDetails(x)).ToList();

            List <string> voicerSpreadList = _userIPSpreadsRepository.GetAllIPSForUser(x => x.UserId == userRepo.Id && connectedIds.Contains(x.UserSentId), 0, int.MaxValue, _userID)
                                             .Select(x => FormatIPForDetails(x)).ToList();



            List <string> lastVoicerUpdateList = _usersConnectionRepository.LoadAndSelectMany(x => x.UserId == userRepo.Id,
                                                                                              x => x.User1.UsersActivities.Select(y => y), null).Select(x => FormatActivityForDetails(x)).ToList();


            model._features = _featureRepository.LoadAndSelect(x => x.ProfileUse && !string.IsNullOrEmpty(x.ProfileImagePath), x => new { ImagePath = x.ProfileImagePath, x.Id }, false)
                              .Select(x => new CarouselModel()
            {
                _img = x.ImagePath, _link = Url.Action("Index", "Category", new { FeatureId = x.Id, UserId = Id })
            }).ToList();

            // Personal Card part
            dynamic pCard = new ExpandoObject();
            CardHeaderPersonalModel pHeader = new CardHeaderPersonalModel();

            pHeader._title = new CardHeaderModel()
            {
                _label = userRepo.Nickname, _link = Url.Action("Personal", "User", new { Id = userRepo.Id })
            };
            pHeader._title_img = "/Images/icons/profile.png";


            if (userRepo.UsersIP != null && (userRepo.ActiveDI || Id == _userID))
            {
                pHeader._diip = Url.Action("View", "IP", new { Id = userRepo.UsersIP.Id });
            }
            else
            {
                if (Id == _userID || userRepo.ActiveDI)
                {
                    pHeader._diip = "None";
                }
                else
                {
                    pHeader._diip = "Inactive";
                }
            }
            pCard.header = pHeader;
            CardBodyPersonalModel pBody = new CardBodyPersonalModel();

            if (System.IO.File.Exists(HttpContext.Server.MapPath(userRepo.ImageURL)))
            {
                pBody._img = userRepo.ImageURL;
            }
            else
            {
                pBody._img = "/Images/common/no-image.jpg";
            }
            if (userRepo.ActiveEP || Id == _userID)
            {
                pBody._ep = userRepo.EPPoints;
            }
            else
            {
                pBody._ep = -1;
            }

            pBody._current = (userRepo.Id == _userID) ? true : false;
            if (Id != _userID)
            {
                if (_usersConnectionRepository.FirstOrDefault(x => x.UserId == _userID && x.User1.Id == Id && x.Type == VoicerConnectionType.CONNECTED.ToString(), x => x) == null)
                {
                    pBody._connected = false;
                }
                else
                {
                    pBody._connected = true;
                }
            }

            pBody._gallery = userRepo.ActiveGallery;
            pBody._voicers = userRepo.ActiveVoicer;
            pBody._spreads = userRepo.ActiveSpread;
            pCard.body     = pBody;

            model._pcard = pCard;

            // Ad Card
            dynamic ads = new ExpandoObject();

            ads.header = new CardHeaderModel()
            {
                _label = "Ad Box", _icon = "fa fa-ad"
            };
            ads.body = new CardBodyModel()
            {
                _style = "height:330px"
            };
            model._ads = ads;

            // Tab
            dynamic         tabs = new ExpandoObject();
            CardHeaderModel action_update_header = new CardHeaderModel()
            {
                _label = "Activity & Updates", _icon = "fa fa-flag", _num = lastActivityList.Count().ToString(),
                _class = "active", _link = "#tab_1", _open_folder = true, _open_folder_link = Url.Action("ActiveUpdateView", "IPSocial")
            };
            CardHeaderModel voicer_update_header = new CardHeaderModel()
            {
                _label       = "Voicer Updates", _icon = "fa fa-flag", _num = voicerSpreadList.Count().ToString(), _link = "#tab_2",
                _open_folder = true, _open_folder_link = Url.Action("VoicerUpdateView", "IPSocial")
            };
            CardHeaderModel ip_feeds_header = new CardHeaderModel()
            {
                _label       = "IP Feeds", _icon = "fa fa-flag", _num = ipSpreadList.Count().ToString(), _link = "#tab_3",
                _open_folder = true, _open_folder_link = Url.Action("IPFeedView", "IPSocial")
            };

            tabs.header = new CardHeaderTabsModel()
            {
                _header = new List <CardHeaderModel>()
                {
                    action_update_header, voicer_update_header, ip_feeds_header
                }
            };

            CardBodyListModel action_update_body = new CardBodyListModel()
            {
                _lst = lastActivityList, _class = "tab-pane active"
            };
            CardBodyListModel voicer_update_body = new CardBodyListModel()
            {
                _lst = voicerSpreadList, _class = "tab-pane"
            };
            CardBodyListModel ip_feeds_body = new CardBodyListModel()
            {
                _lst = ipSpreadList, _class = "tab-pane"
            };

            tabs.body = new List <CardBodyListModel>()
            {
                action_update_body, voicer_update_body, ip_feeds_body
            };
            model._tabs = tabs;

            // Ad stream
            dynamic adstream = new ExpandoObject();

            adstream.header = new CardHeaderModel()
            {
                _label = "Adstream", _icon = "fa fa-newspaper"
            };
            adstream.body = new CardBodyModel()
            {
                _text = "When the website will be online we can add share buttons to different social media"
            };
            model._adstream = adstream;

            // Live IP
            dynamic liveIP = new ExpandoObject();

            liveIP.header = new CardHeaderModel()
            {
                _label = "Live IP", _link = Url.Action("Create", "IPSocial"), _tooltip = "create a IP, start spreading"
            };
            liveIP.body = new CardBodyModel()
            {
            };
            model._liveIP = liveIP;

            // Spread Box
            dynamic spreadBox = new ExpandoObject();

            spreadBox.header = new CardHeaderModel()
            {
                _icon = "fa fa-share-alt", _label = "Spread box", _link = "#", _tooltip = "Spread box"
            };
            spreadBox.body = new CardBodyListModel()
            {
                _lst = lastSpreadList.Take(4).ToList(), _style = "height:200px;"
            };
            model._spreadBox = spreadBox;

            // Chat Wing
            dynamic chatWing = new ExpandoObject();

            chatWing.header = new CardHeaderModel()
            {
                _label = "Chat Wings", _tooltip = "Chat Wings", _link = "#"
            };
            chatWing.body = new CardBodyModel()
            {
                _text = "Chat you've bought"
            };
            model._chatWing = chatWing;

            ViewBag.userID = Id;

            FillBaseModel(model);
            return(View(model));
        }