Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public rb_HtmlText TranslateHtmlTextDTOIntoRb_HtmlText(HtmlTextDTO html)
        {
            rb_HtmlText _html = new rb_HtmlText();

            _html.DesktopHtml   = html.DesktopHtml;
            _html.MobileDetails = html.MobileDetails;
            _html.MobileSummary = html.MobileSummary;
            _html.ModuleID      = html.ModuleID;
            _html.CWCSS         = html.CWCSS;
            _html.CWHTML        = html.CWHTML;
            _html.CWJS          = html.CWJS;
            return(_html);
        }
Esempio n. 4
0
 public bool SetContentData(int moduleId, HtmlTextDTO content)
 {
     if (content == null || content.DesktopHtml.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());
         return(services.SaveHtmlText(moduleId, content));
     }
 }
Esempio n. 5
0
        public string GetContentData(int moduleId)
        {
            IPortalTemplateServices services = PortalTemplateFactory.GetPortalTemplateServices(new PortalTemplateRepository());
            HtmlTextDTO             _html    = services.GetHtmlTextDTO(moduleId);

            if (_html == null)
            {
                return(string.Empty);
            }
            else
            {
                System.IO.StringWriter xout = new System.IO.StringWriter();
                XmlSerializer          xs   = new XmlSerializer(typeof(HtmlTextDTO));
                xs.Serialize(xout, _html);
                return(xout.ToString());
            }
        }
Esempio n. 6
0
        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));
            }
        }
Esempio n. 7
0
        /// <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);
        }
Esempio n. 8
0
        public HtmlTextDTO GetHtmlTextDTO(int moduleId, WorkFlowVersion version)
        {
            var strDesktopHtml = new HtmlTextDTO();

            // Create Instance of Connection and Command Object
            using (var connection = Config.SqlConnectionString)
            {
                using (var command = new SqlCommand("rb_GetHtmlText", connection))
                {
                    // Mark the Command as a SPROC
                    command.CommandType = CommandType.StoredProcedure;

                    // Add Parameters to SPROC
                    var parameterModuleId = new SqlParameter("@ModuleID", SqlDbType.Int, 4)
                    {
                        Value = moduleId
                    };
                    command.Parameters.Add(parameterModuleId);

                    // Change by [email protected]
                    // Date: 6/2/2003
                    var parameterWorkflowVersion = new SqlParameter("@WorkflowVersion", SqlDbType.Int, 4)
                    {
                        Value = (int)version
                    };
                    command.Parameters.Add(parameterWorkflowVersion);

                    //Add by [email protected]
                    // Date: 12/23/2014
                    // Get published version content
                    int           publishedVersion = 1;
                    SqlDataReader sqlDatard        = this.GetHtmlTextRecord(moduleId);
                    if (sqlDatard.HasRows)
                    {
                        while (sqlDatard.Read())
                        {
                            if (Convert.ToBoolean(sqlDatard["Published"]))
                            {
                                publishedVersion = Convert.ToInt32(sqlDatard["VersionNo"]);
                                break;
                            }
                        }
                    }
                    // Added by Ashish - Connection Pool Issues
                    if (sqlDatard != null)
                    {
                        sqlDatard.Close();
                    }

                    var moduleVersion = new SqlParameter("@VersionNo", SqlDbType.Int, 4)
                    {
                        Value = publishedVersion
                    };
                    command.Parameters.Add(moduleVersion);

                    // End Change [email protected]

                    // Execute the command
                    connection.Open();

                    using (var result = command.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        try
                        {
                            if (result.Read())
                            {
                                strDesktopHtml.DesktopHtml   = result["DesktopHtml"].ToString();
                                strDesktopHtml.CWCSS         = result["CWCSS"].ToString();
                                strDesktopHtml.CWHTML        = result["CWHTML"].ToString();
                                strDesktopHtml.CWJS          = result["CWJS"].ToString();
                                strDesktopHtml.MobileDetails = result["MobileDetails"].ToString();
                                strDesktopHtml.MobileSummary = result["MobileSummary"].ToString();
                                strDesktopHtml.ModuleID      = moduleId;
                            }
                        }
                        finally
                        {
                            // Close the datareader
                            result.Close();
                        }
                    }
                }
            }

            return(strDesktopHtml);
        }