コード例 #1
0
        private void getCustomerRMRecommendationText()
        {
            string strRMRecommendationHTML;

            string[] strRMRecTR;
            string[] stringSeparators = new string[] { "<p align=\"justify\">" };
            string   strParagraph     = "";
            int      index            = 0;

            if (Session["customerVo"] != null)
            {
                customerVo = (CustomerVo)Session["customerVo"];
            }
            strRMRecommendationHTML = customerBo.GetRMRecommendationForCustomer(customerVo.CustomerId);
            strRMRecTR = strRMRecommendationHTML.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
            if (strRMRecTR.Count() > 0)
            {
                foreach (string str in strRMRecTR)
                {
                    if (str.Contains("</p></td></tr><tr><td>"))
                    {
                        index        = str.IndexOf("</p></td></tr><tr><td>");
                        strParagraph = str.Remove(index, 22);
                    }
                    else if (str.Contains("</p></td></tr></table></body></html>"))
                    {
                        index        = str.IndexOf("</p></td></tr></table></body></html>");
                        strParagraph = str.Remove(index, 36);
                    }
                    if (string.IsNullOrEmpty(txtParagraph1.Text) && !string.IsNullOrEmpty(strParagraph) && strParagraph.Trim() != "&nbsp;")
                    {
                        txtParagraph1.Text = strParagraph;
                    }
                    else if (string.IsNullOrEmpty(txtParagraph2.Text) && !string.IsNullOrEmpty(strParagraph) && strParagraph.Trim() != "&nbsp;")
                    {
                        txtParagraph2.Text = strParagraph;
                    }
                    else if (string.IsNullOrEmpty(txtParagraph3.Text) && !string.IsNullOrEmpty(strParagraph) && strParagraph.Trim() != "&nbsp;")
                    {
                        txtParagraph3.Text = strParagraph;
                    }
                    else if (string.IsNullOrEmpty(txtParagraph4.Text) && !string.IsNullOrEmpty(strParagraph) && strParagraph.Trim() != "&nbsp;")
                    {
                        txtParagraph4.Text = strParagraph;
                    }
                    else if (string.IsNullOrEmpty(txtParagraph5.Text) && !string.IsNullOrEmpty(strParagraph) && strParagraph.Trim() != "&nbsp;")
                    {
                        txtParagraph5.Text = strParagraph;
                    }
                }
            }
        }