public HttpResponseMessage GetNewsDetails(int nNewsID, int nLanguageID) { TakamulNews oTakamulNews = null; NewsViewModel oNewsViewModel = this.oINewsServices.oGetNewsDetails(nNewsID); if (oNewsViewModel != null) { string sRemoteFilePath = string.Empty; if (!string.IsNullOrEmpty(oNewsViewModel.NEWS_IMG_FILE_PATH)) { sRemoteFilePath = Path.Combine(CommonHelper.sGetConfigKeyValue(ConstantNames.RemoteFileServerPath), oNewsViewModel.NEWS_IMG_FILE_PATH); } oTakamulNews = new TakamulNews() { NewsID = oNewsViewModel.ID, ApplicationID = oNewsViewModel.APPLICATION_ID, NewsContent = oNewsViewModel.NEWS_CONTENT, NewsTitle = oNewsViewModel.NEWS_TITLE, PublishedDate = string.Format("{0} {1}", oNewsViewModel.PUBLISHED_DATE.ToShortDateString(), oNewsViewModel.PUBLISHED_DATE.ToShortTimeString()), RemoteFilePath = sRemoteFilePath, YoutubeLink = oNewsViewModel.YOUTUBE_LINK }; } return(Request.CreateResponse(HttpStatusCode.OK, oTakamulNews)); }
public HttpResponseMessage GetAllNews(int nApplicationID, int nLanguageID) { List <TakamulNews> lstTakamulNews = null; try { var lstNews = this.oINewsServices.IlGetAllActiveNews(nApplicationID, nLanguageID); if (lstNews.Count() > 0) { lstTakamulNews = new List <TakamulNews>(); foreach (var news in lstNews) { string sRemoteFilePath = string.Empty; if (!string.IsNullOrEmpty(news.NEWS_IMG_FILE_PATH)) { sRemoteFilePath = Path.Combine(CommonHelper.sGetConfigKeyValue(ConstantNames.RemoteFileServerPath), news.NEWS_IMG_FILE_PATH); } TakamulNews oTakamulNews = new TakamulNews() { NewsID = news.ID, ApplicationID = news.APPLICATION_ID, NewsContent = news.NEWS_CONTENT, NewsTitle = news.NEWS_TITLE, PublishedDate = string.Format("{0} {1}", news.PUBLISHED_DATE.ToShortDateString(), news.PUBLISHED_DATE.ToShortTimeString()), RemoteFilePath = sRemoteFilePath, YoutubeLink = news.YOUTUBE_LINK }; lstTakamulNews.Add(oTakamulNews); } } } catch (Exception ex) { Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(ex)); } return(Request.CreateResponse(HttpStatusCode.OK, lstTakamulNews)); }
public HttpResponseMessage GetHomePageData(int nApplicationID, int nUserID, int nLanguageID) { HomePageRepo oHomePageRepo = new HomePageRepo(); List <TakamulTicket> lstTakamulTicket = null; if (nUserID != -99) { var lstTickets = this.oITicketServices.IlGetAllActiveTickets(nApplicationID, nUserID); if (lstTickets.Count > 0) { lstTakamulTicket = new List <TakamulTicket>(); foreach (var ticket in lstTickets.OrderByDescending(x => x.ID).Take(5)) { string sRemoteFilePath = string.Empty; if (!string.IsNullOrEmpty(ticket.DEFAULT_IMAGE)) { sRemoteFilePath = Path.Combine(CommonHelper.sGetConfigKeyValue(ConstantNames.RemoteFileServerPath), ticket.DEFAULT_IMAGE); } TakamulTicket oTakamulTicket = new TakamulTicket() { TicketID = ticket.ID, TicketCode = ticket.TICKET_CODE, ApplicationID = ticket.APPLICATION_ID, TicketName = ticket.TICKET_NAME, TicketDescription = ticket.TICKET_DESCRIPTION, TicketStatusID = ticket.TICKET_STATUS_ID, TicketStatusRemark = ticket.TICKET_STATUS_REMARK, TicketStatusName = ticket.TICKET_STATUS_NAME, RemoteFilePath = sRemoteFilePath, CreatedDate = string.Format("{0} {1}", ticket.CREATED_DATE.ToShortDateString(), ticket.CREATED_DATE.ToShortTimeString()) }; lstTakamulTicket.Add(oTakamulTicket); } oHomePageRepo.TakamulTicketList = lstTakamulTicket; } } List <TakamulNews> lstTakamulNews = null; var lstNews = this.oINewsServices.IlGetAllActiveNews(nApplicationID, nLanguageID); if (lstNews.Count() > 0) { lstTakamulNews = new List <TakamulNews>(); foreach (var news in lstNews.OrderByDescending(x => x.ID).Take(5)) { string sRemoteFilePath = string.Empty; if (!string.IsNullOrEmpty(news.NEWS_IMG_FILE_PATH)) { sRemoteFilePath = Path.Combine(CommonHelper.sGetConfigKeyValue(ConstantNames.RemoteFileServerPath), news.NEWS_IMG_FILE_PATH); } TakamulNews oTakamulNews = new TakamulNews() { NewsID = news.ID, ApplicationID = news.APPLICATION_ID, NewsContent = news.NEWS_CONTENT, NewsTitle = news.NEWS_TITLE, PublishedDate = string.Format("{0} {1}", news.PUBLISHED_DATE.ToShortDateString(), news.PUBLISHED_DATE.ToShortTimeString()), RemoteFilePath = sRemoteFilePath }; lstTakamulNews.Add(oTakamulNews); } oHomePageRepo.TakamulNewsList = lstTakamulNews; } List <TakamulEvents> lstTakamulEvents = null; var lstEvents = this.oIEventsServices.IlGetAllActiveEvents(nApplicationID, nLanguageID); if (lstEvents.Count() > 0) { lstTakamulEvents = new List <TakamulEvents>(); foreach (var oEvent in lstEvents.OrderByDescending(x => x.ID).Take(5)) { string sRemoteFilePath = string.Empty; if (!string.IsNullOrEmpty(oEvent.EVENT_IMG_FILE_PATH)) { sRemoteFilePath = Path.Combine(CommonHelper.sGetConfigKeyValue(ConstantNames.RemoteFileServerPath), oEvent.EVENT_IMG_FILE_PATH); } TakamulEvents oTakamulEvents = new TakamulEvents() { EventID = oEvent.ID, APPLICATIONID = oEvent.APPLICATION_ID, EVENTDESCRIPTION = oEvent.EVENT_DESCRIPTION, EVENTNAME = oEvent.EVENT_NAME, EVENTDATE = string.Format("{0} {1}", oEvent.EVENT_DATE.ToShortDateString(), oEvent.EVENT_DATE.ToShortTimeString()), Latitude = oEvent.EVENT_LATITUDE, Longitude = oEvent.EVENT_LONGITUDE, RemoteFilePath = sRemoteFilePath }; lstTakamulEvents.Add(oTakamulEvents); } oHomePageRepo.TakamulEventList = lstTakamulEvents; } return(Request.CreateResponse(HttpStatusCode.OK, oHomePageRepo)); }