//Editor #region public ActionResult Editor(string qpDocId) { var dal = new QP_Repository(); var mdl = new Models.Editor(); var docDetails = dal.DocumentDetails(qpDocId); //var docxPath = Path.GetTempFileName().Replace(".tmp", ".docx"); //System.IO.File.WriteAllBytes(docxPath, docDetails.Document); var htmlPath = Path.GetTempFileName().Replace(".tmp", ".html"); mdl.DocId = qpDocId; try { RtfToHtml r = new RtfToHtml(); r.OpenDocx(docDetails.Document); r.ToHtml(htmlPath); using (StreamReader sr = new StreamReader(htmlPath)) { String line = sr.ReadToEnd(); mdl.HtmlContent = line; return(View(mdl)); } } catch (Exception) { return(View(mdl)); } }
// // GET: /Edit/Game/1 public ActionResult Game(int?id) { if (!id.HasValue) { return(HttpNotFound()); } Models.Editor model = new Models.Editor(); model.GameId = id.Value; ViewBag.Title = "Quest"; model.SimpleMode = GetSettingBool("simplemode", false); model.ErrorRedirect = ConfigurationManager.AppSettings["WebsiteHome"] ?? "http://textadventures.co.uk/"; model.CacheBuster = Convert.ToInt32((DateTime.Now - (new DateTime(2012, 1, 1))).TotalSeconds); return(View(model)); }
// // GET: /Edit/Game/1 public ActionResult Game(int? id) { if (!id.HasValue) { return HttpNotFound(); } Models.Editor model = new Models.Editor(); model.GameId = id.Value; ViewBag.Title = "Quest"; model.SimpleMode = GetSettingBool("simplemode", false); model.ErrorRedirect = ConfigurationManager.AppSettings["WebsiteHome"] ?? "http://textadventures.co.uk/"; model.PlayURL = ConfigurationManager.AppSettings["PlayURL"] + "?id=" + id.ToString(); model.CacheBuster = Convert.ToInt32((DateTime.Now - (new DateTime(2012, 1, 1))).TotalSeconds); return View(model); }
public ActionResult Editor(Models.Editor doc, FormCollection frm) { var dal = new QP_Repository(); QPMasterPool qpObj = new QPMasterPool(); qpObj = dal.DocumentDetails(doc.DocId); qpObj.UpdationLog = DateTime.Now; QPMapper <Models.QPMasterPool, QPMasterPool> mapObj = new QPMapper <Models.QPMasterPool, QPMasterPool>(); try { if (Session["Role"].ToString().ToLower() == "author") { qpObj.Status = "R"; } else { qpObj.Status = "A"; } } catch (Exception) { return(RedirectToAction("Login")); } try { var htmlPath = Path.GetTempFileName().Replace(".tmp", ".htm"); var docxPath = Path.GetTempFileName().Replace(".tmp", ".docx"); System.IO.File.WriteAllText(htmlPath, doc.HtmlContent); ComponentInfo.SetLicense("FREE-LIMITED-KEY"); ComponentInfo.FreeLimitReached += (sender, e) => e.FreeLimitReachedAction = FreeLimitReachedAction.ContinueAsTrial; DocumentModel.Load(htmlPath).Save(docxPath); if (frm.Count == 5 && frm["Comment"] != null) { docxPath = AsposePost(docxPath, frm["Comment"]); if (docxPath == "undone") { return(View("Error")); } } var docbytes = System.IO.File.ReadAllBytes(docxPath); qpObj.Document = docbytes; bool status = dal.UpdateDocumentMaster(qpObj); if (status) { if (Session["Role"].ToString().ToLower() == "author") { return(RedirectToAction("Author")); } else if (Session["Role"].ToString().ToLower() == "reviewer") { return(RedirectToAction("Reviewer")); } else if (Session["Role"].ToString().ToLower() == "quality anchor") { return(RedirectToAction("QualityAnchor")); } else { return(View("Authorization")); } } else { return(View("UnableToUpload")); } } catch (Exception) { return(View("UnableToUpload")); } }
public RedirectToRouteResult SaveSettings(Models.Editor settings) { SaveSettingBool("simplemode", settings.SimpleMode); return(RedirectToAction("Game", new { id = settings.GameId })); }