public ActionResult WikiDocumentTree() { SharePointDAL dal = new SharePointDAL(); List <WikiDocuments> listOfWikiDoc = dal.GetWikiDocumentTree(Server); return(PartialView("_WikiDocumentTree", listOfWikiDoc)); }
/// <summary> /// Fetch the banners displayed on the home page /// </summary> /// <returns></returns> private BannersList FetchAndCacheBanners() { BannersList bannersList = new BannersList(); try { if (Session["BannersList"] == null) { //IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL dal = new SharePointDAL(); bannersList.BannersListdetails = dal.GetBanners(); Session["BannersList"] = bannersList; } else { bannersList = (BannersList)Session["BannersList"]; } } catch (Exception ex) { UserManager user = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "Home,FetchAndCacheBanners", ex.Message, ex.StackTrace)); } return(bannersList); }
public ActionResult GetEventsItems() { //IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL dal = new SharePointDAL(); List <AcademyEvent> academyEvents = dal.GetEvents(); //Get the list of events return(PartialView("_Events", academyEvents)); }
public PartialViewResult TrainingContents(int id) { //IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL dal = new SharePointDAL(); List <TrainingPlan> trainingPlans = dal.GetTrainingPlans(id); //Get the Training Plan based on ID. return(PartialView("_TrainingPlanContent", trainingPlans)); }
public ActionResult GetNewsItems() { //IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL dal = new SharePointDAL(); string noImagePath = Server.MapPath(Url.Content("~/Images/noimage.png")); List <News> NewsList = dal.GetNews(noImagePath); //Gets the list of News items to be displayed in the Home Page. return(PartialView("_News", NewsList)); }
public JsonResult UploadProfile(HttpPostedFileBase uploadedFile) { try { if (uploadedFile != null && uploadedFile.ContentLength > 0) { if (uploadedFile.ContentType == "application/doc" || uploadedFile.ContentType == "application/docx" || uploadedFile.ContentType == "application/octet-stream" || uploadedFile.ContentType == "application/msword" || uploadedFile.ContentType == "application/x-msw6" || uploadedFile.ContentType == "application/x-msword" || uploadedFile.ContentType == "application/pdf" || uploadedFile.ContentType == "application/x-pdf" || uploadedFile.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document") { byte[] fileByteArray = new byte[uploadedFile.ContentLength]; uploadedFile.InputStream.Read(fileByteArray, 0, uploadedFile.ContentLength); SharePointDAL dal = new SharePointDAL(); UserManager user = (UserManager)Session["CurrentUser"]; string fileName = user.UserName + "_Profile." + uploadedFile.FileName.Split('.').Last(); dal.UploadProfile(fileName, fileByteArray); return(Json(new { statusCode = 200, status = true, message = "Profile Uploaded Successfully.", }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { statusCode = 400, status = false, message = "Please upload files having extensions: <strong>.doc , .docx, .pdf</strong> only.", }, JsonRequestBehavior.AllowGet)); } } } catch (Exception ex) { UserManager user = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "OnBoard, UploadProfile", ex.Message, ex.StackTrace)); } return(Json(new { statusCode = 400, status = false, message = "Bad Request! Upload Failed", }, JsonRequestBehavior.AllowGet)); }
public FileResult DownloadWikiFile(string filePath) { string decryptFileName = EncryptionHelper.Decrypt(filePath); //Decrypt the File Name string fileName = decryptFileName.Substring(decryptFileName.LastIndexOf('/') + 1); SharePointDAL dal = new SharePointDAL(); System.IO.Stream fileBytes = dal.DownloadDocument(decryptFileName); //Download the selected document. return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName)); }
public ActionResult WikiPolicy() { try { //Get Policy Items SharePointDAL dal = new SharePointDAL(); WikiPolicyDocuments poldocs = dal.GetWikiPolicyDocuments(); return(View(poldocs)); } catch (Exception ex) { UserManager user = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "Wiki, WikiPolicy", ex.Message, ex.StackTrace)); throw; } }
public PartialViewResult GetMyProfile() { //IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL dal = new SharePointDAL(); UserManager user = new UserManager(); try { user = dal.GetCurrentUserCompleteUserProfile(); } catch (Exception ex) { UserManager users = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, users.EmailID.ToString(), AppConstant.ApplicationName, "Home,CacheSiteMenu", ex.Message, ex.StackTrace)); } return(PartialView("_MyProfile", user)); }
public ActionResult TrainingDocumentTree(string folder) { WikiPolicyDocuments poldocs = new WikiPolicyDocuments(); try { SharePointDAL spDal = new SharePointDAL(); poldocs = spDal.GetWikiDocumentTree(Server, folder); return(PartialView("_TrainingMaterials", poldocs.ListOfWikiDoc)); } catch (Exception ex) { UserManager user = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "Training, TrainingDocumentTree", ex.Message, ex.StackTrace)); throw; } }
public ActionResult Index() { try { //IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL dal = new SharePointDAL(); List <AcademyVideo> lstAcademyVideo = dal.GetAllAcademyVideos(); return(View(lstAcademyVideo)); } catch (Exception ex) { UserManager user = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "AcademyVideo, Index", ex.Message, ex.StackTrace)); throw; } }
public ActionResult NewsEvents() { try { // IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL dal = new SharePointDAL(); string noImagePath = Server.MapPath(Url.Content("~/Images/noimage.png")); ViewBag.annclst = dal.GetNews(noImagePath); ViewBag.EventsList = dal.GetEvents(); ViewBag.RssFeedVB = dal.GetRSSFeeds(); } catch (Exception ex) { UserManager user = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, user.EmailID.ToString(), AppConstant.ApplicationName, "News, NewsEvents", ex.Message, ex.StackTrace)); } return(View()); }
public FileResult DownloadFile(string filePath) { string decryptFileName = EncryptionHelper.Decrypt(filePath); SharePointDAL spDal = new SharePointDAL(); Stream fileBytes = spDal.DownloadDocument(decryptFileName); try { string fileName = decryptFileName.Substring(decryptFileName.LastIndexOf('/') + 1); string url = ConfigurationManager.AppSettings["URL"].ToString(); return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName)); } catch (Exception ex) { UserManager users = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, users.EmailID.ToString(), AppConstant.ApplicationName, "Home,DownloadFile", ex.Message, ex.StackTrace)); return(null); } }
public void CacheLogo() { try { if (Session["LogoBase64Image"] == null) { SharePointDAL dal = new SharePointDAL(); string logoSource = ConfigurationManager.AppSettings["LogoSource"].ToString(); if (logoSource.Equals("SharePoint")) { Session["LogoBase64Image"] = dal.GetBase64BitLogoImageStream(); } else { Session["LogoBase64Image"] = ConfigurationManager.AppSettings["ClientLogo"].ToString(); } } } catch (Exception ex) { UserManager users = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, users.EmailID.ToString(), AppConstant.ApplicationName, "Home,CacheLogo", ex.Message, ex.StackTrace)); } }
/// <summary> /// Get the Certificate to be downloaded using ID /// </summary> /// <param name="id"></param> /// <returns></returns> public FileResult DownloadCertificate(int id) { IDAL dal = (new DALFactory()).GetInstance(); SharePointDAL spDal = new SharePointDAL(); try { string certificateHtml = string.Empty; MemoryStream workStream = new MemoryStream(); string strPDFFileName = string.Format("Certificate.pdf"); UserManager user = (UserManager)System.Web.HttpContext.Current.Session["CurrentUser"]; user = spDal.GetUserByEmail(user.EmailID); List <UserAssessment> userAssessments = dal.GetUserAssessmentsByID(id); foreach (UserAssessment userAssessment in userAssessments) { certificateHtml = "<HTML><HEAD><TITLE>Certificate of Completion</TITLE>" + "<META content='text/html; charset=utf-8' http-equiv=Content-Type> <META name=viewport content='width=device-width, initial-scale=1.0'> <META name=GENERATOR content='MSHTML 11.00.9600.18698'></HEAD>" + "<BODY> <TABLE style='PADDING: 5px; MARGIN: 10px 10%; BACKGROUND-COLOR: #fee2cf'>" + " <TR> <TD style='BORDER: #ff6600 10px solid; PADDING: 10px; margin:10px;'> <TABLE >" + " <TR> <TD style='BORDER: #ff6600 2px solid; BACKGROUND-COLOR: #fff;'> <TABLE>" + " <TR> <TD style=' BACKGROUND-COLOR: #ffffff'> <TABLE>" + " <TR> <TD style='WIDTH: 100%;'>" + " <TABLE style='WIDTH: 100%'>" + "<TR> <TD align=center> <TABLE> <TR> <TD style='FONT-SIZE: 25px; FONT-FAMILY: georgia'>ING Academy</TD></TR></TABLE></TD></TR>" + " <TR> <TD style='FONT-SIZE: 30px; FONT-FAMILY: Tahoma, Geneva, sans-serif; COLOR: #ff6200; TEXT-ALIGN: center; PADDING-TOP: 10px' align=center>Certificate of Completion</TD></TR>" + " <TR> <TD style='FONT-SIZE: 14px; FONT-FAMILY: Tahoma, Geneva, sans-serif; COLOR: #666; TEXT-ALIGN: center; PADDING-TOP: 20px'>This is certify that</TD></TR> " + "<TR> <TD style='FONT-SIZE: 18px; FONT-FAMILY: \"Times New Roman\", Times, serif; FONT-WEIGHT: bold; COLOR: #000; TEXT-ALIGN: center'>" + user.UserName + "</TD></TR>" + " <TR> <TD style='FONT-SIZE: 14px; FONT-FAMILY: Tahoma, Geneva, sans-serif; COLOR: #666; TEXT-ALIGN: center; PADDING-TOP: 10px'>has successfully completed</TD></TR>" + " <TR> <TD style='FONT-SIZE: 16px; FONT-FAMILY: \"Times New Roman\", Times, serif; COLOR: #000; PADDING-BOTTOM: 30px; TEXT-ALIGN: center'>" + userAssessment.TrainingAssessment + "</TD></TR>" + "</TABLE>" + " <TABLE style='WIDTH: 100%'> " + " <TR>" + "<TD style='HEIGHT: 50px; WIDTH: 150px; BACKGROUND-REPEAT: no-repeat; PADDING-LEFT: 10px'>" + " Your Score - " + userAssessment.MarksInPercentage + "%</TD> " + "<TD style='FONT-SIZE: 14px; FONT-FAMILY: Tahoma, Geneva, sans-serif; COLOR: #000; TEXT-ALIGN: right; PADDING-TOP: 0px; PADDING-RIGHT: 10px'>" + userAssessment.CompletedDate + "</TD></TR></TABLE>" + "</TD></TR>" + "</TABLE></TD></TR>" + "</TABLE></TD></TR>" + "</TABLE></TD></TR>" + "</TABLE></BODY></HTML>"; } Bitmap bitmap = new Bitmap(1800, 1800); Graphics g = Graphics.FromImage(bitmap); XGraphics xg = XGraphics.FromGraphics(g, new XSize(bitmap.Width, bitmap.Height)); TheArtOfDev.HtmlRenderer.PdfSharp.HtmlContainer c = new TheArtOfDev.HtmlRenderer.PdfSharp.HtmlContainer(); c.SetHtml(certificateHtml); PdfDocument pdf = new PdfDocument(); PdfPage page = new PdfPage(); XImage img = XImage.FromGdiPlusImage(bitmap); page.Size = PdfSharp.PageSize.A4; pdf.Pages.Add(page); XGraphics xgr = XGraphics.FromPdfPage(pdf.Pages[0]); c.PerformLayout(xgr); c.PerformPaint(xgr); xgr.DrawImage(img, 0, 0); pdf.Save(workStream, false); byte[] byteInfo = workStream.ToArray(); workStream.Write(byteInfo, 0, byteInfo.Length); workStream.Position = 0; return(File(workStream, "application/pdf", strPDFFileName)); } catch (Exception ex) { UserManager users = (UserManager)Session["CurrentUser"]; LogHelper.AddLog(new LogEntity(AppConstant.PartitionError, users.EmailID.ToString(), AppConstant.ApplicationName, "Home,DownloadCertificate", ex.Message, ex.StackTrace)); return(null); } }
public FileStreamResult GetVideoStream(string url) { SharePointDAL dal = new SharePointDAL(); return(dal.GetVideoStream(url)); }