示例#1
0
        public void SearchRecordByCategory()            // method to be called on search button click
        {
            string pCat = cmb_PL_PCategories.Text;

            if (pCat != "")
            {
                int BAdmin = 1;
                cDTO = new PCategoryDTO(pCat, BAdmin);

                pCategoryBLL = new ProductCategoryBLL();
                ArrayList arr = pCategoryBLL.pListingSearch(cDTO);

                lv_ProductListing.Items.Clear();
                foreach (object O in arr)
                {
                    ProductDTO   DTO  = (ProductDTO)O;
                    string[]     row  = { DTO.PID + "", DTO.PNAME, DTO.PCODE, DTO.PCOMPANY, DTO.PSTOCKUNIT, DTO.PCATEGORY };
                    ListViewItem item = new ListViewItem(row);
                    lv_ProductListing.Items.Add(item);
                }
            }
            else
            {
                MessageBox.Show("Please Select Category to Search", "Error");
            }
        }
示例#2
0
        /// <summary>
        /// ishHot=true,cateid=sanphamID
        /// </summary>
        private void GetDetail()
        {
            ProductCategoryBLL          pcBllCate = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lstCate   = pcBllCate.GetList(LangInt, pageName, "1", int.MinValue, true, "p.ordering", 1, 1000, out total);

            if (lstCate.Count > 0)
            {
                ltrProductRelate.Text = string.Format("{0} {1}", lstCate[0].ProductCategoryDesc.Name, LocalizationUtility.GetText("ltrProductRelate", Ci));
                hypAll.HRef           = LinkHelper.GetLink(lstCate[0].ProductCategoryDesc.NameUrl, LangId);

                categoryID = lstCate[0].Id.ToString();
                DataTable dtb   = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + categoryID + ",1)", null);
                string[]  array = dtb.AsEnumerable()
                                  .Select(row => row.Field <Int32>("id").ToString())
                                  .ToArray();
                string idFirst = string.Join(",", array);

                ProductBLL          pcBll = new ProductBLL();
                IList <PNK_Product> lst   = pcBll.GetListRelate(LangInt, string.Empty, idFirst, id, 1, 9999, out total);
                if (lst.Count > 0)
                {
                    this.rptResult.DataSource = lst;
                    this.rptResult.DataBind();
                }
            }
        }
示例#3
0
        /// <summary>
        /// Blog cuối cùng
        /// </summary>
        private void GetLastBlog()
        {
            ProductBLL pcBll = new ProductBLL();
            DataTable  dtb   = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdLastBlog"]) + ",1)", null);

            string[] array = dtb.AsEnumerable()
                             .Select(row => row.Field <Int32>("id").ToString())
                             .ToArray();
            string idFirst          = string.Join(",", array);
            IList <PNK_Product> lst = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, string.Empty, string.Empty, 1, 4, out total);

            if (total > 0)
            {
                rptLastBlog.DataSource = lst.OrderByDescending(m => m.PostDate);
                rptLastBlog.DataBind();

                ltrLastBlogCateName.Text = lst[0].CategoryNameDesc;
            }

            ProductCategoryBLL          pcBllCate = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lstCate   = pcBllCate.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdLastBlog"]), int.MinValue, false, string.Empty, 1, 1, out total);

            if (lstCate.Count > 0)
            {
                ltrLastBlogCateName.Text = lstCate[0].ProductCategoryDesc.Name;

                hypLastBlogCateName.HRef = LinkHelper.GetLink(lstCate[0].ProductCategoryDesc.NameUrl, LangId);
            }
        }
示例#4
0
        private void GetId()
        {
            #region Set thuoc tinh cho block_baseimage

            block_baseimage.ImagePath    = ConfigurationManager.AppSettings["ProductCategoryUpload"];
            block_baseimage.MinWidth     = ConfigurationManager.AppSettings["minWidthCategory"];
            block_baseimage.MinHeigh     = ConfigurationManager.AppSettings["minHeightCategory"];
            block_baseimage.MaxWidth     = ConfigurationManager.AppSettings["maxWidthCategory"];
            block_baseimage.MaxHeight    = ConfigurationManager.AppSettings["maxHeightCategory"];
            block_baseimage.MaxWidthBox  = ConfigurationManager.AppSettings["maxWidthBoxCategory"];
            block_baseimage.MaxHeightBox = ConfigurationManager.AppSettings["maxHeightBoxCategory"];

            #endregion

            //get ID param
            pcBll          = new ProductCategoryBLL();
            genericBLL     = new Generic <PNK_ProductCategory>();
            generic2CBLL   = new Generic2C <PNK_ProductCategory, PNK_ProductCategoryDesc>();
            genericDescBLL = new Generic <PNK_ProductCategoryDesc>();
            string strID = Utils.GetParameter("cid", string.Empty);
            this.productcategoryId = strID == string.Empty ? int.MinValue : DBConvert.ParseInt(strID);
            this.template_path     = WebUtils.GetWebPath();

            //Set default value order
            if (productcategoryId == int.MinValue)
            {
                txtOrder.Value = genericBLL.getOrdering().ToString();
            }
        }
示例#5
0
        private string GetProductCategory()
        {
            ProductCategoryBLL          pcBll = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lst   = null;

            if (pageName == "home" || pageName == "trang-chu")
            {
                lst = pcBll.GetListTree(LangInt, string.Empty, null, int.MinValue, ConfigurationManager.AppSettings["parentIdTemplate"], string.Empty, 1, true, string.Empty, 1, 9999, out total);
                if (lst.Count > 0)
                {
                    categoryID = lst[0].ProductCategoryDesc.Id.ToString();

                    //ltrCateName.Text = lst[0].ProductCategoryDesc.Name;
                }
            }
            else
            {
                string treeNameUrl = (Session["level"] != null && DBConvert.ParseInt(Session["level"]) == 1) ? pageName : UtilityLocal.RemoveLanguage(Request.RawUrl, LangId);
                lst = pcBll.GetListTree(LangInt, string.Empty, null, int.MinValue, string.Empty, treeNameUrl, 1, true, string.Empty, 1, 9999, out total);
                if (lst.Count > 0)
                {
                    categoryID = lst[0].Id.ToString();

                    //ltrCateName.Text = lst[0].ProductCategoryDesc.Name;

                    //Set category header
                    ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0], Request);

                    //Set SEO
                    WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page);
                    WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls);
                }
            }
            return(categoryID);
        }
示例#6
0
        private Dictionary <string, object> GetProductCategory(string treeNameUrl)
        {
            Dictionary <string, object> dicCate = new Dictionary <string, object>();
            string result_TreeNameUrl = string.Empty, result_TreeName = string.Empty;

            treeNameUrl = UtilityLocal.RemoveLanguage(treeNameUrl, LangId);
            ProductCategoryBLL          pcBll   = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lstCate = pcBll.GetListTree(LangInt, string.Empty, null, int.MinValue, string.Empty, treeNameUrl, 1, true, string.Empty, 1, 9999, out total);
            StringBuilder sb = new StringBuilder();

            if (lstCate.Count > 0)
            {
                string[] arrTreeNameUrlUnicodeDesc = lstCate[0].ProductCategoryDesc.TreeNameUrlUnicodeDesc.Split('/');
                string[] arrTreeNameUrl            = lstCate[0].ProductCategoryDesc.TreeNameUrlDesc.Split('/');

                if (arrTreeNameUrlUnicodeDesc != null)
                {
                    for (int i = 0; i < arrTreeNameUrlUnicodeDesc.Length; i++)
                    {
                        result_TreeNameUrl = i == 0 ? LinkHelper.GetLink(PageName, LangId) : string.Format("{0}/{1}", result_TreeNameUrl, arrTreeNameUrl[i]);
                        result_TreeName    = result_TreeName + arrTreeNameUrlUnicodeDesc[i];
                        sb.AppendFormat("<li><a href='{0}'>{1}</a></li>", result_TreeNameUrl, arrTreeNameUrlUnicodeDesc[i]);
                    }
                }
            }
            dicCate.Add("TreeNameUrl", sb);
            //dicCate.Add("TreeName", result_TreeName);
            return(dicCate);
        }
示例#7
0
        /// <summary>
        /// Get Image theo danh mục PNK_ProductCategory
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string ImagePathByFont(PNK_ProductCategory data, HttpRequest request)
        {
            string             result = string.Empty, id = string.Empty, pathTreeSub = string.Empty, LangId = data.ProductCategoryDesc.LangId == 1 ? "vn" : "eng";
            ProductCategoryBLL pcBll = new ProductCategoryBLL();

            string imagePath = data.BaseImage == "" ? "breadcrumb-bg.jpg" : data.BaseImage;
            int    imageType = data.ImageType;

            switch (imageType)
            {
            case 1:
                string strHtml = WebUtils.GetMailTemplate(Path.Combine(request.PhysicalApplicationPath, "TemplateMail/CategoryHeader.txt"));
                result = string.Format(strHtml
                                       , WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductCategoryUpload"], data.BaseImage)//Image
                                       , data.ProductCategoryDesc.Name
                                       );

                break;

            case 2:
                result = data.ImageFont;
                break;
            }

            return(result.ToString());
        }
示例#8
0
        public static string GetPathTreeNameUrl(int categoryID, int langInt, string langId)
        {
            string result = string.Empty, id = string.Empty, pathTreeSub = string.Empty;

            try
            {
                ProductCategoryBLL          pcBll = new ProductCategoryBLL();
                IList <PNK_ProductCategory> lst   = pcBll.GetList(langInt, string.Empty, string.Empty, categoryID, int.MinValue, false, string.Empty, 1, 9999, out total);
                if (total > 0)
                {
                    string pathTree = lst[0].PathTree;
                    int    level    = pathTree.Count(i => i.Equals('.'));
                    for (int i = 1; i <= level; i++)
                    {
                        pathTreeSub = pathTree.Split('.')[i];
                        id          = pathTreeSub.Split('-')[1];
                        lst         = pcBll.GetList(langInt, string.Empty, string.Empty, int.Parse(id), int.MinValue, false, string.Empty, 1, 9999, out total);

                        result = result + (total > 0 ? lst[0].ProductCategoryDesc.NameUrl : string.Empty) + "/";

                        if (i == 1)
                        {
                            result = result + langId + "/";
                        }
                    }
                    result = result == "" ? "" : result.Remove(result.LastIndexOf('/'), 1);
                }
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("Home Page", "GetPathTreeNameUrl", ex.Message);
            }

            return(result);
        }
示例#9
0
        private void InitPage()
        {
            template_path = WebUtils.GetWebPath();
            pageName      = Utils.GetParameter("page", "home");
            cid           = Utils.GetParameter("cid", string.Empty);
            cidsub        = Utils.GetParameter("cidsub", string.Empty);
            id            = Utils.GetParameter("id", string.Empty);

            if (pageName == "tim-kiem" || pageName == "search")
            {
                this.records         = DBConvert.ParseString(totalSearch);
                this.pager.PageSize  = DBConvert.ParseInt(ConfigurationManager.AppSettings["pageSizeCate"]);
                this.pager.ItemCount = totalSearch;

                this.rptResult.DataSource = lstSearch;
                this.rptResult.DataBind();

                //Set header
                ProductCategoryBLL          pcBll = new ProductCategoryBLL();
                IList <PNK_ProductCategory> lst   = pcBll.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdTemplate"]), int.MinValue, false, string.Empty, 1, 1, out total);
                if (total > 0)
                {
                    ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name;
                    ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief;
                }
            }
            else
            {
                GetProduct();
            }
        }
示例#10
0
        private string GetProductCategory()
        {
            ProductCategoryBLL          pcBll = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lst   = null;

            //if (pageName == "home" || pageName == "trang-chu")
            //{
            lst = pcBll.GetListTree(LangInt, string.Empty, null, int.MinValue, ConfigurationManager.AppSettings["parentIdVideo"], string.Empty, 1, true, string.Empty, 1, 9999, out total);
            if (lst.Count > 0)
            {
                categoryID = lst[0].ProductCategoryDesc.Id.ToString();
                secCategory.Attributes.Add("style", string.Format("padding-top: 10px; padding-bottom: 20px; background: url('{0}') 50% -80.7422px/cover no-repeat;", WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductCategoryUpload"], lst[0].BaseImage)));

                //bgImage = WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductCategoryUpload"], lst[0].BaseImage);
            }
            //}
            //else
            //{
            //    string treeNameUrl = (Session["level"] != null && DBConvert.ParseInt(Session["level"]) == 1) ? pageName : UtilityLocal.RemoveLanguage(Request.RawUrl, LangId);
            //    lst = pcBll.GetListTree(LangInt, string.Empty, null, int.MinValue, string.Empty, treeNameUrl, 1, true, string.Empty, 1, 9999, out total);
            //    if (lst.Count > 0)
            //    {
            //        categoryID = lst[0].Id.ToString();

            //        //Set category header
            //        ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0], Request);

            //        ////Set SEO
            //        //WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page);
            //        //WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls);

            //    }
            //}
            return(categoryID);
        }
        public void GUIDTest()
        {
            ProductCategory item0 = new ProductCategory()
            {
                ID = "ewoftogoeo", Name = "镀锌钢板", Memo = "厂家:正泰"
            };
            ProductCategoryBLL bll = new ProductCategoryBLL(StaticConnectString.ConnectString);
            CommandResult      ret = bll.Insert(item0);

            Assert.IsTrue(ret.Result == ResultCode.Successful);

            List <ProductCategory> items = bll.GetAll().QueryObjects;

            Assert.IsTrue(items.Count > 0);
            Assert.IsTrue(items.SingleOrDefault(item => item.ID == item0.ID) != null);

            item0.Name += "123";
            item0.Memo += "123";
            ret         = bll.Update(item0);
            Assert.IsTrue(ret.Result == ResultCode.Successful);
            ProductCategory item1 = bll.GetByID(item0.ID).QueryObject;

            Assert.IsTrue(item0.Name == item1.Name);
            Assert.IsTrue(item0.Memo == item1.Memo);

            ret = bll.Delete(item0);
            Assert.IsTrue(ret.Result == ResultCode.Successful);
            item1 = bll.GetByID(item0.ID).QueryObject;
            Assert.IsTrue(item1 == null);
        }
示例#12
0
        /// <summary>
        /// GetList
        /// </summary>
        /// <param name="cateId">Mảng cái ID con</param>
        /// <param name="content">Đây là ID trong GetList Bill, Where theo TitlUrl bảng Product</param>
        /// <returns></returns>
        private int GetList(byte langid, string content, string cateId, int begin, int end)
        {
            ProductCategoryBLL          newsCateBll = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lstPicture  = newsCateBll.GetAllChild(DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdContact"]), true);

            int total;
            IList <PNK_Product> lst = pcBll.GetList(1, string.Empty, string.Empty, cateId, content, null, string.Empty, begin, end, out total);

            if (lst != null && lst.Count > 0)
            {
                //Loại bỏ những productCategory thuộc nhóm Gallery có Id=64
                IList <PNK_Product> lst1 = lst;
                for (int i = 0; i < lstPicture.Count; i++)
                {
                    lst1 = (from x in lst1
                            where !x.CategoryId.ToString().Contains(lstPicture[i].Id.ToString())
                            select x).ToList();
                }


                this.records              = DBConvert.ParseString(lst1.Count);
                this.pager.PageSize       = DBConvert.ParseInt(ConfigurationManager.AppSettings["PageSizeAdmin"]);
                this.pager.ItemCount      = total;
                this.rptResult.DataSource = lst1;
                this.rptResult.DataBind();
            }

            return(total);
        }
示例#13
0
        private void GetPageName(string pageName)
        {
            try
            {
                cid    = Utils.GetParameter("cid", string.Empty);
                cidsub = Utils.GetParameter("cidsub", string.Empty);
                id     = Utils.GetParameter("id", string.Empty);

                if (pageName == "booking")
                {
                    pagePath         = "Pages/BookingManagement/Booking.ascx";
                    Session["level"] = 1;
                }

                else
                {
                    string             cateName  = string.Empty;
                    ProductCategoryBLL pcBllCate = new ProductCategoryBLL();
                    cateName = Common.UtilityLocal.GetCateNameByLevel(pageName, cid, cidsub, id);
                    IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(LangInt, cateName, string.Empty, int.MinValue, false, "p.ordering", 1, 9999, out total);
                    if (total > 0)
                    {
                        pagePath         = lstCate[0].Page;
                        Session["level"] = lstCate[0].PathTree.Count(i => i.Equals('.'));
                    }

                    if (lstCate == null || total == 0)
                    {
                        ProductBLL pcBll = new ProductBLL();
                        cid    = cid != LocalizationUtility.GetText("linkCate", Ci) ? cid : string.Empty;
                        cidsub = cidsub != LocalizationUtility.GetText("linktmp", Ci) ? cidsub : string.Empty;
                        IList <PNK_Product> lst = pcBll.GetList(LangInt, cidsub, string.Empty, string.Empty, id, null, string.Empty, 1, 9999, out total);
                        if (total > 0)
                        {
                            //set page đặc biệt khi level=4 mà thiếu cid, cidsub
                            if (cid == LocalizationUtility.GetText("linkCate", Ci) || cid == LocalizationUtility.GetText("linktmp", Ci))
                            {
                                lst = lst.Where(p => p.ProductDesc.TitleUrl == id && p.CategoryUrlDesc == pageName).ToList();
                            }
                            else
                            {
                                lst = lst.Where(p => p.ProductDesc.TitleUrl == id).ToList();
                            }
                            if (lst.Count > 0)
                            {
                                string pagePathProduct = Common.UtilityLocal.GetPathTreeNameUrl(lst[0].Id, LangInt, LangId);
                                pagePath         = lst[0].Page;
                                Session["level"] = 3;
                            }
                        }
                    }
                }
                contentView = (UserControl)Page.LoadControl(pagePath);
                phdContent.Controls.Add(contentView);
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("default.aspx", "GetPageName", ex.Message + "/" + cid + "/" + cidsub + "/" + id);
            }
        }
示例#14
0
        private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0 && e.ColumnIndex == 2) // update record
            {
                //TODO - Button Clicked - Execute Code Here
                Int64           cID      = Int64.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString());
                string          cName    = dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString();
                pCategoryUpdate pcUpdate = new pCategoryUpdate(cID, cName, 1);
                pcUpdate.Show();
            }
            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0 && e.ColumnIndex == 3) // delete record
            {
                Int64        cID          = Int64.Parse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString());
                DialogResult dialogResult = MessageBox.Show("Are you sure want to Delete record?", "Delete", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    pcBLL = new ProductCategoryBLL();


                    PCategoryDTO DTO = new PCategoryDTO("", 0);
                    DTO.CATID = cID;
                    pcBLL.deleteCatRecord(DTO);

                    searchAll();
                }
                else if (dialogResult == DialogResult.No)
                {
                }
            }
        }
示例#15
0
        /// <summary>
        /// Dịch vụ
        /// </summary>
        private void GetService()
        {
            ProductBLL pcBll = new ProductBLL();
            DataTable  dtb   = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdService"]) + ",1)", null);

            string[] array = dtb.AsEnumerable()
                             .Select(row => row.Field <Int32>("id").ToString())
                             .ToArray();
            string idFirst          = string.Join(",", array);
            IList <PNK_Product> lst = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, string.Empty, "1", 1, 6, out total);

            if (total > 0)
            {
                this.rptServiceLeft.DataSource = lst;
                this.rptServiceLeft.DataBind();
            }

            total = 0;
            ProductCategoryBLL          pcBllCate = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lstCate   = pcBllCate.GetList(LangInt, string.Empty, null, DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdService"]), int.MinValue, false, string.Empty, 1, 1, out total);

            if (lst.Count > 0)
            {
                ltrServiceHeader.Text = lstCate[0].ProductCategoryDesc.Name;
            }
        }
示例#16
0
        public int BackgroundRefreshTime = int.Parse(LinkFun.ConfigString("BackgroundRefreshTime", "7200000")); //背景刷新时间


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ProductIndexRefreshTime = LinkFun.ConfigString("ProductIndexRefreshTime", "7200000"); //LinkFun.getProductIndexRefreshTime();
                ProductsBLL        adHelper            = new ProductsBLL();
                ProductCategoryBLL oProductCategoryBLL = new ProductCategoryBLL();
                oCategoryList = oProductCategoryBLL.GetCardTypeList();
                LoginUserCookie cookie = MerchantFrontCookieBLL.GetMerchantFrontUserCookie();
                magName = cookie.LoginName;
                CompanyBLL opCompanyBLL = new CompanyBLL();

                StringBuilder where = new StringBuilder();
                //where.AppendFormat("IsDeleted=0 and CompanyCategoryId=2 order by OrderId asc");
                //litCompanyNetLoan = opCompanyBLL.GetModelList(where.ToString());

                where = new StringBuilder();
                where.AppendFormat("IsDeleted=0 and CompanyCategoryId=4 order by OrderId asc");
                litCompanyBank = opCompanyBLL.GetModelList(where.ToString());

                where = new StringBuilder();
                where.AppendFormat("IsDeleted=0 and CompanyCategoryId=5 order by OrderId asc");
                litCompanyOther = opCompanyBLL.GetModelList(where.ToString());
            }
        }
示例#17
0
        private void GenerateMenuProduct()
        {
            IList <PNK_ProductCategory> lstParent;
            int total;
            ProductCategoryBLL ncBll = new ProductCategoryBLL();

            lstAll = ncBll.GetList(Constant.DB.LangId, string.Empty, 1, 300, out total);

            if (total > 0)
            {
                //Lấy danh sách danh mục cha có ParentID==0 gán vào menu cha
                lstParent = lstAll.Where(m => m.ParentId == 0 &&
                                         m.Id != 2229 &&
                                         m.Id != 2222 &&
                                         m.Id != 2220 &&
                                         m.Id != 2207 &&
                                         m.Id != 124 &&
                                         m.Id != 73 &&
                                         m.Id != 64 &&
                                         m.Id != 64 &&
                                         m.Id != 42

                                         && m.Id != DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdHome"])
                                         ).ToList();
                if (lstParent.Count() > 0)
                {
                    rptResult.DataSource = lstParent;
                    rptResult.DataBind();
                }
            }
        }
示例#18
0
        private void GetConstruction()
        {
            try
            {
                ProductBLL pcBll = new ProductBLL();
                DataTable  dtb   = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + ConfigurationManager.AppSettings["parentIdTemplate"] + ",1)", null);
                if (dtb != null && dtb.Rows.Count > 0)
                {
                    string[] array = dtb.AsEnumerable()
                                     .Select(row => row.Field <Int32>("id").ToString())
                                     .ToArray();
                    string idFirst          = string.Join(",", array);
                    IList <PNK_Product> lst = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, string.Empty, string.Empty, 1, 2, out total);
                    if (lst.Count > 0)
                    {
                        this.rptConstruction.DataSource = lst;
                        this.rptConstruction.DataBind();
                    }
                }

                ProductCategoryBLL          pcBllCate = new ProductCategoryBLL();
                IList <PNK_ProductCategory> lstCate   = pcBllCate.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdTemplate"]), int.MinValue, false, string.Empty, 1, 1, out total);
                if (lstCate.Count > 0)
                {
                    ltrConstructionCateName.Text = lstCate[0].ProductCategoryDesc.Name;
                }
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("home", "GetProject", ex.Message);
            }
        }
示例#19
0
        private string GetAllChildCategory()
        {
            int categoryDrpId = DBConvert.ParseInt(drpCategory.SelectedValue);
            //categoryDrpId = categoryId != string.Empty ? DBConvert.ParseInt(categoryId) : DBConvert.ParseInt(drpCategory.SelectedValue);
            string arrId = "";

            if (categoryDrpId != int.MinValue)
            {
                ProductCategoryBLL          newsCateBll = new ProductCategoryBLL();
                IList <PNK_ProductCategory> lst         = newsCateBll.GetAllChild(categoryDrpId, true);

                if (lst == null && lst.Count == 0)
                {
                    return(null);
                }

                //Loại bỏ những productCategory thuộc nhóm Gallery có Id=64
                lst = lst.Where(x => x.ParentId != DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdContact"]) &&
                                x.ProductCategoryDesc.Id != DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdContact"])).ToList();

                arrId = arrId + Utils.ArrayToString <PNK_ProductCategory>((List <PNK_ProductCategory>)lst, "Id", ",");
            }
            else
            {
                arrId = string.Empty;
            }
            return(arrId);// !string.IsNullOrEmpty(arrId) ? arrId : "-1011";
        }
        public ActionResult ProductDetail(int ID)
        {
            var product = ProductBLL.GetProductDetail(ID);

            ViewBag.Category        = ProductCategoryBLL.GetProductDetail(product.CategoryID.Value);
            ViewBag.RelatedProducts = ProductBLL.GetAllRelatedProduct(ID);
            return(View(product));
        }
 public frmSubProductCategory()
 {
     productSubCategoryBLL = new ProductSubCategoryBLL(dbHelper);
     productCategoryBLL    = new ProductCategoryBLL(dbHelper);
     InitializeComponent();
     dataGridView1.CellContentClick += dataGridView1_CellContentClick;
     FillGrid();
     GetAllProductCategory();
 }
示例#22
0
        private void GetProductCategory()
        {
            ProductCategoryBLL          pcBll = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lst   = pcBll.GetList(LangInt, string.Empty, string.Empty, DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdLastBlog"]), false, "p.ordering", 1, 1000, out total);

            if (total > 0)
            {
                rptCategory.DataSource = lst;
                rptCategory.DataBind();
            }
        }
示例#23
0
        private void GetProductCategory()
        {
            ProductCategoryBLL          pcBll       = new ProductCategoryBLL();
            string                      treeNameUrl = UtilityLocal.RemoveLanguage(Request.RawUrl, LangId);
            IList <PNK_ProductCategory> lstAll      = pcBll.GetListTree(LangInt, string.Empty, null, int.MinValue, string.Empty, treeNameUrl, 1, true, string.Empty, 1, 9999, out total);

            if (lstAll.Count > 0)
            {
                ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lstAll[0], Request);
            }
        }
示例#24
0
        /// <summary>
        /// Get Image theo sản phẩm
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static string ImagePathByFont(PNK_Product data)
        {
            string result = string.Empty, id = string.Empty, pathTreeSub = string.Empty, LangId = data.ProductDesc.LangId == 1 ? "vn" : "eng";
            //pathTreeSub = GetPathTreeNameUrl(data.ProductDesc.Id, data.ProductDesc.LangId, LangId);

            ProductCategoryBLL          pcBll = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lst = pcBll.GetList(data.ProductDesc.LangId, string.Empty, string.Empty, data.CategoryId, int.MinValue, false, string.Empty, 1, 9999, out total);

            if (total > 0)
            {
                string        pathTree   = lst[0].PathTree;
                int           level      = pathTree.Count(i => i.Equals('.'));
                StringBuilder sbBreadrum = new StringBuilder();
                for (int i = 1; i <= level; i++)
                {
                    pathTreeSub = pathTree.Split('.')[i];
                    id          = pathTreeSub.Split('-')[1];
                    lst         = pcBll.GetList(data.ProductDesc.LangId, string.Empty, string.Empty, int.Parse(id), int.MinValue, false, string.Empty, 1, 9999, out total);

                    result = result + (total > 0 ? lst[0].ProductCategoryDesc.NameUrl : string.Empty) + "/";

                    sbBreadrum.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", LinkHelper.GetLink(lst[0].ProductCategoryDesc.NameUrl, LangId), lst[0].ProductCategoryDesc.Name);
                }
                result = sbBreadrum.ToString();
            }

            string imagePath = data.Image == "" ? "breadcrumb-bg.jpg" : data.Image;
            int    imageType = data.ImageType;

            switch (imageType)
            {
            case 1:
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<section id=\"title-wrapper\" style=\"background-image: url({0});\">", WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], "breadcrumb-bg.jpg"));
                sb.Append("<div class=\"container\">");
                sb.Append("<div class=\"row\">");
                sb.Append(" <div class=\"col-md-12\">");
                sb.Append("<div class=\"title-holder\">");
                sb.Append(" <div class=\"title-holder-cell text-left\">");
                sb.Append("<h2 class=\"page-title col-sm-8\"><span class='text-uppercase'>" + data.ProductDesc.Title + "</span></h2>");
                sb.AppendFormat("<ol class=\"breadcrumb pull-right\"><li><a href=\"{0}\">Home</a></li>", WebUtils.RedirectHomePage());
                sb.Append(result);
                sb.Append("</ol>");
                sb.Append("</div></div></div></div></div></section>");
                result = sb.ToString();
                break;

            case 2:
                result = data.ImageFont;
                break;
            }

            return(result);
        }
示例#25
0
        private void InitPage()
        {
            try
            {
                this.template_path = WebUtils.GetWebPath();
                pageName           = Utils.GetParameter("page", "home");
                cid    = Utils.GetParameter("cid", string.Empty);
                cidsub = Utils.GetParameter("cidsub", string.Empty);
                id     = Utils.GetParameter("id", string.Empty);

                //string pathUsc = pageName;
                //switch (pageName)
                //{
                //    case "home":
                //    case "trang-chu":
                //        pathUsc = "Pages/home.ascx";
                //        break;
                //    default:
                //        pathUsc = "Controls/block_breakumb.ascx";
                //        break;

                //}
                //UserControl contentView = (UserControl)Page.LoadControl(pathUsc);
                //childContent.Controls.Add(contentView);

                ProductCategoryBLL          pcBllCate = new ProductCategoryBLL();
                IList <PNK_ProductCategory> lstCate   = pcBllCate.GetList(1, pageName, string.Empty, int.MinValue, false, "p.ordering", 1, 9999, out total);
                if (total > 0)
                {
                    string pagePath = lstCate[0].PageDetail.ToLower();
                    if (pagePath.Contains("template") && id != string.Empty && cidsub != "page")
                    {
                        top_menu.Visible = footer.Visible = main.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
            }

            ConfigurationBLL          pcBll = new ConfigurationBLL();
            IList <PNK_Configuration> lst   = pcBll.GetList();

            if (lst != null && lst.Count > 0)
            {
                foreach (PNK_Configuration item in lst)
                {
                    if (item.Key_name == Constant.Configuration.config_vchat)
                    {
                        // WebUtils.IncludeJSScript(this.Page, item.Value_name);
                    }
                }
            }
        }
示例#26
0
 public frmProduct()
 {
     productBLL            = new ProductBLL(dbHelper);
     sizeBLL               = new SizeBLL(dbHelper);
     productSubCategoryBLL = new ProductSubCategoryBLL(dbHelper);
     productCategoryBLL    = new ProductCategoryBLL(dbHelper);
     InitializeComponent();
     dataGridView1.CellContentClick += dataGridView1_CellContentClick;
     FillGrid();
     FillCombo();
 }
示例#27
0
        private void GetSubMenu(string categoryId, Repeater rptSub)
        {
            ProductCategoryBLL          pcBll = new ProductCategoryBLL();
            IList <PNK_ProductCategory> lst   = pcBll.GetList(LangInt, string.Empty, "1", int.Parse(categoryId), false, "p.ordering", 1, 9999, out total);

            lst = lst.Where(m => m.ThumbnailImage == "1").ToList();
            if (lst.Count > 0)
            {
                rptSub.DataSource = lst;
                rptSub.DataBind();
            }
        }
示例#28
0
 /// <summary>
 /// Init page
 /// </summary>
 private void InitPage()
 {
     pcBll              = new ProductCategoryBLL();
     genericBLL         = new Generic <PNK_ProductCategory>();
     generic2CBLL       = new Generic2C <PNK_ProductCategory, PNK_ProductCategoryDesc>();
     this.template_path = WebUtils.GetWebPath();
     LocalizationUtility.SetValueControl(this);
     msg_confirm_delete_item = LocalizationUtility.GetText("mesConfirmDelete");
     msg_no_selected_item    = LocalizationUtility.GetText("mesSelectItem");
     GetMessage();
     SetRoleMenu();
 }
示例#29
0
        void insert_PCategory_comboBox_Pop()    // categories comboBox population method
        {
            pCategoryBLL = new ProductCategoryBLL();
            List <string> result = new List <string>();

            result = pCategoryBLL.productInsertComboPopu();

            for (int i = 0; i < result.Count; i++)
            {
                cmbCategory.Items.Add(result[i]);
            }
        }
示例#30
0
        void CategoryCMBpopulation()
        {
            pCategoryBLL = new ProductCategoryBLL();
            List <string> result = new List <string>();

            result = pCategoryBLL.productInsertComboPopu();

            for (int i = 0; i < result.Count; i++)
            {
                cmbCategory.Items.Add(result[i]);
            }
        }