public JsonResult SXSS_S1_CommentList() { SXSS_S1_CommentListResponse response = XSS_BusinessServices.SXSS_S1_CommentList(Session.SessionID); string commentListHTML = RazorViewToString.RenderRazorViewToString(this, "~/Views/Xss/StoredXss/_CommentList.cshtml", response); return(Json(new object[] { commentListHTML, response })); }
public ActionResult AddAspect(BaroAspect aspect) { aspect.parent_id = (aspect.parent_id == 0) ? null : aspect.parent_id; if (aspect.parent_id == null) // Als node geen parent heeft is het een head aspect { aspect.is_head_aspect = 1; } _db.BaroAspects.InsertOnSubmit(aspect); _db.SubmitChanges(); // Haal de tree op BaroTreeViewWrapper viewModel = _db.BaroTemplates.Where(r => r.id == aspect.baro_template_id) .Select(r => new BaroTreeViewWrapper { Template = r, HeadAspect = r.BaroAspects.Where(d => d.is_head_aspect == 1 && d.parent_id == null || d.parent_id == 0).ToList() }).FirstOrDefault(); string treeHtml = RazorViewToString.RenderRazorViewToString(this, "_BaroTreePartial", viewModel); ViewBag.parent_id = aspect.parent_id; string selectHtml = RazorViewToString.RenderRazorViewToString(this, "_BaroSelectParents", viewModel); return(Json(new { status = "success", html_tree = treeHtml, html_select = selectHtml }, JsonRequestBehavior.AllowGet)); }
public ActionResult DownloadPdf(string Pm, string id) { using (MemoryStream stream = new System.IO.MemoryStream()) { string LogoPath = Convert.ToString(Session["LogoPath"]); var base64DecodedBytes = System.Convert.FromBase64String(Pm); string BillNoValue = System.Text.Encoding.UTF8.GetString(base64DecodedBytes); // string CurrentPartyCode = ""; try { //CurrentPartyCode = (Session["LoginUser"] as User).PartyCode; DistributorBillModel model = objTransacManager.getInvoice(BillNoValue, "", "F"); if (model == null) { model = new DistributorBillModel(); } if (model.BillNo != null) { string result = string.Empty; ConnModel objCon; objCon = (System.Web.HttpContext.Current.Session["ConModel"] as ConnModel); if (objCon.CompID == "1008") { result = RazorViewToString.RenderRazorViewToString(this, "../Transaction/InvoicePrint-Sunvis", model); } else { result = RazorViewToString.RenderRazorViewToString(this, "../Transaction/InvoicePrint", model); } //string imagePath = System.Web.HttpContext.Current.Server.MapPath("~/images"); //imagePath = Path.Combine(imagePath, "logo.png"); result = result.Replace("/images/logo.png", LogoPath); StringReader sr = new StringReader(result); Document pdfDoc = new Document(PageSize.A4, 25f, 25f, 0f, 0f); PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr); pdfDoc.Close(); return(File(stream.ToArray(), "application/pdf", "Invoice_" + model.BillNo + ".pdf")); } else { string imagePath = System.Web.HttpContext.Current.Server.MapPath("~/images"); imagePath = Path.Combine(imagePath, "NoImage.jpg"); //result = result.Replace("/images/NoImage.jpg", imagePath); return(File(imagePath, "Invoice.pdf")); } } catch (Exception ex) { } } return(null); }
public string GetPedigreeCertificate(PedigreeMain pedigree, object Controller) { try { string cert = RazorViewToString.RenderRazorViewToString((System.Web.Mvc.Controller)ControllerContext.Controller, "PedigreeCertificate", pedigree); return(cert); } catch (Exception) { } return(null); }
public ActionResult OnlineUserCount() { SessionUserModel activeSessionUser = SessionCountHelper.SessionUserList.FirstOrDefault(x => x.SessionID == Session.SessionID); SessionCountHelper.SessionUserList.Select(x => { x.IsActiveSession = false; return(x); }).ToList(); if (activeSessionUser != null) { activeSessionUser.IsActiveSession = true; } SessionCountHelper.SessionUserList = SessionCountHelper.SessionUserList.OrderByDescending(x => x.IsActiveSession).Take(10).ToList(); ViewData["SessionCount"] = SessionCountHelper.SessionCount; ViewData["SessionUserList"] = RazorViewToString.RenderRazorViewToString(this, "~/Views/User/_SessionUserList.cshtml", SessionCountHelper.SessionUserList); return(PartialView("~/Views/Shared/PartialLayout/_SessionCount.cshtml")); }
public JsonResult SXSS_S1_Comment(SXSS_S1_CommentRequest request) { SXSS_S1_CommentListResponse response = new SXSS_S1_CommentListResponse(); if (!GoogleRecaptchaControl(request.SXSS_S1_CommentRequest_gReCaptcha)) { response.IsSuccess = false; response.Message = "Not valid gReCaptcha!"; response.ResponseCode = 400; } else { response = XSS_BusinessServices.SXSS_S1_Comment(request); } string commentListHTML = RazorViewToString.RenderRazorViewToString(this, "~/Views/Xss/StoredXss/_CommentList.cshtml", response); return(Json(new object[] { commentListHTML, response })); }
public JsonResult RXSS_S3_Delete(RXSS_S3_DeleteRequest request) { RXSS_S3_UserListResponse response = new RXSS_S3_UserListResponse(); if (Session["LoginUserRole" + Session.SessionID].ToString() == "Admin") { response = XSS_BusinessServices.RXSS_S3_Delete(request); } else { response.IsSuccess = false; response.Message = Lang.Global_Unauthorize; response.ResponseCode = 403; } string userListHTML = RazorViewToString.RenderRazorViewToString(this, "~/Views/Xss/ReflectedXss/_UserList.cshtml", response); return(Json(new object[] { userListHTML, response })); }
public JsonResult RXSS_S3_Register(RXSS_S3_RegisterRequest request) { RXSS_S3_UserListResponse response = new RXSS_S3_UserListResponse(); if (!GoogleRecaptchaControl(request.RXSS_S3_RegisterRequest_gReCaptcha)) { response.IsSuccess = false; response.Message = Lang.Global_GReCaptcha; response.ResponseCode = 400; } else { response = XSS_BusinessServices.RXSS_S3_Register(request); Session["LoginUserRole" + Session.SessionID] = response.LoginUser.UserRole; } string userListHTML = RazorViewToString.RenderRazorViewToString(this, "~/Views/Xss/ReflectedXss/_UserList.cshtml", response); return(Json(new object[] { userListHTML, response })); }
public ActionResult DownloadPdf(string Pm, string id) { using (MemoryStream stream = new System.IO.MemoryStream()) { var base64DecodedBytes = System.Convert.FromBase64String(Pm); string BillNoValue = System.Text.Encoding.UTF8.GetString(base64DecodedBytes); string CurrentPartyCode = ""; DistributorBillModel model = objTransacManager.getInvoice(BillNoValue, CurrentPartyCode, id); if (model == null) { model = new DistributorBillModel(); } if (model.BillNo != null) { string result = RazorViewToString.RenderRazorViewToString(this, "../Transaction/InvoicePrint", model); string imagePath = System.Web.HttpContext.Current.Server.MapPath("~/images"); imagePath = Path.Combine(imagePath, "logo.png"); result = result.Replace("/images/logo.png", imagePath); StringReader sr = new StringReader(result); Document pdfDoc = new Document(PageSize.A4, 25f, 25f, 0f, 0f); PdfWriter writer = PdfWriter.GetInstance(pdfDoc, stream); pdfDoc.Open(); XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr); pdfDoc.Close(); return(File(stream.ToArray(), "application/pdf", "Invoice_" + model.BillNo + ".pdf")); } else { string imagePath = System.Web.HttpContext.Current.Server.MapPath("~/images"); imagePath = Path.Combine(imagePath, "NoImage.jpg"); //result = result.Replace("/images/NoImage.jpg", imagePath); return(File(imagePath, "Invoice.pdf")); } } }
public ActionResult SearchName(string name) { var validationResults = new ValidationResultList(); var success = false; var view = default(string); if (ValidateName(name, validationResults)) { var viewModel = GitHubService.SearchByName(name, validationResults); if (!ValidationResults.AnyErrorOrInvalid(validationResults)) { success = true; view = RazorViewToString.RenderRazorViewToString(this, "~/Views/Results/_results.cshtml", viewModel); } } return(Json(new { success, view, validationResults })); }