Ejemplo n.º 1
0
        private void showFileHTML()
        {
            string pathFile;
            string strHTMLContent;

            //string strSubweb;

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

            if (_idcat > 0)
            {
                var newsInfo = DB.GetTable <ESHOP_CATEGORy>().Where(n => n.CAT_ID == _idcat);

                pathFile = Server.MapPath(PathFiles.GetPathCategory(_idcat) + "/" + newsInfo.ToList()[0].CAT_FIELD5);

                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;
                }
            }
        }
Ejemplo n.º 2
0
        private void SaveHTMLInfo()
        {
            try
            {
                if ((_idcat > 0))
                {
                    string       strHTMLFileLocation;
                    string       strFileName;
                    string       strHTMLContent;
                    StreamWriter fsoFile;

                    strFileName         = PathFiles.GetPathCategory(_idcat) + _idcat.ToString() + "-vi.htm";
                    strHTMLFileLocation = Server.MapPath(strFileName);
                    strHTMLContent      = mrk.Value;

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

                    //update to db
                    var n_update = DB.GetTable <ESHOP_CATEGORy>().Where(g => g.CAT_ID == _idcat);

                    if (n_update.ToList().Count > 0)
                    {
                        n_update.Single().CAT_FIELD5 = _idcat.ToString() + "-vi.htm";

                        DB.SubmitChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Ejemplo n.º 3
0
        private void EventDelete(DataGridCommandEventArgs e)
        {
            try
            {
                int CatId = Utils.CIntDef(GridItemList.DataKeys[e.Item.ItemIndex]);

                var g_delete = DB.GetTable <ESHOP_CATEGORy>().Where(g => g.CAT_ID == CatId);

                DB.ESHOP_CATEGORies.DeleteAllOnSubmit(g_delete);
                DB.SubmitChanges();

                //delete folder
                string fullpath = Server.MapPath(PathFiles.GetPathCategory(CatId));
                if (Directory.Exists(fullpath))
                {
                    DeleteAllFilesInFolder(fullpath);
                    Directory.Delete(fullpath);
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                Response.Redirect("category_list.aspx");
            }
        }
Ejemplo n.º 4
0
        public string getHmtlSeo(int id)
        {
            string pathFile;
            string strHTMLContent;
            string _result = string.Empty;

            if (id > 0)
            {
                var newsInfo = db.GetTable <ESHOP_CATEGORy>().Where(n => n.CAT_ID == id);

                if (newsInfo.ToList().Count > 0)
                {
                    pathFile = HttpContext.Current.Server.MapPath(PathFiles.GetPathCategory(id) + "/" + newsInfo.ToList()[0].CAT_FIELD5);
                    if ((File.Exists(pathFile)))
                    {
                        StreamReader objNewsReader;
                        objNewsReader  = new StreamReader(pathFile);
                        strHTMLContent = objNewsReader.ReadToEnd();
                        objNewsReader.Close();
                        _result = strHTMLContent;
                    }
                }
            }
            return(_result);
        }
Ejemplo n.º 5
0
        private void CreateDirectory()
        {
            m_pathFile = PathFiles.GetPathCategory(_idcat);

            if (!Directory.Exists(Server.MapPath(m_pathFile)))
            {
                Directory.CreateDirectory(Server.MapPath(m_pathFile));
            }
            Session["FileManager"] = m_pathFile;
        }
Ejemplo n.º 6
0
 public string Getimages_Cat(object cat_id, object cat_img)
 {
     if (Utils.CIntDef(cat_id) > 0 && !string.IsNullOrEmpty(Utils.CStrDef(cat_img)))
     {
         return(PathFiles.GetPathCategory(Utils.CIntDef(cat_id)) + Utils.CStrDef(cat_img));
     }
     else
     {
         return("");
     }
 }
Ejemplo n.º 7
0
 public string getimgCate(object id)
 {
     try
     {
         int idcat = Utils.CIntDef(id);
         var list  = db.ESHOP_CATEGORies.Where(n => n.CAT_ID == idcat).ToList();
         if (list.Count > 0)
         {
             return(PathFiles.GetPathCategory(list[0].CAT_ID) + "/" + list[0].CAT_IMAGE1);
         }
         return("");
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 8
0
 public string GetImageCat(object News_Id, object News_Image1)
 {
     try
     {
         if (Utils.CIntDef(News_Id) > 0 && !string.IsNullOrEmpty(Utils.CStrDef(News_Image1)))
         {
             return(PathFiles.GetPathCategory(Utils.CIntDef(News_Id)) + Utils.CStrDef(News_Image1));
         }
         else
         {
             return("");
         }
     }
     catch (Exception ex)
     {
         clsVproErrorHandler.HandlerError(ex);
         return(null);
     }
 }
Ejemplo n.º 9
0
        private void showFileHTML()
        {
            string pathFile;
            string strHTMLContent;

            if (m_cat_id > 0)
            {
                var newsInfo = DB.GetTable <ESHOP_CATEGORy>().Where(n => n.CAT_ID == m_cat_id);

                pathFile = Server.MapPath(PathFiles.GetPathCategory(m_cat_id) + "/" + newsInfo.ToList()[0].CAT_FIELD5);

                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;
                }
            }
        }
Ejemplo n.º 10
0
        protected void btnDelete3_Click(object sender, ImageClickEventArgs e)
        {
            string strLink = "";

            try
            {
                var n_info = DB.GetTable <ESHOP_CATEGORy>().Where(n => n.CAT_ID == m_cat_id);

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

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

                        strLink = "category.aspx?cat_id=" + m_cat_id;
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                if (!string.IsNullOrEmpty(strLink))
                {
                    Response.Redirect(strLink);
                }
            }
        }
Ejemplo n.º 11
0
 protected void Btupmulti_Click(object sender, EventArgs e)
 {
     try
     {
         if (FileUpload1.HasFile)
         {
             HttpFileCollection hfc   = Request.Files;
             List <string>      lpath = new List <string>();
             for (int i = 0; i < hfc.Count; i++)
             {
                 HttpPostedFile hpf = hfc[i];
                 if (hpf.ContentLength > 0)
                 {
                     string pathfile     = Server.MapPath("/data/categories/" + _idcat);
                     string fullpathfile = pathfile + "/" + Path.GetFileName(hpf.FileName);
                     lpath.Add(PathFiles.GetPathCategory(_idcat) + _idcat.ToString() + "/" + Path.GetFileName(hpf.FileName));
                     if (!Directory.Exists(pathfile))
                     {
                         Directory.CreateDirectory(pathfile);
                     }
                     hpf.SaveAs(fullpathfile);
                 }
             }
             string listimg = string.Empty;
             for (int s = 0; s < lpath.Count; s++)
             {
                 listimg += "<p><img src='" + lpath[s] + "' alt=''/></p>";
             }
             mrk.Value += listimg;
         }
     }
     catch (Exception ex)
     {
         clsVproErrorHandler.HandlerError(ex);
     }
 }
Ejemplo n.º 12
0
        private void DeleteInfo()
        {
            try
            {
                var G_info = DB.GetTable <ESHOP_CATEGORy>().Where(g => g.CAT_ID == m_cat_id);

                DB.ESHOP_CATEGORies.DeleteAllOnSubmit(G_info);
                DB.SubmitChanges();

                //delete folder
                string fullpath = Server.MapPath(PathFiles.GetPathCategory(m_cat_id));
                if (Directory.Exists(fullpath))
                {
                    DeleteAllFilesInFolder(fullpath);
                    Directory.Delete(fullpath);
                }

                Response.Redirect("category_list.aspx");
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Ejemplo n.º 13
0
        private void getInfo()
        {
            try
            {
                LoadCategoryParent();
                Components.CpanelUtils.createItemTarget(ref ddlTarget);
                Components.CpanelUtils.createItemLanguage(ref rblLanguage);

                var G_info = (from c in DB.ESHOP_CATEGORies
                              where c.CAT_ID == m_cat_id
                              select c
                              );

                if (G_info.ToList().Count > 0)
                {
                    ddlCategory.SelectedValue = Utils.CStrDef(G_info.ToList()[0].CAT_PARENT_ID);
                    txtCode.Value             = G_info.ToList()[0].CAT_CODE;
                    txtName.Value             = G_info.ToList()[0].CAT_NAME;
                    txtDesc.Value             = G_info.ToList()[0].CAT_DESC;
                    txtUrl.Value            = G_info.ToList()[0].CAT_URL;
                    ddlTarget.SelectedValue = G_info.ToList()[0].CAT_TARGET;
                    rblStatus.SelectedValue = Utils.CStrDef(G_info.ToList()[0].CAT_STATUS);
                    //rblAccess.SelectedValue = Utils.CStrDef(G_info.ToList()[0].CAT_ACCESS);
                    rblPos.SelectedValue        = Utils.CStrDef(G_info.ToList()[0].CAT_POSITION);
                    rblShowFooter.SelectedValue = Utils.CStrDef(G_info.ToList()[0].CAT_SHOWFOOTER);
                    rblShowItems.SelectedValue  = Utils.CStrDef(G_info.ToList()[0].CAT_SHOWITEM);
                    rblCatPeriod.SelectedValue  = Utils.CStrDef(G_info.ToList()[0].CAT_PERIOD);
                    rblLanguage.SelectedValue   = Utils.CStrDef(G_info.ToList()[0].CAT_LANGUAGE);
                    txtOrder.Value       = Utils.CStrDef(G_info.ToList()[0].CAT_ORDER);
                    txtOrderPeriod.Value = Utils.CStrDef(G_info.ToList()[0].CAT_PERIOD_ORDER);
                    txtpageItem.Value    = Utils.CStrDef(G_info.ToList()[0].CAT_PAGEITEM);
                    //lblCount.Text = Utils.CStrDef(G_info.ToList()[0].CAT_COUNT);
                    rblCatType.SelectedValue = Utils.CStrDef(G_info.ToList()[0].CAT_TYPE);

                    //seo
                    txtSeoTitle.Value       = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_TITLE);
                    txtSeoKeyword.Value     = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_KEYWORD);
                    txtSeoDescription.Value = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_DESC);
                    txtSeoUrl.Value         = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_URL);

                    //english language
                    //txtNameEn.Value = G_info.ToList()[0].CAT_NAME_EN;
                    //txtCodeEn.Value = G_info.ToList()[0].CAT_CODE_EN;
                    //txtDescEn.Value = G_info.ToList()[0].CAT_DESC_EN;

                    //txtSeoTitleEn.Value = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_TITLE_EN);
                    //txtSeoKeywordEn.Value = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_KEYWORD_EN);
                    //txtSeoDescriptionEn.Value = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_DESC_EN);
                    //txtSeoUrlEn.Value = Utils.CStrDef(G_info.ToList()[0].CAT_SEO_URL_EN);


                    //image 1
                    if (!string.IsNullOrEmpty(G_info.ToList()[0].CAT_IMAGE1))
                    {
                        trUploadImage1.Visible = false;
                        trImage1.Visible       = true;
                        Image1.Src             = PathFiles.GetPathCategory(m_cat_id) + G_info.ToList()[0].CAT_IMAGE1;
                        hplImage1.NavigateUrl  = PathFiles.GetPathCategory(m_cat_id) + G_info.ToList()[0].CAT_IMAGE1;
                        hplImage1.Text         = G_info.ToList()[0].CAT_IMAGE1;
                    }
                    else
                    {
                        trUploadImage1.Visible = true;
                        trImage1.Visible       = false;
                    }

                    ////image 2
                    //if (!string.IsNullOrEmpty(G_info.ToList()[0].CAT_IMAGE2))
                    //{
                    //    trUploadImage2.Visible = false;
                    //    trImage2.Visible = true;
                    //    Image2.Src = PathFiles.GetPathCategory(m_cat_id) + G_info.ToList()[0].CAT_IMAGE2;
                    //    hplImage2.NavigateUrl = PathFiles.GetPathCategory(m_cat_id) + G_info.ToList()[0].CAT_IMAGE2;
                    //    hplImage2.Text = G_info.ToList()[0].CAT_IMAGE2;
                    //}
                    //else
                    //{
                    //    trUploadImage2.Visible = true;
                    //    trImage2.Visible = false;
                    //}

                    ////image 3
                    //if (!string.IsNullOrEmpty(G_info.ToList()[0].CAT_IMAGE3))
                    //{
                    //    trUploadImage3.Visible = false;
                    //    trImage3.Visible = true;
                    //    Image3.Src = PathFiles.GetPathCategory(m_cat_id) + G_info.ToList()[0].CAT_IMAGE3;
                    //    hplImage3.NavigateUrl = PathFiles.GetPathCategory(m_cat_id) + G_info.ToList()[0].CAT_IMAGE3;
                    //    hplImage3.Text = G_info.ToList()[0].CAT_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();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Ejemplo n.º 14
0
        public void Bind_meta_tags_cat()
        {
            #region Bind Meta Tags
            HtmlHead header    = base.Header;
            HtmlMeta headerDes = new HtmlMeta();
            HtmlMeta headerKey = new HtmlMeta();

            HtmlLink linkcanonical = new HtmlLink();
            HtmlMeta propety       = new HtmlMeta();
            HtmlMeta propetyTitle  = new HtmlMeta();
            HtmlMeta propetyDesc   = new HtmlMeta();

            headerDes.Name = "Description";
            headerKey.Name = "Keywords";

            header.Title      = Utils.CStrDef(Session["Cat_seo_title"]);
            headerDes.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            headerKey.Content = Utils.CStrDef(Session["Cat_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
            //Link
            linkcanonical.Attributes.Add("rel", "canonical");
            linkcanonical.Href = System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "/" + Utils.CStrDef(Session["Cat_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.GetPathCategory(Utils.CIntDef(Session["Cat_id"])) + Utils.CStrDef(Session["Cat_img1"]);
            header.Controls.Add(propety);
            //Title
            propetyTitle.Attributes.Add("property", "og:title");
            propetyTitle.Content = Utils.CStrDef(Session["Cat_name"]);
            header.Controls.Add(propetyTitle);
            //Desc
            propetyDesc.Attributes.Add("property", "og:description");
            propetyDesc.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            header.Controls.Add(propetyDesc);
            #endregion
        }
Ejemplo n.º 15
0
        public void Bind_meta_tags_cat()
        {
            #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["Cat_seo_title"]);
            headerDes.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            headerKey.Content = Utils.CStrDef(Session["Cat_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.GetPathCategory(Utils.CIntDef(Session["Cat_id"])) + Utils.CStrDef(Session["Cat_image1"]);
            header.Controls.Add(propety);
            //Title
            propetyTitle.Attributes.Add("property", "og:title");
            propetyTitle.Content = Utils.CStrDef(Session["Cat_seo_title"]);
            header.Controls.Add(propetyTitle);
            //Desc
            propetyDesc.Attributes.Add("property", "og:description");
            propetyDesc.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            header.Controls.Add(propetyDesc);
            //Twitter meta
            propetyTw.Attributes.Add("property", "twitter:image");
            propetyTw.Content = "" + System.Configuration.ConfigurationManager.AppSettings["URLWebsite"] + "" + PathFiles.GetPathCategory(Utils.CIntDef(Session["Cat_id"])) + Utils.CStrDef(Session["Cat_image1"]);
            header.Controls.Add(propetyTw);
            //Title
            propetyTitleTw.Attributes.Add("property", "twitter:title");
            propetyTitleTw.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            header.Controls.Add(propetyTitleTw);
            //Desc
            propetyDescTw.Attributes.Add("property", "twitter:description");
            propetyDescTw.Content = Utils.CStrDef(Session["Cat_seo_desc"]);
            header.Controls.Add(propetyDescTw);
            #endregion
        }