public rb_HtmlText_st TranslateHtmlTextDTOIntoRb_HtmlText_st(HtmlTextDTO html) { rb_HtmlText_st _html = new rb_HtmlText_st(); _html.DesktopHtml = html.DesktopHtml; _html.MobileDetails = html.MobileDetails; _html.MobileSummary = html.MobileSummary; _html.ModuleID = html.ModuleID; return _html; }
public bool SetContentData(int moduleId, string content) { if (content == null || content.Equals(string.Empty)) { //si el contenido es nullo es porque no existe ningun registro en htmltext para el modulo return true; } else { IPortalTemplateServices services = PortalTemplateFactory.GetPortalTemplateServices(new PortalTemplateRepository()); HtmlTextDTO _html = new HtmlTextDTO(); System.IO.StringReader xin = new System.IO.StringReader(content); XmlSerializer xs = new XmlSerializer(typeof(HtmlTextDTO)); _html = (HtmlTextDTO)xs.Deserialize(xin); return services.SaveHtmlText(moduleId, _html); } }
/// <summary> /// Saves the HTML text. /// </summary> /// <param name="moduleId"> /// The module id. /// </param> /// <param name="html"> /// The HTML. /// </param> /// <returns> /// The save html text. /// </returns> public bool SaveHtmlText(int moduleId, HtmlTextDTO html) { var result = true; try { var db = new PortalTemplateDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); var translate = new Translate(); var htmlText = translate.TranslateHtmlTextDTOIntoRb_HtmlText(html); htmlText.ModuleID = moduleId; var htmlst = translate.TranslateHtmlTextDTOIntoRb_HtmlText_st(html); htmlst.ModuleID = moduleId; db.rb_HtmlTexts.InsertOnSubmit(htmlText); db.rb_HtmlText_sts.InsertOnSubmit(htmlst); db.SubmitChanges(ConflictMode.FailOnFirstConflict); } catch (Exception ex) { result = false; ErrorHandler.Publish(LogLevel.Error, "There was an error saving the content modules", ex); } return result; }
public HtmlTextDTO TranslateRb_HtmlTextIntoHtmlTextDTO(rb_HtmlText html) { HtmlTextDTO _html = new HtmlTextDTO(); _html.DesktopHtml = html.DesktopHtml; _html.MobileDetails = html.MobileDetails; _html.MobileSummary = html.MobileSummary; _html.ModuleID = html.ModuleID; return _html; }