public ActionResult FileBrowser(int?id, string q) { if (id.HasValue || !string.IsNullOrEmpty(q)) { ViewBag.Order = ""; ViewBag.Asc = false; ViewBag.FileID = 0; ViewBag.TopicID = id ?? 0; ViewBag.queryStr = q ?? ""; if (id.HasValue) { var topic = IPPRepository.GetTopicByID(id.Value, UserSettingHelper.GetEikonUserID(Request)); ViewBag.PageTitle = CultureHelper.IsEnglishCulture() ? topic["NAMEEN"] : topic["NAMECN"]; ViewBag.TruncatedPageTitle = HtmlUtil.Truncate(ViewBag.PageTitle, 30); ViewBag.ChatroomUrl = topic["RMLINK"]; ViewBag.Following = topic["FOLLOWING"]; } else { ViewBag.PageTitle = q; ViewBag.TruncatedPageTitle = HtmlUtil.Truncate(ViewBag.PageTitle, 30); ViewBag.ChatroomUrl = ""; ViewBag.Following = 0; } } else { return(RedirectToAction("IPPHome")); } return(View()); }
public ActionResult GetFilesForApproval(int moduleID, int topicID, string key, int pageNo, int pageSize, int status, bool isHtml = false) { var isEn = CultureHelper.IsEnglishCulture(); int total; var table = IPPRepository.GetFilesForApproval(moduleID, topicID, UserSettingHelper.GetEikonUserID(Request), key, pageNo, pageSize, isEn, status, out total); var data = new { Data = DatatableToJson(table), CurrentPage = pageNo, PageSize = pageSize, Total = total }; return(isHtml ? Json(data, "text/html", JsonRequestBehavior.AllowGet) : Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetFavoriteTopics(int moduleID, string userID, string topic, string order, int pageNo, int pageSize, bool isHtml = false) { var isEn = CultureHelper.IsEnglishCulture(); int total; var table = IPPRepository.GetFavoriteTopics(moduleID, UserSettingHelper.GetEikonUserID(Request), topic, order, pageNo, pageSize, isEn, out total); var data = new { Data = DatatableToJson(table), CurrentPage = pageNo, PageSize = pageSize, Total = total }; return(isHtml ? Json(data, "text/html", JsonRequestBehavior.AllowGet) : Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetTopicsByCreater(int moduleID, int pageNo, int pageSize, bool isHtml = false) { int total; var table = IPPRepository.GetTopicsByCreater(moduleID, UserSettingHelper.GetEikonUserID(Request), pageNo, pageSize, out total); var data = new { Data = DatatableToJson(table), CurrentPage = pageNo, PageSize = pageSize, Total = total }; return(isHtml ? Json(data, "text/html", JsonRequestBehavior.AllowGet) : Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteFileByID(int id) { var result = IPPRepository.DeleteFile(id, UserSettingHelper.GetEikonUserID(Request)); string message = ""; if (result == 1) { message = "Error."; } var data = new { Result = result, Message = message }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetTopicName(int id) { var topic = IPPRepository.GetTopicByID(id, UserSettingHelper.GetEikonUserID(Request)); var data = new { Name = CultureHelper.IsEnglishCulture() ? topic["NAMEEN"] : topic["NAMECN"], TruncatedName = HtmlUtil.Truncate(CultureHelper.IsEnglishCulture() ? topic["NAMEEN"].ToString() : topic["NAMECN"].ToString(), 30), ChatroomUrl = topic["RMLINK"], Following = topic["FOLLOWING"] }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult GetFileInfo(long id) { var file = IPPRepository.DownloadFile(id, UserSettingHelper.GetEikonUserID(Request)); switch (file.UPLOADTYPE) { case ConstValues.IPP_Upload_File: return(Json(new { type = "file", url = Url.Action("DownloadFile", new { id = id }) }, JsonRequestBehavior.AllowGet)); case ConstValues.IPP_Upload_Ric: return(Json(new { type = "ric", ricType = file.FILETYPE, ricVal = file.RIC }, JsonRequestBehavior.AllowGet)); case ConstValues.IPP_Upload_WebSite: return(Json(new { type = "url", url = file.RIC }, JsonRequestBehavior.AllowGet)); default: return(HttpNotFound()); } }
public ActionResult DeleteTopic(int id) { var result = IPPRepository.DeleteTopic(id, UserSettingHelper.GetEikonUserID(Request)); var message = ""; switch (result) { case 1: message = Resources.IPP.IPP_FileExist; break; case 2: message = "unknown error, try again later"; break; default: message = ""; break; } var data = new { Result = result, Message = message }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult UpdateFileStatus(int id, string operation) { int status = 1; switch (operation) { case "publish": status = 1; break; case "approve": status = 2; break; case "reject": status = 3; break; case "delete": return(DeleteFileByID(id)); default: break; } int ret = IPPRepository.UpdateFileStatus(id, status, UserSettingHelper.GetEikonUserID(Request)); string message = ""; if (ret == 1) { message = Resources.IPP.IPP_Already_Approve; } var data = new { Result = ret, Message = message }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult TopicEditor(int?id) { var topicCreate = id == null ? new TopicCreate() : IPPRepository.GetTopicById((int)id); IPPTopic ippTopic; topicCreate = topicCreate ?? new TopicCreate(); var moduleItems = new List <SelectListItem>(); IEnumerable <MODULEINFO> modules = IPPRepository.GetModuleList(); foreach (var m in modules) { moduleItems.Add(new SelectListItem { Value = m.ID.ToString(), Selected = m.ID == topicCreate.ModuleID ? true : false, Text = CultureHelper.IsEnglishCulture() ? m.NAMEEN : m.NAMECN }); } ippTopic = new IPPTopic { ID = topicCreate.ID, DescriptionCn = topicCreate.DescriptionCn, DescriptionEn = topicCreate.DescriptionEn, Tag = topicCreate.Tag, NameCn = topicCreate.NameCn, NameEn = topicCreate.NameEn, ModuleItems = moduleItems, Approver = string.IsNullOrEmpty(topicCreate.Approver) ? UserSettingHelper.GetEikonUserID(Request) : topicCreate.Approver, IsApprove = topicCreate.IsApprove, IsDirectDelete = topicCreate.IsDirectDelete, IsInternalApprove = topicCreate.IsInternalApprove, ModuleID = topicCreate.ModuleID.ToString(), RMLink = topicCreate.RMLink, Thumbnail = topicCreate.Thumbnail, ImageName = topicCreate.ImageName }; return(View(ippTopic)); }
public ActionResult UploadTopic(IPPTopic ippTopic, HttpPostedFileBase image) { var tmp = ippTopic.Approver.Replace(';', ';').Trim(); if (tmp[tmp.Length - 1] != ';') { ippTopic.Approver += ";"; } var topicCreate = new TopicCreate { ID = ippTopic.ID, DescriptionCn = ippTopic.DescriptionCn, DescriptionEn = ippTopic.DescriptionEn, IsApprove = ippTopic.IsApprove, IsInternalApprove = ippTopic.IsInternalApprove, IsDirectDelete = ippTopic.IsDirectDelete, Approver = ippTopic.Approver, RMLink = ippTopic.RMLink, Tag = ippTopic.Tag, NameCn = ippTopic.NameCn, NameEn = ippTopic.NameEn, ModuleID = Convert.ToInt32(ippTopic.ModuleID), Creater = UserSettingHelper.GetEikonUserID(Request), ImageName = ippTopic.ImageName }; if (image != null && image.ContentLength > 0) { topicCreate.Thumbnail = new byte[image.ContentLength]; image.InputStream.Read(topicCreate.Thumbnail, 0, image.ContentLength); } IPPRepository.UploadTopic(topicCreate); return(Redirect("~/ipp/MyDocument/topicManagement")); }
public ActionResult FileEditor(long?id, int?topicid, string previousRequest) { FileCreate fileCreate = null; if (id == null) { fileCreate = new FileCreate(); var eikonUserId = UserSettingHelper.GetEikonUserID(Request); var submitter = IPPRepository.GeSubmitterById(eikonUserId); fileCreate.SubmitterID = submitter.ID; fileCreate.SubmiterName = submitter.Name; fileCreate.Submiter = submitter.Email; } else { fileCreate = IPPRepository.GetFileByFileID((long)id); } IPPFile ippFile; fileCreate = fileCreate ?? new FileCreate(); var moduleItems = new List <SelectListItem>(); var topicItems = new List <SelectListItem>(); var ricTypeItems = new List <SelectListItem>(); var uploadTypeItems = HtmlUtil.CookSelectOptions("Ipp_UploadType"); if (id != null) { topicid = IPPRepository.GetTopicIdByFileId(id); } IEnumerable <MODULEINFO> modules = IPPRepository.GetModuleList(); var moduleId = (topicid == null || topicid == 0)? modules.FirstOrDefault().ID : (int)IPPRepository.GetModuleIdByTopicId((int)topicid); var topics = IPPRepository.GetTopicListByModuleId(moduleId); foreach (var m in modules) { moduleItems.Add(new SelectListItem { Selected = m.ID == moduleId ? true : false, Value = m.ID.ToString(), Text = CultureHelper.IsEnglishCulture() ? m.NAMEEN : m.NAMECN }); } var selectedTopicId = topicid == null?topics.FirstOrDefault().ID : topicid; foreach (var m in topics) { topicItems.Add(new SelectListItem { Selected = m.ID == selectedTopicId ? true : false, Value = m.ID.ToString(), Text = CultureHelper.IsEnglishCulture() ? m.NAMEEN : m.NAMECN }); } ricTypeItems.Add(new SelectListItem { Value = "Graph", Text = "Chart" }); ricTypeItems.Add(new SelectListItem { Value = "Quote Object", Text = "Quote" }); ricTypeItems.Add(new SelectListItem { Value = "News", Text = "News" }); var userAttibuteMap = UserSettingHelper.GetUserAttributeMap(Request); var author = userAttibuteMap == null ? "" : userAttibuteMap.First(x => x.name.ToLower() == "FullName".ToLower()).value; var source = userAttibuteMap == null ? "" : userAttibuteMap.First(x => x.name.ToLower() == "AccountName".ToLower()).value; if (UserSettingHelper.IsInternalUser(Request)) { source = "Thomson Reuters"; } ippFile = new IPPFile { Id = fileCreate.ID, Author = string.IsNullOrEmpty(fileCreate.Author) ? author : fileCreate.Author, AuthorRM = fileCreate.AuthorRM, AuthorEmail = fileCreate.AuthorEmail, DescriptionCn = fileCreate.DescrCn, DescriptionEn = fileCreate.DescrEn, UploadType = fileCreate.UploadType, FileType = fileCreate.FileType, WebsiteRic = fileCreate.UploadType == "Upload_Website" ? fileCreate.RIC : "", EikonRic = fileCreate.UploadType == "Upload_Ric" ? fileCreate.RIC : "", ReportDate = fileCreate.ReportDate.ToString("yyyy-MM-dd"), SubmitterID = fileCreate.SubmitterID, SubmiterName = fileCreate.SubmiterName, Submiter = fileCreate.Submiter, Tag = fileCreate.Tag != null?fileCreate.Tag.Replace('|', ';') : fileCreate.Tag, TitleCn = fileCreate.TitleCn, TitleEn = fileCreate.TitleEn, ModuleItems = moduleItems, Topic = selectedTopicId.ToString(), TopicItems = topicItems, UploadTypeItems = uploadTypeItems, RicTypeItems = ricTypeItems, Source = string.IsNullOrEmpty(fileCreate.Source) ? source : fileCreate.Source, PreviousRequest = previousRequest, Status = fileCreate.Status, FileName = fileCreate.FileName, DisplayOrder = fileCreate.DisplayOrder }; return(View(ippFile)); }
public ActionResult QueryFiles(int id, string q, string title, string author, DateTime?startDate, DateTime?endDate, bool enableDate, string description, string source, int pageNo, int pageSize, string order, bool isHtml = false, long fileID = 0) { var isEn = CultureHelper.IsEnglishCulture(); int total; var table = IPPRepository.QueryFiles(id, q, title, author, startDate, endDate, enableDate, description, source, pageNo, pageSize, order, isEn, UserSettingHelper.GetEikonUserID(Request), out total, fileID); var data = new { Data = DatatableToJson(table), CurrentPage = pageNo, PageSize = pageSize, Total = total }; return(isHtml ? Json(data, "text/html", JsonRequestBehavior.AllowGet) : Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult FollowTopic(int id) { IPPRepository.FollowTopic(UserSettingHelper.GetEikonUserID(Request), id); return(Content("")); }