Esempio n. 1
0
        protected void btnDelete3_Click(object sender, ImageClickEventArgs e)
        {
            string strLink = "";

            try
            {
                var n_info = DB.GetTable <ESHOP_NEW>().Where(n => n.NEWS_ID == m_news_id);

                if (n_info.ToList().Count > 0)
                {
                    if (!string.IsNullOrEmpty(n_info.ToList()[0].NEWS_IMAGE3))
                    {
                        string imagePath = Server.MapPath(PathFiles.GetPathNews(m_news_id) + n_info.ToList()[0].NEWS_IMAGE3);
                        n_info.ToList()[0].NEWS_IMAGE3 = "";
                        DB.SubmitChanges();

                        if (File.Exists(imagePath))
                        {
                            File.Delete(imagePath);
                        }

                        strLink = "news.aspx?news_id=" + m_news_id;
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
Esempio n. 2
0
        public string BindAttItems(object News_Id, object Ext_Id, object Att_Name, object Att_Url, object Att_File, object Ext_Image)
        {
            try
            {
                string url       = "";
                string strResult = "";

                if (!string.IsNullOrEmpty(Utils.CStrDef(Att_Url)))
                {
                    url = Utils.CStrDef(Att_Url);
                }
                else if (!string.IsNullOrEmpty(Utils.CStrDef(Att_File)))
                {
                    url = PathFiles.GetPathNews(Utils.CIntDef(News_Id)) + Utils.CStrDef(Att_File);
                }
                else
                {
                    return("");
                }


                if (!string.IsNullOrEmpty(Utils.CStrDef(Ext_Image)))
                {
                    strResult += "<img src='" + PathFiles.GetPathExt(Utils.CIntDef(Ext_Id)) + Utils.CStrDef(Ext_Image) + "' width='24px' style='margin-right:10px;height:19px' />";
                }

                strResult += "<a href='" + url + "' target='_blank' title='" + Utils.CStrDef(Att_Name) + "'>" + (string.IsNullOrEmpty(Utils.CStrDef(Att_Name)) ? Utils.CStrDef(Att_File) : Utils.CStrDef(Att_Name)) + "</a>";


                return(strResult);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
                return(null);
            }
        }
Esempio n. 3
0
 public string Getnameattfile(int news_id)
 {
     return(PathFiles.GetPathNews(news_id) + "baogia_" + news_id + ".doc");
 }
 public string GetImageT_News(object News_Id, object News_Image1)
 {
     try
     {
         if (Utils.CIntDef(News_Id) > 0 && !string.IsNullOrEmpty(Utils.CStrDef(News_Image1)))
         {
             return(System.Configuration.ConfigurationManager.AppSettings["URLWebsite1"] + "/" + PathFiles.GetPathNews(Utils.CIntDef(News_Id)) + Utils.CStrDef(News_Image1));
         }
         else
         {
             return("");
         }
     }
     catch (Exception ex)
     {
         clsVproErrorHandler.HandlerError(ex);
         return(null);
     }
 }
Esempio n. 5
0
        //private string Chuoiheader_footer(int type)
        //{

        //    string pathFile;
        //    string strHTMLContent = string.Empty;
        //    pathFile = type == 1 ? Server.MapPath(PathFiles.GetPathConfigs() + "/header_baogia.htm") : Server.MapPath(PathFiles.GetPathConfigs() + "/footer_baogia.htm");
        //    if ((File.Exists(pathFile)))
        //    {
        //        StreamReader objNewsReader;
        //        //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
        //        objNewsReader = new StreamReader(pathFile);
        //        strHTMLContent = objNewsReader.ReadToEnd();
        //        objNewsReader.Close();
        //    }
        //    return strHTMLContent;
        //}
        //private string Gethtml()
        //{
        //    string pathFile;
        //    string strHTMLContent = string.Empty ;
        //    if (m_news_id > 0)
        //    {

        //        var newsInfo = DB.GetTable<ESHOP_NEW>().Where(n => n.NEWS_ID == m_news_id);

        //        pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + newsInfo.ToList()[0].NEWS_FILEHTML);

        //        if ((File.Exists(pathFile)))
        //        {
        //            StreamReader objNewsReader;
        //            objNewsReader = new StreamReader(pathFile);
        //            strHTMLContent = objNewsReader.ReadToEnd();
        //            objNewsReader.Close();
        //            StringBuilder strBody = new StringBuilder();
        //        }
        //    }
        //    return strHTMLContent;
        //}
        private string Main()
        {
            string getimgpro = "";
            string namepro   = "";
            string price     = "";
            string desc      = "";
            var    newsInfo  = DB.GetTable <ESHOP_NEW>().Where(n => n.NEWS_ID == m_news_id).ToList();

            if (newsInfo.Count > 0)
            {
                getimgpro = "http://beta.vanmatbich.com/" + PathFiles.GetPathNews(m_news_id) + newsInfo[0].NEWS_IMAGE3;
                namepro   = newsInfo[0].NEWS_TITLE;
                price     = string.Format("{0:0,0 VNĐ}", newsInfo[0].NEWS_PRICE1);
                desc      = newsInfo[0].NEWS_DESC;
            }
            string chuoimain = string.Empty;

            chuoimain += "<table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width='100%'";
            chuoimain += "style='width:100.0%;border-collapse:collapse;mso-yfti-tbllook:1184;";
            chuoimain += "mso-padding-alt:3.75pt 3.75pt 3.75pt 3.75pt'>";
            chuoimain += "<tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>";
            chuoimain += " <td width=170 style='width:127.5pt;padding:3.75pt 3.75pt 3.75pt 3.75pt'>";
            chuoimain += "<p class=MsoNormal align=center style='text-align:center'><span";
            chuoimain += " class=SpellE><b><span style='font-size:12.0pt'>Tên</span></b></span><b><span";
            chuoimain += " style='font-size:12.0pt'> <span class=SpellE>hàng</span></span></b><span";
            chuoimain += "  style='font-size:12.0pt'><o:p></o:p></span></p>";
            chuoimain += "</td>";
            chuoimain += "<td style='padding:3.75pt 3.75pt 3.75pt 3.75pt'>";
            chuoimain += "<p class=MsoNormal align=center style='text-align:center'><span";
            chuoimain += " class=SpellE><b><span style='font-size:12.0pt'>Thông</span></b></span><b><span";
            chuoimain += " style='font-size:12.0pt'> tin chi <span class=SpellE>tiết</span></span></b><span";
            chuoimain += " style='font-size:12.0pt'><o:p></o:p></span></p>";
            chuoimain += "  </td>";
            chuoimain += " <td width=120 style='width:1.25in;padding:3.75pt 3.75pt 3.75pt 3.75pt'>";
            chuoimain += " <p class=MsoNormal align=center style='text-align:center'><span";
            chuoimain += " class=SpellE><b><span style='font-size:12.0pt'>Đơn</span></b></span><b><span";
            chuoimain += " style='font-size:12.0pt'> <span class=SpellE>giá</span></span></b><span";
            chuoimain += "style='font-size:12.0pt'><o:p></o:p></span></p>";
            chuoimain += "</td>";
            chuoimain += " </tr>";
            chuoimain += "<tr style='mso-yfti-irow:1;mso-yfti-lastrow:yes'>";
            chuoimain += "<td width=180 valign=top style='width:135.0pt;padding:3.75pt 3.75pt 3.75pt 3.75pt'>";
            chuoimain += " <p class=MsoNormal align=center style='text-align:center'><span";
            chuoimain += "style='font-size:10.0pt;font-family:'Times New Roman','serif';mso-fareast-font-family:";
            chuoimain += "'Times New Roman';mso-no-proof:yes'><img width=133 height=150";
            chuoimain += " id='_x0000_i1025'";
            chuoimain += " src='" + getimgpro + "'";
            chuoimain += "  ></span><br/><span";
            chuoimain += "  style='font-size:12.0pt;font-family:'Times New Roman','serif';mso-fareast-font-family:";
            chuoimain += "  'Times New Roman''>" + namepro + "</p>";
            chuoimain += "  </td>";
            chuoimain += "  <td valign=top style='padding:3.75pt 3.75pt 3.75pt 3.75pt'>";
            chuoimain += desc;
            chuoimain += " </td>";
            chuoimain += "<td width=120 valign=top style='width:1.25in;padding:3.75pt 3.75pt 3.75pt 3.75pt'>";

            chuoimain += "" + price + "";
            chuoimain += " </td>";
            chuoimain += "</tr>";
            chuoimain += "</table>";
            return(chuoimain);
        }
 private void Create_att()
 {
     try
     {
         StringBuilder strBody = new StringBuilder();
         string        chuoi   = "";
         chuoi += "<html ";
         chuoi += "xmlns:o='urn:schemas-microsoft-com:office:office' ";
         chuoi += "xmlns:w='urn:schemas-microsoft-com:office:word'";
         chuoi += "xmlns='http://www.w3.org/TR/REC-html40'>";
         chuoi += "<head><title>Time</title>";
         chuoi += "<style>";
         chuoi += "<!--";
         /* Font Definitions */
         chuoi += "@font-face";
         chuoi += "	{font-family:Wingdings;";
         chuoi += "	panose-1:5 0 0 0 0 0 0 0 0 0;";
         chuoi += "	mso-font-charset:2;";
         chuoi += "	mso-generic-font-family:auto;";
         chuoi += "	mso-font-pitch:variable;";
         chuoi += "mso-font-signature:0 268435456 0 0 -2147483648 0;}";
         chuoi += "@font-face";
         chuoi += "	{font-family:'Cambria Math';";
         chuoi += "	panose-1:2 4 5 3 5 4 6 3 2 4;";
         chuoi += "	mso-font-charset:0;";
         chuoi += "	mso-generic-font-family:roman;";
         chuoi += "	mso-font-pitch:variable;";
         chuoi += "	mso-font-signature:-536870145 1107305727 0 0 415 0;}";
         chuoi += "@font-face";
         chuoi += "	{font-family:Tahoma;";
         chuoi += "	panose-1:2 11 6 4 3 5 4 4 2 4;";
         chuoi += "	mso-font-charset:0;";
         chuoi += "	mso-generic-font-family:swiss;";
         chuoi += "	mso-font-pitch:variable;";
         chuoi += "	mso-font-signature:-520081665 -1073717157 41 0 66047 0;} /* Style Definitions */";
         chuoi += "p.MsoNormal, li.MsoNormal, div.MsoNormal";
         chuoi += "{mso-style-unhide:no;";
         chuoi += "mso-style-qformat:yes;";
         chuoi += "mso-style-parent:'';";
         chuoi += "margin:0in;";
         chuoi += "margin-bottom:.0001pt;";
         chuoi += "mso-pagination:widow-orphan;";
         chuoi += "font-size:7.5pt;";
         chuoi += "mso-bidi-font-size:8.0pt;";
         chuoi += "font-family:'Arial','sans-serif';";
         chuoi += "mso-fareast-font-family:Arial;}";
         chuoi += "p";
         chuoi += "	{mso-style-unhide:no;";
         chuoi += "mso-margin-top-alt:auto;";
         chuoi += "margin-right:0in;";
         chuoi += "mso-margin-bottom-alt:auto;";
         chuoi += "margin-left:0in;";
         chuoi += "mso-pagination:widow-orphan;";
         chuoi += "font-size:12.0pt;";
         chuoi += "font-family:'Times New Roman','serif';";
         chuoi += "mso-fareast-font-family:'Times New Roman';}";
         chuoi += "p.MsoAcetate, li.MsoAcetate, div.MsoAcetate";
         chuoi += "{mso-style-unhide:no;";
         chuoi += "mso-style-link:'Balloon Text Char';";
         chuoi += "margin:0in;";
         chuoi += "margin-bottom:.0001pt;";
         chuoi += "mso-pagination:widow-orphan;";
         chuoi += "font-size:8.0pt;";
         chuoi += "font-family:'Tahoma','sans-serif';";
         chuoi += "mso-fareast-font-family:Arial;}";
         chuoi += "p.small, li.small, div.small";
         chuoi += "{mso-style-name:small;";
         chuoi += "mso-style-unhide:no;";
         chuoi += "mso-style-parent:'';";
         chuoi += "margin:0in;";
         chuoi += "margin-bottom:.0001pt;";
         chuoi += "mso-pagination:widow-orphan;";
         chuoi += "font-size:1.0pt;";
         chuoi += "font-family:'Arial','sans-serif';";
         chuoi += "mso-fareast-font-family:Arial;}";
         chuoi += "span.BalloonTextChar";
         chuoi += "	{mso-style-name:'Balloon Text Char';";
         chuoi += "	mso-style-unhide:no;";
         chuoi += "	mso-style-locked:yes;";
         chuoi += "	mso-style-link:'Balloon Text';";
         chuoi += "	mso-ansi-font-size:8.0pt;";
         chuoi += "	mso-bidi-font-size:8.0pt;";
         chuoi += "	font-family:'Tahoma','sans-serif';";
         chuoi += "	mso-ascii-font-family:Tahoma;";
         chuoi += "	mso-fareast-font-family:Arial;";
         chuoi += "mso-hansi-font-family:Tahoma;";
         chuoi += "	mso-bidi-font-family:Tahoma;}";
         chuoi += "span.SpellE";
         chuoi += "	{mso-style-name:'';";
         chuoi += "	mso-spl-e:yes;}";
         chuoi += ".MsoChpDefault";
         chuoi += "	{mso-style-type:export-only;";
         chuoi += "mso-default-props:yes;";
         chuoi += "font-size:10.0pt;";
         chuoi += "mso-ansi-font-size:10.0pt;";
         chuoi += "mso-bidi-font-size:10.0pt;}";
         chuoi += "@page WordSection1";
         chuoi += "{size:595.3pt 841.9pt;";
         chuoi += "margin:.6in .6in .6in .9in;";
         chuoi += "mso-header-margin:.5in;";
         chuoi += "mso-footer-margin:.5in;";
         chuoi += "mso-paper-source:0;}";
         chuoi += "div.WordSection1";
         chuoi += "	{page:WordSection1;}";
         /* List Definitions */
         chuoi += " @list l0";
         chuoi += "{mso-list-id:1623265660;";
         chuoi += "mso-list-template-ids:-395659252;}";
         chuoi += "@list l0:level1";
         chuoi += "{mso-level-number-format:bullet;";
         chuoi += "mso-level-text:;";
         chuoi += "mso-level-tab-stop:.5in;";
         chuoi += "mso-level-number-position:left;";
         chuoi += "text-indent:-.25in;";
         chuoi += "so-ansi-font-size:10.0pt;";
         chuoi += "font-family:Symbol;}";
         chuoi += "ol";
         chuoi += "{margin-bottom:0in;}";
         chuoi += "ul";
         chuoi += "{margin-bottom:0in;}";
         chuoi += "-->";
         chuoi += "</style>";
         chuoi += "</head>";
         strBody.Append(chuoi);
         strBody.Append(Chuoiheader_footer(1));
         strBody.Append(Main());
         strBody.Append(Chuoiheader_footer(2));
         StreamWriter fsoFile;
         string       path_ms = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "baogia_" + m_news_id + ".doc");
         fsoFile = File.CreateText(path_ms);
         fsoFile.Write(strBody);
         fsoFile.Close();
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 7
0
 public string GetImageT_News_HasLink(object News_Id, object News_Image1, string nameclass, object url, object seo_url, object news_title)
 {
     try
     {
         //string _news_seo = String.IsNullOrEmpty(Utils.CStrDef(url)) ? Utils.CStrDef(seo_url) : Utils.CStrDef(url);
         string _news_seo = Getlink_News(url, seo_url);
         if (Utils.CIntDef(News_Id) > 0 && !string.IsNullOrEmpty(Utils.CStrDef(News_Image1)))
         {
             return("<a href='" + _news_seo + "' title='" + Utils.CStrDef(news_title) + "' style='float: left;'><img class='" + nameclass + "' alt='" + Utils.CStrDef(news_title) + "' src='" + PathFiles.GetPathNews(Utils.CIntDef(News_Id)) + Utils.CStrDef(News_Image1) + "'/></a>");
         }
         else
         {
             return("");
         }
     }
     catch (Exception ex)
     {
         clsVproErrorHandler.HandlerError(ex);
         return(null);
     }
 }
        private void getInfo()
        {
            try
            {
                LoadUnits();
                LoadCategoryParent();
                Components.CpanelUtils.createItemTarget(ref ddlTarget);
                Components.CpanelUtils.createItemLanguage(ref rblLanguage);

                var G_info = (from n in DB.ESHOP_NEWs
                              join c in DB.ESHOP_NEWS_CATs on n.NEWS_ID equals c.NEWS_ID
                              where n.NEWS_ID == m_news_id
                              select new
                {
                    n,
                    c.CAT_ID
                }
                              );

                if (G_info.ToList().Count > 0)
                {
                    //trCat.Visible = false;
                    ddlCategory.SelectedValue = Utils.CStrDef(G_info.ToList()[0].CAT_ID);
                    txtTitle.Value            = G_info.ToList()[0].n.NEWS_TITLE;
                    txtDesc.Value             = G_info.ToList()[0].n.NEWS_DESC;
                    txtUrl.Value            = G_info.ToList()[0].n.NEWS_URL;
                    ddlTarget.SelectedValue = G_info.ToList()[0].n.NEWS_TARGET;

                    rblNewsType.SelectedValue   = Utils.CStrDef(G_info.ToList()[0].n.NEWS_TYPE);
                    rblStatus.SelectedValue     = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SHOWTYPE);
                    rblNewsPeriod.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.NEWS_PERIOD);
                    rblFeefback.SelectedValue   = Utils.CStrDef(G_info.ToList()[0].n.NEWS_FEEDBACKTYPE);
                    rblLanguage.SelectedValue   = Utils.CStrDef(G_info.ToList()[0].n.NEWS_LANGUAGE);
                    txtOrder.Value       = Utils.CStrDef(G_info.ToList()[0].n.NEWS_ORDER, "1");
                    txtOrderPeriod.Value = Utils.CStrDef(G_info.ToList()[0].n.NEWS_ORDER_PERIOD, "1");
                    lblCount.Text        = string.IsNullOrEmpty(Utils.CStrDef(G_info.ToList()[0].n.NEWS_COUNT)) ? "0" : Utils.CStrDef(G_info.ToList()[0].n.NEWS_COUNT);
                    lblSendEmail.Text    = G_info.ToList()[0].n.NEWS_SENDDATE == null ? "Chưa gửi" : "Gửi lần cuối vào " + string.Format("{0:dd/MM/yyyy HH:mm:ss}", G_info.ToList()[0].n.NEWS_SENDDATE);

                    //seo
                    txtSeoTitle.Value       = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_TITLE);
                    txtSeoKeyword.Value     = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_KEYWORD);
                    txtSeoDescription.Value = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_DESC);
                    txtSeoUrl.Value         = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_URL);

                    //PRICE
                    txtPrice.Value         = Utils.CStrDef(G_info.ToList()[0].n.NEWS_PRICE1, "0");
                    txtPriceSub.Value      = Utils.CStrDef(G_info.ToList()[0].n.NEWS_PRICE2, "0");
                    ddlUnit1.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.UNIT_ID1);
                    ddlUnit2.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.UNIT_ID2);

                    //image
                    if (!string.IsNullOrEmpty(G_info.ToList()[0].n.NEWS_IMAGE1))
                    {
                        trImage1.Visible      = true;
                        Image1.Src            = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE1;
                        hplImage1.NavigateUrl = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE1;
                        hplImage1.Text        = G_info.ToList()[0].n.NEWS_IMAGE1;
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Esempio n. 9
0
        private void SaveHTMLInfo()
        {
            try
            {
                string htmExt = "-vi.htm";
                //if (lang == 1)
                //{
                //    htmExt = "-vi.htm";
                //}
                //else if (lang == 2)
                //{
                //    htmExt = "-en.htm";
                //}
                //else if (lang == 3)
                //{
                //    htmExt = "-ru.htm";
                //}
                //else if (lang == 4)
                //{
                //    htmExt = "-ch.htm";
                //}
                string chitiettin = m_news_id.ToString() + htmExt;

                string gioithieu = "gioithieu" + htmExt;
                string phongnghi = "phongnghi" + htmExt;
                string amthuc    = "amthuc" + htmExt;
                string giaitri   = "giaitri" + htmExt;
                string hoinghi   = "hoinghi" + htmExt;
                string khuyenmai = "khuyenmai" + htmExt;

                string gioithieuchung = "gioithieuchung" + htmExt;
                string vitri          = "vitri" + htmExt;
                string matbang        = "matbang" + htmExt;
                string phongnghida    = "phongnghida" + htmExt;
                string tienich        = "tienich" + htmExt;
                string kientruc       = "kientruc" + htmExt;
                string tiendo         = "tiendo" + htmExt;

                if ((m_news_id > 0))
                {
                    string       strHTMLFileLocation;
                    string       strFileName;
                    string       strHTMLContent;
                    StreamWriter fsoFile;

                    //strFileName = PathFiles.GetPathNews(m_news_id) + chitiettin;
                    //strHTMLFileLocation = Server.MapPath(strFileName);
                    //strHTMLContent = mrk.Value;

                    //fsoFile = File.CreateText(strHTMLFileLocation);
                    //fsoFile.Write(strHTMLContent);
                    //fsoFile.Close();

                    //tong quan khach san
                    strFileName         = PathFiles.GetPathNews(m_news_id) + gioithieu;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtGioithieu.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //co so vat chat
                    strFileName         = PathFiles.GetPathNews(m_news_id) + phongnghi;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtPhongnghi.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //ban do
                    strFileName         = PathFiles.GetPathNews(m_news_id) + amthuc;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtAmthuc.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //gia
                    strFileName         = PathFiles.GetPathNews(m_news_id) + giaitri;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtGiaitri.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //gia
                    strFileName         = PathFiles.GetPathNews(m_news_id) + hoinghi;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtHoinghi.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //khuyen mai
                    strFileName         = PathFiles.GetPathNews(m_news_id) + khuyenmai;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtKhuyenmai.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();


                    //gioi thieu chung
                    strFileName         = PathFiles.GetPathNews(m_news_id) + gioithieuchung;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtGioithieuchung.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //vi tri
                    strFileName         = PathFiles.GetPathNews(m_news_id) + vitri;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtVitri.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //mat bang
                    strFileName         = PathFiles.GetPathNews(m_news_id) + matbang;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtmatbang.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //phòng nghỉ
                    strFileName         = PathFiles.GetPathNews(m_news_id) + phongnghida;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtphongnghida.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //tien ich
                    strFileName         = PathFiles.GetPathNews(m_news_id) + tienich;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtTienich.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //kien truc
                    strFileName         = PathFiles.GetPathNews(m_news_id) + kientruc;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtKientruc.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //tien do
                    strFileName         = PathFiles.GetPathNews(m_news_id) + tiendo;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtTiendo.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Esempio n. 10
0
        private void showFileHTML()
        {
            string pathFile;
            string strHTMLContent;

            //string strSubweb;

            //if ((HttpContext.Current.Request.ApplicationPath == "/"))
            //{
            //    strSubweb = Request.ApplicationPath;
            //}
            //else
            //{
            //    strSubweb = Request.ApplicationPath + "/";
            //}

            if (m_news_id > 0)
            {
                string htmExt = "-vi.htm";
                //if (lang == 1)
                //{
                //    htmExt = "-vi.htm";
                //}
                //else if (lang == 2)
                //{
                //    htmExt = "-en.htm";
                //}
                //else if (lang == 3)
                //{
                //    htmExt = "-ru.htm";
                //}
                //else if (lang == 4)
                //{
                //    htmExt = "-ch.htm";
                //}
                string chitiettin = m_news_id.ToString() + htmExt;

                string gioithieu = "gioithieu" + htmExt;
                string phongnghi = "phongnghi" + htmExt;
                string amthuc    = "amthuc" + htmExt;
                string giaitri   = "giaitri" + htmExt;
                string hoinghi   = "hoinghi" + htmExt;
                string khuyenmai = "khuyenmai" + htmExt;


                string gioithieuchung = "gioithieuchung" + htmExt;
                string vitri          = "vitri" + htmExt;
                string matbang        = "matbang" + htmExt;
                string phongnghida    = "phongnghida" + htmExt;
                string tienich        = "tienich" + htmExt;
                string kientruc       = "kientruc" + htmExt;
                string tiendo         = "tiendo" + htmExt;

                //var newsInfo = DB.GetTable<ESHOP_NEW>().Where(n => n.NEWS_ID == m_news_id);
                //chi tiet tin
                ////pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + chitiettin);
                ////if ((File.Exists(pathFile)))
                ////{
                ////    StreamReader objNewsReader;
                ////    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                ////    objNewsReader = new StreamReader(pathFile);
                ////    strHTMLContent = objNewsReader.ReadToEnd();
                ////    objNewsReader.Close();
                ////    mrk.Value = strHTMLContent;
                ////}
                //giới thiệu
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + gioithieu);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtGioithieu.Value = strHTMLContent;
                }
                //phong nghỉ
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + phongnghi);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtPhongnghi.Value = strHTMLContent;
                }
                //am thuc
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + amthuc);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtAmthuc.Value = strHTMLContent;
                }
                //giai tri
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + giaitri);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtGiaitri.Value = strHTMLContent;
                }
                //hội nghị
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + hoinghi);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtHoinghi.Value = strHTMLContent;
                }
                //khuyen mai
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + khuyenmai);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtKhuyenmai.Value = strHTMLContent;
                }

                //gioi thieu chung
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + gioithieuchung);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtGioithieuchung.Value = strHTMLContent;
                }
                //vi tri
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + vitri);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtVitri.Value = strHTMLContent;
                }
                //mat bang
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + matbang);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtmatbang.Value = strHTMLContent;
                }
                //phòng nghỉ da
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + phongnghida);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtphongnghida.Value = strHTMLContent;
                }
                //tien ich
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + tienich);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtTienich.Value = strHTMLContent;
                }
                //kien truc
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + kientruc);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtKientruc.Value = strHTMLContent;
                }
                //tiến độ
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + tiendo);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtTiendo.Value = strHTMLContent;
                }
            }
        }
Esempio n. 11
0
        public void Bind_meta_tags_news()
        {
            #region Bind Meta Tags
            HtmlHead header    = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            //Face tags
            HtmlMeta propety      = new HtmlMeta();
            HtmlMeta propetyTitle = new HtmlMeta();
            HtmlMeta propetyDesc  = new HtmlMeta();
            //Twitter tags
            HtmlMeta propetyTw      = new HtmlMeta();
            HtmlMeta propetyTitleTw = new HtmlMeta();
            HtmlMeta propetyDescTw  = new HtmlMeta();

            headerDes.Name    = "Description";
            headerKey.Name    = "Keywords";
            header.Title      = Utils.CStrDef(Session["News_seo_title"]);
            headerDes.Content = Utils.CStrDef(Session["News_seo_desc"]);
            headerKey.Content = Utils.CStrDef(Session["News_seo_keyword"]);
            if (string.IsNullOrEmpty(headerDes.Content))
            {
                headerDes.Content = "";
            }
            header.Controls.Add(headerDes);

            if (string.IsNullOrEmpty(headerKey.Content))
            {
                headerKey.Content = "";
            }

            header.Controls.Add(headerKey);
            //Facebook meta
            propety.Attributes.Add("property", "og:image");
            propety.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathNews(Utils.CIntDef(Session["News_id"])) + Utils.CStrDef(Session["News_image3"]);
            header.Controls.Add(propety);
            //Title
            propetyTitle.Attributes.Add("property", "og:title");
            propetyTitle.Content = Utils.CStrDef(Session["News_seo_title"]);
            header.Controls.Add(propetyTitle);
            //Desc
            propetyDesc.Attributes.Add("property", "og:description");
            propetyDesc.Content = Utils.CStrDef(Session["News_seo_desc"]);
            header.Controls.Add(propetyDesc);
            //Twitter meta
            propetyTw.Attributes.Add("property", "twitter:image");
            propetyTw.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathNews(Utils.CIntDef(Session["News_id"])) + Utils.CStrDef(Session["News_image3"]);
            header.Controls.Add(propetyTw);
            //Title
            propetyTitleTw.Attributes.Add("property", "twitter:title");
            propetyTitleTw.Content = Utils.CStrDef(Session["News_seo_title"]);
            header.Controls.Add(propetyTitleTw);
            //Desc
            propetyDescTw.Attributes.Add("property", "twitter:description");
            propetyDescTw.Content = Utils.CStrDef(Session["News_seo_desc"]);
            header.Controls.Add(propetyDescTw);


            #endregion
        }
        private void showFileHTML()
        {
            string pathFile;
            string strHTMLContent;

            //string strSubweb;

            //if ((HttpContext.Current.Request.ApplicationPath == "/"))
            //{
            //    strSubweb = Request.ApplicationPath;
            //}
            //else
            //{
            //    strSubweb = Request.ApplicationPath + "/";
            //}

            if (m_news_id > 0)
            {
                string htmExt = "-vi.htm";
                if (lang == 1)
                {
                    htmExt = "-vi.htm";
                }
                else if (lang == 2)
                {
                    htmExt = "-en.htm";
                }
                else if (lang == 3)
                {
                    htmExt = "-ru.htm";
                }
                else if (lang == 4)
                {
                    htmExt = "-ch.htm";
                }
                string chitiettin = m_news_id.ToString() + htmExt;

                string tongquankhachsan = "tongquankhachsan" + htmExt;
                string cosovatchat      = "cosovatchat" + htmExt;
                string bando            = "bando" + htmExt;
                string khuyenmai        = "khuyenmai" + htmExt;
                string gia = "tongquankhachsan" + htmExt;

                string gioithieuchung = "gioithieuchung" + htmExt;
                string vitri          = "vitri" + htmExt;
                string matbang        = "matbang" + htmExt;
                string tienich        = "tienich" + htmExt;
                string kientruc       = "kientruc" + htmExt;

                //var newsInfo = DB.GetTable<ESHOP_NEW>().Where(n => n.NEWS_ID == m_news_id);
                //chi tiet tin
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + chitiettin);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    mrk.Value = strHTMLContent;
                }
                //tong quan khach san
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + tongquankhachsan);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtTongquan.Value = strHTMLContent;
                }
                //co so vat chat
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + cosovatchat);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtCSVC.Value = strHTMLContent;
                }
                //bando
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + bando);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtBando.Value = strHTMLContent;
                }
                //khuyen mai
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + khuyenmai);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtKhuyenmai.Value = strHTMLContent;
                }
                //gia
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + gia);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtGia.Value = strHTMLContent;
                }
                //gioi thieu chung
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + gioithieuchung);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtGioithieuchung.Value = strHTMLContent;
                }
                //vi tri
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + vitri);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtVitri.Value = strHTMLContent;
                }
                //mat bang
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + matbang);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtmatbang.Value = strHTMLContent;
                }
                //tien ich
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + tienich);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtTienich.Value = strHTMLContent;
                }
                //kien truc
                pathFile = Server.MapPath(PathFiles.GetPathNews(m_news_id) + "/" + kientruc);
                if ((File.Exists(pathFile)))
                {
                    StreamReader objNewsReader;
                    //objNewsReader = New StreamReader(pathFile, System.Text.Encoding.Default)
                    objNewsReader  = new StreamReader(pathFile);
                    strHTMLContent = objNewsReader.ReadToEnd();
                    objNewsReader.Close();
                    txtKientruc.Value = strHTMLContent;
                }
            }
        }
        private void SaveHTMLInfo()
        {
            try
            {
                string htmExt = "-vi.htm";
                if (lang == 1)
                {
                    htmExt = "-vi.htm";
                }
                else if (lang == 2)
                {
                    htmExt = "-en.htm";
                }
                else if (lang == 3)
                {
                    htmExt = "-ru.htm";
                }
                else if (lang == 4)
                {
                    htmExt = "-ch.htm";
                }
                string chitiettin = m_news_id.ToString() + htmExt;

                string tongquankhachsan = "tongquankhachsan" + htmExt;
                string cosovatchat      = "cosovatchat" + htmExt;
                string bando            = "bando" + htmExt;
                string khuyenmai        = "khuyenmai" + htmExt;
                string gia = "tongquankhachsan" + htmExt;

                string gioithieuchung = "gioithieuchung" + htmExt;
                string vitri          = "vitri" + htmExt;
                string matbang        = "matbang" + htmExt;
                string tienich        = "tienich" + htmExt;
                string kientruc       = "kientruc" + htmExt;

                if ((m_news_id > 0))
                {
                    string       strHTMLFileLocation;
                    string       strFileName;
                    string       strHTMLContent;
                    StreamWriter fsoFile;

                    strFileName         = PathFiles.GetPathNews(m_news_id) + chitiettin;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = mrk.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();

                    //tong quan khach san
                    strFileName         = PathFiles.GetPathNews(m_news_id) + tongquankhachsan;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtTongquan.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //co so vat chat
                    strFileName         = PathFiles.GetPathNews(m_news_id) + cosovatchat;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtCSVC.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //ban do
                    strFileName         = PathFiles.GetPathNews(m_news_id) + bando;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtBando.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //khuyen mai
                    strFileName         = PathFiles.GetPathNews(m_news_id) + khuyenmai;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtKhuyenmai.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //gia
                    strFileName         = PathFiles.GetPathNews(m_news_id) + gia;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtGia.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();


                    //gioi thieu chung
                    strFileName         = PathFiles.GetPathNews(m_news_id) + gioithieuchung;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtGioithieuchung.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //vi tri
                    strFileName         = PathFiles.GetPathNews(m_news_id) + vitri;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtVitri.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //mat bang
                    strFileName         = PathFiles.GetPathNews(m_news_id) + matbang;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtmatbang.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //tien ich
                    strFileName         = PathFiles.GetPathNews(m_news_id) + tienich;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtTienich.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                    //kien truc
                    strFileName         = PathFiles.GetPathNews(m_news_id) + kientruc;
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = txtKientruc.Value;

                    fsoFile = File.CreateText(strHTMLFileLocation);
                    fsoFile.Write(strHTMLContent);
                    fsoFile.Close();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Esempio n. 14
0
        private void getInfo()
        {
            try
            {
                //LoadUnits();
                Components.CpanelUtils.createItemTarget(ref ddlTarget);

                var G_info = (from n in DB.ESHOP_NEWs
                              join c in DB.ESHOP_NEWS_CATs on n.NEWS_ID equals c.NEWS_ID into t2_join
                              from c in t2_join.DefaultIfEmpty()
                              where n.NEWS_ID == m_news_id
                              select new
                {
                    n,
                    c.CAT_ID
                }
                              ).ToList();

                if (G_info.Count > 0)
                {
                    trCat.Visible = false;
                    if (Kiemtra_catindex(Utils.CIntDef(G_info[0].CAT_ID)) == true)
                    {
                        div_noibat.Visible = true;
                    }
                    else
                    {
                        div_noibat.Visible = false;
                    }
                    txtTitle.Value            = G_info[0].n.NEWS_TITLE;
                    rblNoiBat.SelectedValue   = G_info[0].n.NEWS_FIELD1;
                    txtVideo.Value            = G_info[0].n.NEWS_VIDEO_URL;
                    ddl_kenh.SelectedValue    = G_info[0].n.NEWS_FIELD4;
                    txtDesc.Value             = G_info[0].n.NEWS_DESC;
                    txtUrl.Value              = G_info[0].n.NEWS_URL;
                    ddlTarget.SelectedValue   = G_info[0].n.NEWS_TARGET;
                    rblStatus.SelectedValue   = Utils.CStrDef(G_info[0].n.NEWS_SHOWTYPE);
                    rblFeefback.SelectedValue = Utils.CStrDef(G_info[0].n.NEWS_FEEDBACKTYPE);
                    txtOrder.Value            = Utils.CStrDef(G_info[0].n.NEWS_ORDER, "1");
                    txtOrderPeriod.Value      = Utils.CStrDef(G_info[0].n.NEWS_ORDER_PERIOD, "1");
                    txtSeoTitle.Value         = Utils.CStrDef(G_info[0].n.NEWS_SEO_TITLE);
                    txtSeoKeyword.Value       = Utils.CStrDef(G_info[0].n.NEWS_SEO_KEYWORD);
                    txtSeoDescription.Value   = Utils.CStrDef(G_info[0].n.NEWS_SEO_DESC);
                    txtSeoUrl.Value           = Utils.CStrDef(G_info[0].n.NEWS_SEO_URL);
                    if (!string.IsNullOrEmpty(G_info[0].n.NEWS_IMAGE3))
                    {
                        trUploadImage3.Visible = false;
                        trImage3.Visible       = true;
                        Image3.Src             = PathFiles.GetPathNews(m_news_id) + G_info[0].n.NEWS_IMAGE3;
                        hplImage3.NavigateUrl  = PathFiles.GetPathNews(m_news_id) + G_info[0].n.NEWS_IMAGE3;
                        hplImage3.Text         = G_info[0].n.NEWS_IMAGE3;
                    }
                    else
                    {
                        trUploadImage3.Visible = true;
                        trImage3.Visible       = false;
                    }
                }
                else
                {
                    if (Kiemtra_catindex(Utils.CIntDef(ddlCategory.SelectedValue)) == true)
                    {
                        div_noibat.Visible = true;
                    }
                    else
                    {
                        div_noibat.Visible = false;
                    }
                    trUploadImage3.Visible = true;
                    trImage3.Visible       = false;
                    LoadCategoryParent();
                    trCat.Visible = true;
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        public void Bind_meta_tags_news()
        {
            #region Bind Meta Tags
            HtmlHead header    = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();
            //Face tags
            HtmlLink linkcanonical = new HtmlLink();
            HtmlMeta propety       = new HtmlMeta();
            HtmlMeta propetyTitle  = new HtmlMeta();
            HtmlMeta propetyDesc   = new HtmlMeta();
            //Twitter tags
            //HtmlMeta propetyTw = new HtmlMeta();
            //HtmlMeta propetyTitleTw = new HtmlMeta();
            //HtmlMeta propetyDescTw = new HtmlMeta();
            headerDes.Name    = "Description";
            headerKey.Name    = "Keywords";
            header.Title      = Utils.CStrDef(Session["News_seo_title"]);
            headerDes.Content = Utils.CStrDef(Session["News_seo_desc"]);
            headerKey.Content = Utils.CStrDef(Session["News_seo_keyword"]);
            if (string.IsNullOrEmpty(headerDes.Content))
            {
                headerDes.Content = "";
            }
            header.Controls.Add(headerDes);

            if (string.IsNullOrEmpty(headerKey.Content))
            {
                headerKey.Content = "";
            }

            header.Controls.Add(headerKey);
            //<meta rel=”canonical” href="http://example.com/content-news.html"/>
            //Facebook meta
            //Link
            linkcanonical.Attributes.Add("rel", "canonical");
            linkcanonical.Href = System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "/" + Utils.CStrDef(Session["News_seo_url"]) + ".html";
            header.Controls.Add(linkcanonical);
            //Img
            propety.Attributes.Add("property", "og:image");
            propety.Attributes.Add("name", "xlarge");
            propety.Content = System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathNews(Utils.CIntDef(Session["News_id"])) + Utils.CStrDef(Session["News_image3"]);
            header.Controls.Add(propety);
            //Title
            propetyTitle.Attributes.Add("property", "og:title");
            propetyTitle.Content = Utils.CStrDef(Session["News_seo_title"]);
            header.Controls.Add(propetyTitle);
            //Desc
            propetyDesc.Attributes.Add("property", "og:description");
            propetyDesc.Content = Utils.CStrDef(Session["News_seo_desc"]);
            header.Controls.Add(propetyDesc);
            ////Twitter meta
            //propetyTw.Attributes.Add("property", "twitter:image");
            //propetyTw.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathNews(Utils.CIntDef(Session["News_id"])) + Utils.CStrDef(Session["News_image3"]);
            //header.Controls.Add(propetyTw);
            ////Title
            //propetyTitleTw.Attributes.Add("property", "twitter:title");
            //propetyTitleTw.Content = Utils.CStrDef(Session["News_seo_title"]);
            //header.Controls.Add(propetyTitleTw);
            ////Desc
            //propetyDescTw.Attributes.Add("property", "twitter:description");
            //propetyDescTw.Content = Utils.CStrDef(Session["News_seo_desc"]);
            //header.Controls.Add(propetyDescTw);


            #endregion
        }
Esempio n. 16
0
        //private void Loadhangsx()
        //{
        //    var list = DB.ESHOP_CATEGORies.Where(n => n.CAT_TYPE == 2 && n.CAT_RANK == 2);
        //    Drhangsx.DataValueField = "CAT_ID";
        //    Drhangsx.DataTextField = "CAT_NAME";
        //    Drhangsx.DataSource = list;
        //    Drhangsx.DataBind();
        //    ListItem l = new ListItem("--- Chọn hãng sản xuất ---", "0");
        //    l.Selected = true;
        //    Drhangsx.Items.Insert(0, l);
        //}
        //private void LoadUnits()
        //{
        //    try
        //    {
        //        var units = DB.GetTable<ESHOP_UNIT>();

        //        ddlUnit1.DataSource = units;
        //        ddlUnit1.DataTextField = "UNIT_NAME";
        //        ddlUnit1.DataValueField = "UNIT_ID";
        //        ddlUnit1.DataBind();

        //        ddlUnit2.DataSource = units;
        //        ddlUnit2.DataTextField = "UNIT_NAME";
        //        ddlUnit2.DataValueField = "UNIT_ID";
        //        ddlUnit2.DataBind();
        //    }
        //    catch (Exception ex)
        //    {
        //        clsVproErrorHandler.HandlerError(ex);
        //    }
        //}

        private void getInfo()
        {
            try
            {
                //LoadUnits();
                Components.CpanelUtils.createItemTarget(ref ddlTarget);

                var G_info = (from n in DB.ESHOP_NEWs
                              join c in DB.ESHOP_NEWS_CATs on n.NEWS_ID equals c.NEWS_ID into t2_join
                              from c in t2_join.DefaultIfEmpty()
                              where n.NEWS_ID == m_news_id
                              select new
                {
                    n,
                    c.CAT_ID
                }
                              );

                if (G_info.ToList().Count > 0)
                {
                    trCat.Visible  = false;
                    txtTitle.Value = G_info.ToList()[0].n.NEWS_TITLE;
                    txtcode.Value  = G_info.ToList()[0].n.NEWS_CODE;
                    //Kho
                    //txtquantity.Value = G_info.ToList()[0].n.NEWS_QUANTITY.ToString();
                    //txtton.Value = G_info.ToList()[0].n.NEWS_INVENTORY.ToString();

                    txtDesc.Value           = G_info.ToList()[0].n.NEWS_DESC;
                    txtUrl.Value            = G_info.ToList()[0].n.NEWS_URL;
                    ddlTarget.SelectedValue = G_info.ToList()[0].n.NEWS_TARGET;
                    txtPrice.Value          = Utils.CStrDef(Utils.CIntDef(G_info.ToList()[0].n.NEWS_PRICE1));
                    //Txtprice_promos.Value = Utils.CStrDef(Utils.CIntDef(G_info.ToList()[0].n.NEWS_PRICE2));
                    //drNhanHieu.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.UNIT_ID1);
                    //Drhangsx.SelectedValue=G_info.ToList()[0].n.UNIT_ID2.ToString();
                    //txtcountbuy.Value = G_info.ToList()[0].n.UNIT_ID3.ToString();
                    //rblNewsType.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.NEWS_TYPE);
                    rblStatus.SelectedValue     = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SHOWTYPE);
                    rblNewsPeriod.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.NEWS_PERIOD);
                    //rblField1.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.NEWS_FIELD1);
                    rblFeefback.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.NEWS_FEEDBACKTYPE);
                    txtOrder.Value            = Utils.CStrDef(G_info.ToList()[0].n.NEWS_ORDER, "1");
                    txtOrderPeriod.Value      = Utils.CStrDef(G_info.ToList()[0].n.NEWS_ORDER_PERIOD, "1");
                    //txtCount.Value = Utils.CStrDef(G_info.ToList()[0].n.NEWS_COUNT);
                    //lblCount.Text = string.IsNullOrEmpty(Utils.CStrDef(G_info.ToList()[0].n.NEWS_COUNT)) ? "0" : Utils.CStrDef(G_info.ToList()[0].n.NEWS_COUNT);
                    //lblSendEmail.Text = G_info.ToList()[0].n.NEWS_SENDDATE == null ? "Chưa gửi" : "Gửi lần cuối vào " + string.Format("{0:dd/MM/yyyy HH:mm:ss}", G_info.ToList()[0].n.NEWS_SENDDATE);
                    //txtbaohanh.Value = G_info.ToList()[0].n.NEWS_FIELD2;
                    //Rdstatus.SelectedValue = Utils.CIntDef(G_info.ToList()[0].n.NEWS_FIELD3).ToString();
                    //txtdesc_bot.Value = G_info.ToList()[0].n.NEWS_FIELD4;
                    //txtvideo.Value = G_info.ToList()[0].n.NEWS_DIET;
                    //seo
                    txtSeoTitle.Value       = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_TITLE);
                    txtSeoKeyword.Value     = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_KEYWORD);
                    txtSeoDescription.Value = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_DESC);
                    txtSeoUrl.Value         = Utils.CStrDef(G_info.ToList()[0].n.NEWS_SEO_URL);

                    //PRICE

                    //ddlUnit2.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.UNIT_ID2);

                    //Product Properties
                    // txtStatus.Value = G_info.ToList()[0].n.NEWS_FIELD1;
                    // txtWarranty.Value = G_info.ToList()[0].n.NEWS_FIELD2;
                    // txtOrigin.Value = G_info.ToList()[0].n.NEWS_FIELD3;
                    //txtManufacture.Value = G_info.ToList()[0].n.NEWS_FIELD4;
                    // txtWeight.Value = G_info.ToList()[0].n.NEWS_FIELD5;
                    //image
                    //if (!string.IsNullOrEmpty(G_info.ToList()[0].n.NEWS_IMAGE1))
                    //{
                    //    trUploadImage1.Visible = false;
                    //    trImage1.Visible = true;
                    //    Image1.Src = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE1;
                    //    hplImage1.NavigateUrl = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE1;
                    //    hplImage1.Text = G_info.ToList()[0].n.NEWS_IMAGE1;
                    //}
                    //else
                    //{
                    //    trUploadImage1.Visible = true;
                    //    trImage1.Visible = false;
                    //}

                    ////image2
                    //if (!string.IsNullOrEmpty(G_info.ToList()[0].n.NEWS_IMAGE2))
                    //{
                    //    trUploadImage2.Visible = false;
                    //    trImage2.Visible = true;
                    //    Image2.Src = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE2;
                    //    hplImage2.NavigateUrl = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE2;
                    //    hplImage2.Text = G_info.ToList()[0].n.NEWS_IMAGE2;
                    //}
                    //else
                    //{
                    //    trUploadImage2.Visible = true;
                    //    trImage2.Visible = false;
                    //}

                    //image3
                    if (!string.IsNullOrEmpty(G_info.ToList()[0].n.NEWS_IMAGE3))
                    {
                        trUploadImage3.Visible = false;
                        trImage3.Visible       = true;
                        Image3.Src             = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE3;
                        hplImage3.NavigateUrl  = PathFiles.GetPathNews(m_news_id) + G_info.ToList()[0].n.NEWS_IMAGE3;
                        hplImage3.Text         = G_info.ToList()[0].n.NEWS_IMAGE3;
                    }
                    else
                    {
                        trUploadImage3.Visible = true;
                        trImage3.Visible       = false;
                    }
                }
                else
                {
                    //trUploadImage1.Visible = true;
                    //trImage1.Visible = false;
                    //trUploadImage2.Visible = true;
                    //trImage2.Visible = false;
                    trUploadImage3.Visible = true;
                    trImage3.Visible       = false;
                    LoadCategoryParent();
                    trCat.Visible = true;
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void SaveInfo(string strLink = "")
        {
            try
            {
                //get image
                string Att_File;

                if (trUpload.Visible == true)
                {
                    if (fileImage1.PostedFile != null)
                    {
                        Att_File = Path.GetFileName(fileImage1.PostedFile.FileName);
                    }
                    else
                    {
                        Att_File = "";
                    }
                }
                else
                {
                    Att_File = hplFile.Text;
                }

                if (m_att_id == 0)
                {
                    //insert
                    ESHOP_NEWS_ATT g_insert = new ESHOP_NEWS_ATT();
                    g_insert.NEWS_ATT_NAME  = txtTitle.Value;
                    g_insert.EXT_ID         = Utils.CIntDef(ddlExtFiles.SelectedValue);
                    g_insert.NEWS_ATT_ORDER = Utils.CIntDef(txtOrder.Value);
                    g_insert.NEWS_ATT_URL   = txtUrl.Value;
                    g_insert.NEWS_ID        = m_news_id;
                    g_insert.NEWS_ATT_FILE  = Att_File;

                    DB.ESHOP_NEWS_ATTs.InsertOnSubmit(g_insert);

                    DB.SubmitChanges();

                    //get new id
                    var _new = DB.GetTable <ESHOP_NEWS_ATT>().OrderByDescending(g => g.NEWS_ATT_ID).Take(1);

                    m_att_id = _new.Single().NEWS_ATT_ID;

                    strLink = string.IsNullOrEmpty(strLink) ? "news_attachment.aspx?news_id=" + m_news_id : strLink;
                }
                else
                {
                    //update
                    var g_update = DB.GetTable <ESHOP_NEWS_ATT>().Where(g => g.NEWS_ATT_ID == m_att_id);

                    if (g_update.ToList().Count > 0)
                    {
                        g_update.Single().NEWS_ATT_NAME  = txtTitle.Value;
                        g_update.Single().EXT_ID         = Utils.CIntDef(ddlExtFiles.SelectedValue);
                        g_update.Single().NEWS_ATT_ORDER = Utils.CIntDef(txtOrder.Value);
                        g_update.Single().NEWS_ATT_URL   = txtUrl.Value;
                        g_update.Single().NEWS_ATT_FILE  = Att_File;
                        g_update.Single().NEWS_ID        = m_news_id;

                        DB.SubmitChanges();

                        strLink = string.IsNullOrEmpty(strLink) ? "news_attachment.aspx?news_id=" + m_news_id : strLink;
                    }
                }

                //update images
                if (trUpload.Visible)
                {
                    if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName))
                    {
                        string pathfile = Server.MapPath(PathFiles.GetPathNews(m_news_id));
                        //string pathfile = Server.MapPath("../data/news/" + m_news_id);
                        string fullpathfile = pathfile + "/" + Att_File;

                        if (!Directory.Exists(pathfile))
                        {
                            Directory.CreateDirectory(pathfile);
                        }

                        fileImage1.PostedFile.SaveAs(fullpathfile);
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }