private void SearchResult()
        {
            try
            {
                string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);

                var AllList = (from g in DB.ESHOP_NEWs
                               where ("" == keyword || DB.fClearUnicode(g.NEWS_TITLE).Contains(keyword) || g.NEWS_DESC.Contains(keyword))
                               //&& g.NEWS_LANGUAGE == lang
                               && (g.NEWS_TYPE != 1 && g.NEWS_TYPE != 2)
                               orderby g.NEWS_ID descending
                               select g);


                if (AllList.ToList().Count > 0)
                {
                    Session["NewsList"] = DataUtil.LINQToDataTable(AllList);
                }

                GridItemList.DataSource = AllList;
                if (AllList.ToList().Count > GridItemList.PageSize)
                {
                    GridItemList.AllowPaging = true;
                }
                else
                {
                    GridItemList.AllowPaging = false;
                }
                GridItemList.DataBind();
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void LoadCategoryParent()
        {
            try
            {
                var CatList = (
                    from t2 in DB.ESHOP_PROPERTies
                    select new
                {
                    PROP_ID = t2.PROP_NAME == "------- Root -------" ? 0 : t2.PROP_ID,
                    PROP_NAME = t2.PROP_NAME,
                    PROP_PARENT_ID = t2.PROP_PARENT_ID,
                    PROP_RANK = t2.PROP_RANK
                }
                    );

                if (CatList.ToList().Count > 0)
                {
                    DataRelation relCat;
                    DataTable    tbl = DataUtil.LINQToDataTable(CatList);
                    DataSet      ds  = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["PROP_ID"] };
                    relCat         = new DataRelation("Category_parent", ds.Tables[0].Columns["PROP_ID"], ds.Tables[0].Columns["PROP_PARENT_ID"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    CpanelUtils.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);

                    ddlCategory.DataSource     = dsCat.Tables[0];
                    ddlCategory.DataTextField  = "PROP_NAME";
                    ddlCategory.DataValueField = "PROP_ID";
                    ddlCategory.DataBind();
                }
                else
                {
                    DataTable dt = new DataTable("Newtable");

                    dt.Columns.Add(new DataColumn("PROP_ID"));
                    dt.Columns.Add(new DataColumn("PROP_NAME"));

                    DataRow row = dt.NewRow();
                    row["PROP_ID"]   = 0;
                    row["PROP_NAME"] = "--------Root--------";
                    dt.Rows.Add(row);

                    ddlCategory.DataTextField  = "PROP_NAME";
                    ddlCategory.DataValueField = "PROP_ID";
                    ddlCategory.DataSource     = dt;
                    ddlCategory.DataBind();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void SearchResult()
        {
            try
            {
                string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);

                var AllList = (from g in DB.ESHOP_CATEGORies
                               where ("" == keyword || (DB.fClearUnicode(g.CAT_NAME)).Contains(keyword)) && g.CAT_RANK > 0
                               select new
                {
                    g.CAT_ID,
                    g.CAT_PARENT_ID,
                    CAT_NAME = (string.IsNullOrEmpty(g.CAT_CODE) ? g.CAT_NAME : g.CAT_NAME + "(" + g.CAT_CODE + ")"),
                    g.CAT_POSITION,
                    g.CAT_LANGUAGE,
                    g.CAT_ORDER,
                    g.CAT_PERIOD_ORDER,
                    g.CAT_RANK,
                    g.CAT_STATUS
                });

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;
                    //Session["CatList"] = DataUtil.LINQToDataTable(AllList);
                    //DataTable tbl = Session["CatList"] as DataTable;
                    DataTable tbl = DataUtil.LINQToDataTable(AllList);

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["CAT_ID"] };
                    relCat         = new DataRelation("Category_parent", ds.Tables[0].Columns["CAT_ID"], ds.Tables[0].Columns["CAT_PARENT_ID"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    DataUtil.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);
                    if (IsPostBack)
                    {
                        Rplistcate.DataSource = AllList;
                        Rplistcate.DataBind();
                    }
                    else
                    {
                        Rplistcate.DataSource = dsCat.Tables[0];
                        Rplistcate.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void SearchResult()
        {
            try
            {
                string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
                if (_gtype != 1)
                {
                    var AllList = (from g in DB.ESHOP_SHOPs
                                   where ("" == keyword || (DB.fClearUnicode(g.NAME)).Contains(keyword)) &&
                                   g.FIELD1 == _userId.ToString()
                                   select new
                    {
                        g.ID,
                        g.NAME,
                        g.EMAIL,
                        g.ADDRESS,
                        g.PHONE,
                        g.FIELD1,
                        g.WEBSITE,
                        g.TYPE,
                        g.SEO_URL
                    });

                    Rplistcate.DataSource = AllList;
                    Rplistcate.DataBind();
                }
                else
                {
                    var AllList = (from g in DB.ESHOP_SHOPs
                                   where ("" == keyword || (DB.fClearUnicode(g.NAME)).Contains(keyword))
                                   select new
                    {
                        g.ID,
                        g.NAME,
                        g.EMAIL,
                        g.ADDRESS,
                        g.PHONE,
                        g.FIELD1,
                        g.WEBSITE,
                        g.TYPE,
                        g.SEO_URL
                    });

                    Rplistcate.DataSource = AllList;
                    Rplistcate.DataBind();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void SearchResult()
        {
            try
            {
                string keyword = txtKeyword.Value;
                int    _limit  = 20;
                int    _skip   = 0;
                if (_page != 0)
                {
                    _skip = _page * _limit - _limit;
                }
                var AllList = (from g in DB.ESHOP_PROPERTies
                               where ("" == keyword || (g.PROP_NAME).Contains(keyword)) && g.PROP_RANK > 0
                               select new
                {
                    g.PROP_ID,
                    g.PROP_PARENT_ID,
                    g.PROP_NAME,
                    g.PROP_RANK
                });

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;
                    Session["PropList"] = DataUtil.LINQToDataTable(AllList);
                    //DataTable tbl = Session["CatList"] as DataTable;
                    DataTable tbl = DataUtil.LINQToDataTable(AllList);

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["PROP_ID"] };
                    relCat         = new DataRelation("Category_parent", ds.Tables[0].Columns["PROP_ID"], ds.Tables[0].Columns["PROP_PARENT_ID"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    CpanelUtils.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);

                    RplistArea.DataSource = dsCat.Tables[0];
                    RplistArea.DataBind();
                    //LitPage.Text = pagechange.changePage("customer_list.aspx", AllList.ToList().Count, _limit, _page);
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void SearchResult()
        {
            try
            {
                string keyword = txtKeyword.Value;

                var AllList = (from g in DB.ESHOP_PROPERTies
                               where ("" == keyword || (g.PROP_NAME).Contains(keyword)) && g.PROP_RANK > 0
                               select new
                {
                    g.PROP_ID,
                    g.PROP_PARENT_ID,
                    g.PROP_NAME,
                    g.PROP_RANK
                });

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;
                    Session["PropList"] = DataUtil.LINQToDataTable(AllList);
                    //DataTable tbl = Session["CatList"] as DataTable;
                    DataTable tbl = DataUtil.LINQToDataTable(AllList);

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["PROP_ID"] };
                    relCat         = new DataRelation("Category_parent", ds.Tables[0].Columns["PROP_ID"], ds.Tables[0].Columns["PROP_PARENT_ID"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    CpanelUtils.TransformTableWithSpace(ref CatTable, dsCat.Tables[0], relCat, null);

                    GridItemList.DataSource = dsCat.Tables[0];
                    //if (CatTable.Rows.Count > GridItemList.PageSize)
                    //    GridItemList.AllowPaging = true;
                    //else
                    //    GridItemList.AllowPaging = false;
                    GridItemList.DataBind();
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
        private void SearchResult()
        {
            try
            {
                int    _limit  = 20;
                int    _skip   = 0;
                string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
                int    _catid  = Utils.CIntDef(ddlCategory.SelectedValue);
                if (_catid != 0 || !String.IsNullOrEmpty(keyword))
                {
                    _limit = 200;
                }

                if (_page != 0)
                {
                    _skip = _page * _limit - _limit;
                }
                var AllList = (from g in DB.ESHOP_NEWs
                               join a in DB.ESHOP_NEWS_CATs on g.NEWS_ID equals a.NEWS_ID into t2_join
                               from d in t2_join.DefaultIfEmpty()
                               where ("" == keyword || SqlMethods.Like(g.NEWS_KEYWORD_ASCII, "%" + keyword + "%") || g.NEWS_CODE.Contains(keyword)) &&
                               (_gtype != 1 ? (getCatid().Contains(d.ESHOP_CATEGORy.CAT_ID.ToString()) || getCatid().Contains(d.ESHOP_CATEGORy.CAT_PARENT_ID.ToString())) : true) &&
                               (_type == 1 ? g.NEWS_TYPE == 1 : g.NEWS_TYPE != 1) &&
                               ((d.ESHOP_CATEGORy.CAT_ID == _catid || d.ESHOP_CATEGORy.CAT_PARENT_PATH.Contains(_catid.ToString())) || 0 == _catid)
                               orderby g.NEWS_ID descending
                               select g).GroupBy(n => n.NEWS_ID).Select(n => new
                {
                    NEWS_ID          = n.First().NEWS_ID,
                    NEWS_TITLE       = n.First().NEWS_TITLE,
                    NEWS_TYPE        = n.First().NEWS_TYPE,
                    NEWS_SHOWTYPE    = n.First().NEWS_SHOWTYPE,
                    NEWS_ORDER       = n.First().NEWS_ORDER,
                    NEWS_PUBLISHDATE = n.First().NEWS_PUBLISHDATE,
                }).OrderByDescending(n => n.NEWS_ID).ToList();


                RpItemList.DataSource = AllList.Skip(_skip).Take(_limit);
                RpItemList.DataBind();
                LitPage.Text = pagechange.changePageNews("news_list.aspx", AllList.Count, _limit, _page, _type);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Beispiel #8
0
        private void Loadinventory()
        {
            string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
            var    list    = DB.ESHOP_NEWs.Where(n => n.NEWS_TYPE == 1 && (DB.fClearUnicode(n.NEWS_TITLE).Contains(keyword) || DB.fClearUnicode(n.NEWS_CODE).Contains(keyword) || "" == keyword)).OrderByDescending(n => n.NEWS_ID).ToList();

            if (list.Count > 0)
            {
                ASPxGridView_inventory.DataSource = list;
                ASPxGridView_inventory.DataBind();
                HttpContext.Current.Session["buy.listinvent"] = list;
            }
            else
            {
                HttpContext.Current.Session["buy.listinvent"] = null;
                ASPxGridView_inventory.DataSource             = list;
                ASPxGridView_inventory.DataBind();
            }
        }
Beispiel #9
0
        public string getPosition(object obj_position)
        {
            List <string[]> l    = CpanelUtils.listAds();
            var             list = from obj in l
                                   select new
            {
                Id   = obj[0],
                Name = obj[1]
            };

            foreach (var i in list)
            {
                if (Utils.CIntDef(obj_position) == Utils.CIntDef(i.Id))
                {
                    return(i.Name);
                }
            }
            return("");
        }
        private void SearchResult()
        {
            try
            {
                string keyword = txtKeyword.Value;
                int    _limit  = 20;
                int    _skip   = 0;
                if (_page != 0)
                {
                    _skip = _page * _limit - _limit;
                }
                var AllList = (from g in DB.MENUs
                               where "" == keyword || g.MENU_NAME.Contains(keyword)
                               orderby g.ID descending
                               select g);

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;

                    DataTable tbl = DataUtil.LINQToDataTable(AllList);

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["ID"] };
                    relCat         = new DataRelation("Category_parent", ds.Tables[0].Columns["ID"], ds.Tables[0].Columns["MENU_PARENT_ID"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    CpanelUtils.TransformTableWithSpace2(ref CatTable, dsCat.Tables[0], relCat, null);
                    RplistMenu.DataSource = dsCat.Tables[0];
                    RplistMenu.DataBind();
                    //LitPage.Text = pagechange.changePage("customer_list.aspx", AllList.ToList().Count, _limit, _page);
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Beispiel #11
0
        private void SearchResult()
        {
            try
            {
                int    _limit  = 20;
                int    _skip   = 0;
                string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
                int    _catid  = Utils.CIntDef(ddlCategory.SelectedValue);
                if (_catid != 0 || !String.IsNullOrEmpty(keyword))
                {
                    _limit = 200;
                }

                if (_page != 0)
                {
                    _skip = _page * _limit - _limit;
                }
                var AllList = (from g in DB.ESHOP_NEWs
                               join a in DB.ESHOP_NEWS_CATs on g.NEWS_ID equals a.NEWS_ID
                               join d in DB.ESHOP_CATEGORies on a.CAT_ID equals d.CAT_ID
                               where ("" == keyword || (DB.fClearUnicode(g.NEWS_TITLE)).Contains(keyword) || g.NEWS_CODE.Contains(keyword)) &&
                               (g.NEWS_TYPE == 1) && g.UNIT_ID2 > 0 &&
                               ((d.CAT_ID == _catid || d.CAT_PARENT_PATH.Contains(_catid.ToString())) || 0 == _catid)
                               orderby g.UNIT_ID2 descending
                               select g).GroupBy(n => n.NEWS_ID).Select(n => new
                {
                    UNIT_ID2         = n.First().UNIT_ID2,
                    NEWS_ID          = n.First().NEWS_ID,
                    NEWS_TITLE       = n.First().NEWS_TITLE,
                    NEWS_TYPE        = n.First().NEWS_TYPE,
                    NEWS_SHOWTYPE    = n.First().NEWS_SHOWTYPE,
                    NEWS_ORDER       = n.First().NEWS_ORDER,
                    NEWS_PUBLISHDATE = n.First().NEWS_PUBLISHDATE,
                }).OrderByDescending(n => n.NEWS_ID).ToList();
                RpItemList.DataSource = AllList.Skip(_skip).Take(_limit);
                RpItemList.DataBind();
                LitPage.Text = pagechange.changePageNews(AllList.Count, _limit, "xulylinkdie.aspx", _page, _type, 10);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Beispiel #12
0
 private void SearchResult()
 {
     try
     {
         int    _limit  = 40;
         int    _skip   = 0;
         string keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
         if (_page != 0)
         {
             _skip = _page * _limit - _limit;
         }
         var AllList = (from g in DB.ESHOP_NEWs
                        where (g.NEWS_TYPE == 1 && ("" == keyword || (DB.fClearUnicode(g.NEWS_TITLE)).Contains(keyword)))
                        select new
         {
             g.NEWS_ID,
             g.NEWS_TITLE,
             g.NEWS_PERIOD,
             g.NEWS_COUNT,
             g.NEWS_ORDER,
             g.NEWS_ORDER_PERIOD,
             g.NEWS_PUBLISHDATE,
         }).ToList();
         if (_News_period == 1)
         {
             AllList = AllList.OrderByDescending(n => n.NEWS_ID).ToList();
         }
         else
         {
             AllList = AllList.OrderByDescending(n => n.NEWS_COUNT).ToList();
         }
         Rplist_news.DataSource = AllList.Skip(_skip).Take(_limit);
         Rplist_news.DataBind();
         LitPage.Text = changePageNews(AllList.Count, _limit, "duyet_video_index.aspx", _page, 10);
     }
     catch (Exception ex)
     {
         clsVproErrorHandler.HandlerError(ex);
     }
 }
Beispiel #13
0
        private void LoadMenu()
        {
            try
            {
                var AllList = DB.MENUs.Where(n => n.MENU_ACTIVE == 1);

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;

                    DataTable tbl = DataUtil.LINQToDataTable(AllList);

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["ID"] };
                    relCat         = new DataRelation("Category_parent", ds.Tables[0].Columns["ID"], ds.Tables[0].Columns["MENU_PARENT_ID"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    CpanelUtils.TransformTableWithSpace2(ref CatTable, dsCat.Tables[0], relCat, null);
                    Rplistmenu.DataSource = dsCat.Tables[0];
                    Rplistmenu.DataBind();
                }


                //var allCat=DB.GetTable<ESHOP_CATEGORy>();

                //GridItemList.DataSource = allCat;
                //GridItemList.DataBind();

                //Session["CatGroupList"] = allCat;
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Beispiel #14
0
        private void loadListInventory()
        {
            string   keyword = CpanelUtils.ClearUnicode(txtKeyword.Value);
            string   date    = txtDate.Text;
            DateTime dt      = DateTime.Now;

            if (!String.IsNullOrEmpty(date))
            {
                dt = Utils.CDateDef(catngay(date), DateTime.Now);
            }
            //int khoid = Utils.CIntDef(Drkho.SelectedValue);
            //int nhacccid = Utils.CIntDef(Drnhacc.SelectedValue);
            var list = (from a in db.ESHOP_NEWs
                        join b in db.INVENTORies on a.NEWS_ID equals b.NEWS_ID
                        where b.INVENT_TYPE == type && (db.fClearUnicode(a.NEWS_TITLE).Contains(keyword) || db.fClearUnicode(a.NEWS_CODE).Contains(keyword) || "" == keyword)
                        //&&(b.INVENT_KHO==khoid||0==khoid)&&(b.INVENT_NHACC==nhacccid||0==nhacccid)
                        && (!String.IsNullOrEmpty(date) ? b.INVENT_DATE.Value.Date == dt : 0 == 0)
                        select new
            {
                a.NEWS_TITLE,
                a.NEWS_CODE,
                b.INVENT_TYPE,
                b.ID,
                b.INVENT_DATE,
                b.INVENT_QUANTITY,
                b.USER_ID,
                b.INVENT_NHACC,
                b.INVENT_KHO,
                b.INVENT_PRICE,
                b.INVENT_NAMEKH,
                b.INVENT_ADDRESS,
                b.INVENT_CHIECKHAU,
                b.INVENT_NO,
                b.INVENT_NOTE
            }).OrderByDescending(n => n.ID).ToList();

            RplistInvent.DataSource = list;
            RplistInvent.DataBind();
        }
Beispiel #15
0
        private void LoadMenu()
        {
            try
            {
                var AllList = DB.MENUs.Where(n => n.MENU_ACTIVE == 1);

                if (AllList.ToList().Count > 0)
                {
                    DataRelation relCat;

                    DataTable tbl = DataUtil.LINQToDataTable(AllList);

                    DataSet ds = new DataSet();
                    ds.Tables.Add(tbl);

                    tbl.PrimaryKey = new DataColumn[] { tbl.Columns["ID"] };
                    relCat         = new DataRelation("Category_parent", ds.Tables[0].Columns["ID"], ds.Tables[0].Columns["MENU_PARENT_ID"], false);

                    ds.Relations.Add(relCat);
                    DataSet   dsCat    = ds.Clone();
                    DataTable CatTable = ds.Tables[0];

                    CpanelUtils.TransformTableWithSpace2(ref CatTable, dsCat.Tables[0], relCat, null);
                    Drchuyenmuc.DataValueField = "ID";
                    Drchuyenmuc.DataTextField  = "MENU_NAME";
                    Drchuyenmuc.DataSource     = dsCat.Tables[0];
                    Drchuyenmuc.DataBind();
                }
                ListItem l = new ListItem("------- Root -------", "0");
                l.Selected = true;
                Drchuyenmuc.Items.Insert(0, l);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
        }
Beispiel #16
0
        private void SaveInfo()
        {
            try
            {
                //get image
                string Banner_File;

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

                //get image
                string BG_File;

                if (trUploadBG.Visible == true)
                {
                    if (fileImageBG.PostedFile != null)
                    {
                        BG_File = Path.GetFileName(fileImageBG.PostedFile.FileName);
                    }
                    else
                    {
                        BG_File = "";
                    }
                }
                else
                {
                    BG_File = hplFileBG.Text;
                }

                var G_info = DB.GetTable <ESHOP_CONFIG>().OrderBy(c => c.CONFIG_ID).Take(1);

                if (G_info.ToList().Count > 0)
                {
                    G_info.Single().CONFIG_TITLE       = txtSeoTitle.Value;
                    G_info.Single().CONFIG_DESCRIPTION = txtSeoDesc.Value;
                    G_info.Single().CONFIG_KEYWORD     = txtSeoKeyword.Value;

                    G_info.Single().CONFIG_TITLE_EN       = txtSeoTitleEn.Value;
                    G_info.Single().CONFIG_DESCRIPTION_EN = txtSeoDescEn.Value;
                    G_info.Single().CONFIG_KEYWORD_EN     = txtSeoKeywordEn.Value;

                    G_info.Single().CONFIG_FAVICON = Banner_File;
                    G_info.Single().CONFIG_FIELD1  = BG_File;
                    G_info.Single().CONFIG_FIELD2  = ColorPicker1.Color;
                    DB.SubmitChanges();
                }
                else
                {
                    //insert
                    ESHOP_CONFIG config_insert = new ESHOP_CONFIG();

                    config_insert.CONFIG_TITLE       = txtSeoTitle.Value;
                    config_insert.CONFIG_DESCRIPTION = txtSeoDesc.Value;
                    config_insert.CONFIG_KEYWORD     = txtSeoKeyword.Value;

                    config_insert.CONFIG_TITLE_EN       = txtSeoTitleEn.Value;
                    config_insert.CONFIG_DESCRIPTION_EN = txtSeoDescEn.Value;
                    config_insert.CONFIG_KEYWORD_EN     = txtSeoKeywordEn.Value;
                    config_insert.CONFIG_FAVICON        = Banner_File;
                    config_insert.CONFIG_FIELD1         = BG_File;
                    config_insert.CONFIG_FIELD2         = ColorPicker1.Color;

                    DB.ESHOP_CONFIGs.InsertOnSubmit(config_insert);
                    DB.SubmitChanges();
                }

                //update images
                if (trUpload.Visible)
                {
                    if (!string.IsNullOrEmpty(fileImage1.PostedFile.FileName))
                    {
                        string pathfile     = Server.MapPath("/data/configs");
                        string fullpathfile = pathfile + "/" + Banner_File;

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

                        fileImage1.PostedFile.SaveAs(fullpathfile);
                    }
                }

                //update imagesBG
                if (trUploadBG.Visible)
                {
                    //if (!string.IsNullOrEmpty(fileImageBG.PostedFile.FileName))
                    //{
                    //    string pathfile = Server.MapPath("/data/configs");
                    //    string fullpathfile = pathfile + "/" + BG_File;

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

                    //    fileImageBG.PostedFile.SaveAs(fullpathfile);
                    //}
                    CpanelUtils.ImageResize(Server.MapPath("/data/configs/"), fileImageBG.Value, 2560, fileImageBG.PostedFile.InputStream);
                }
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
            }
            finally
            {
                getInfo();
            }
        }
Beispiel #17
0
        //private void LoadBrands()
        //{
        //    try
        //    {
        //        var units = DB.GetTable<ESHOP_BRAND>();

        //        ddlBrand.DataSource = units;
        //        ddlBrand.DataTextField = "NAME";
        //        ddlBrand.DataValueField = "ID";
        //        ddlBrand.DataBind();

        //        ddlBrand.Items.Insert(0, new ListItem("--------Thương hiệu--------", "0"));
        //    }
        //    catch (Exception ex)
        //    {
        //        clsVproErrorHandler.HandlerError(ex);
        //    }
        //}
        //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)
                {
                    if (G_info.ToList()[0].n.NEWS_TYPE == 0)
                    {
                        div_price.Visible = false;
                    }
                    else
                    {
                        div_price.Visible = true;
                    }
                    iCate.Visible           = false;
                    txtCode.Value           = G_info.ToList()[0].n.NEWS_CODE;
                    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;
                    txtPrice.Value          = CpanelUtils.FormatMoney(G_info.ToList()[0].n.NEWS_PRICE1);
                    txtPriceNew.Value       = CpanelUtils.FormatMoney(G_info.ToList()[0].n.NEWS_PRICE2);
                    //TextBox1.Text = Utils.CStrDef(Utils.CIntDef(G_info.ToList()[0].n.NEWS_PRICE3));
                    ddlBrand.SelectedValue = Utils.CStrDef(G_info.ToList()[0].n.UNIT_ID1);

                    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);
                    //txtWebsite.Value = Utils.CStrDef(G_info.ToList()[0].n.NEWS_FIELD2);
                    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);



                    //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);
            }
        }