Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CategoryBLL cb = new CategoryBLL();

            rptCategories.DataSource = cb.Get(x => x.IsActive == true).ToList();
            rptCategories.DataBind();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["catId"]);
            CategoryBLL cb = new CategoryBLL();
            if (Request.QueryString["catId"] == null)
            {
                Category c = new Category();
                c.Name = txtName.Text;
                c.IsActive = true;
                c.Date = DateTime.Now;

                cb.Add(c);
            }

            else
            {
                Category c = cb.Get(x => x.Id == id).FirstOrDefault();
                c.Name = txtName.Text;
                c.IsActive = true;
                c.Date = DateTime.Now;
                cb.Update(c);
            }

            Response.Redirect("Categories.aspx");
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     CategoryBLL cb=new CategoryBLL();
     if (IsPostBack) return;
     ddlCategories.DataValueField = "Id";
     ddlCategories.DataTextField = "Name";
     ddlCategories.DataSource = cb.Get(x => x.IsActive == true).ToList();
     ddlCategories.DataBind();
 }
        protected void rptCategories_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int categoryId = Convert.ToInt32(e.CommandArgument);

            CategoryBLL cb = new CategoryBLL();

            Category c = cb.Get(x => x.Id == categoryId).FirstOrDefault();

            c.IsActive = false;
            cb.Update(c);
            Fill();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (Request.QueryString["catId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["catId"]);
                CategoryBLL cb = new CategoryBLL();
                Category c = cb.Get(x => x.Id == id).FirstOrDefault();

                txtName.Text = c.Name;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Helper.Sayfalar = new List<string> { "Kategoriler", "Kategori Ekle" };

            if (IsPostBack) return;

            int id = Convert.ToInt32(Request.QueryString["catId"]);
            CategoryBLL cb = new CategoryBLL();
            if (Request.QueryString["catId"] != null)
            {

                Category c = cb.Get(x => x.Id == id).FirstOrDefault();
                txtCategoryName.Text = c.Name;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            CategoryBLL cb = new CategoryBLL();
            ddlCategories.DataTextField = "Name";
            ddlCategories.DataValueField = "Id";
            ddlCategories.DataSource = cb.Get(x => x.IsActive == true).ToList();
            ddlCategories.DataBind();

            if (Request.QueryString["productId"]!=null)
            {
                int id = Convert.ToInt32(Request.QueryString["productId"]);
                ProductBLL pb = new ProductBLL();
                Product p = pb.Get(x => x.Id == id).FirstOrDefault();

                txtName.Text = p.Name;
                txtPrice.Text = p.Price.ToString();
                txtStock.Text = p.Stock.ToString();
                txtDetail.Text = p.Detail;
            }
        }
Esempio n. 8
0
        private List <ForumItem> GetForumData()
        {
            string key  = "mn_forum_cache";
            var    data = new List <ForumItem>();

            if (!SiteConfig.Cache.TryGetValue(key, out data))
            {
                var _list = CategoryBLL.LoadItems(_context, new CategoryEntity()
                {
                    type     = (int)CategoryBLL.Types.Forum,
                    ispublic = true,
                    iscache  = false,
                    order    = "title asc",
                    pagesize = 50
                }).Result;
                var _Data = new List <ForumItem>();
                if (_list.Count > 0)
                {
                    foreach (var Item in _list)
                    {
                        var _data = new ForumItem()
                        {
                            Type      = 12,
                            Title     = Item.title,
                            Term      = Item.term,
                            ForumList = ForumBLLC.LoadItems(_context, new ForumEntity()
                            {
                                order        = "priority desc",
                                categoryname = Item.term,
                                //categories_str = Item.term,
                                iscache = false
                            }).Result
                        };
                        // attach last post id
                        foreach (var Itm in _data.ForumList)
                        {
                            Itm.lastpost = new List <JGN_ForumTopics>();
                            if (Itm.lastpostid != null && Itm.lastpostid > 0)
                            {
                                Itm.lastpost = ForumTopicBLL.Load_Last_Post(_context, (long)Itm.lastpostid);
                            }
                        }
                        _Data.Add(_data);
                    }
                }

                var cacheEntryOptions = new MemoryCacheEntryOptions()
                                        // Keep in cache for this time, reset time if accessed.
                                        .SetSlidingExpiration(TimeSpan.FromSeconds(3600));

                data = _Data;
                // Save data in cache.
                SiteConfig.Cache.Set(key, _Data, cacheEntryOptions);
            }
            else
            {
                data = (List <ForumItem>)SiteConfig.Cache.Get(key);
            }

            return(data);
        }
 public CategoryListForm()
 {
     InitializeComponent();
     _categoryBLL = new CategoryBLL();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                string userId = Session["UserId"].ToString();
            }
            else
            {
                //If the session value for userid is not set, redirect the user to the loginpage
                //see the ReturnUrl querystring value, it will be the page, that the ASP.NEt
                //infrastructure will redirect to after successful validation of the user

                //See the <Authentication node in web.config
                FormsAuthentication.RedirectToLoginPage();
            }
            CategoryBLL categoryBLL = new CategoryBLL();
            BrandBLL    brandBLL    = new BrandBLL();

            spec = Request.QueryString["spec"];
            id   = Convert.ToInt32(Request.QueryString["id"]);
            switch (spec)
            {
            case "prod":
                disableCategory();
                disableBrand();
                bindProducts(id);
                break;

            case "brand":
                disableProduct();
                disableCategory();
                bindBrands(id);
                break;

            case "cat":
                disableProduct();
                disableBrand();
                bindCategories(id);
                break;
                // default:
            }
            ;
            if (!IsPostBack)
            {
                Collection <CategoryCL> categoriesInProduct = categoryBLL.viewCategory();
                //Initialises the Categories from the DataBase.
                lstPCategoryName.DataSource     = from x in categoriesInProduct select x;
                lstPCategoryName.DataTextField  = "name";
                lstPCategoryName.DataValueField = "id";
                //Adds the Names of Categories in the DropDown List.
                lstPCategoryName.DataBind();
                //Binds the data in the DropDown List.
                Collection <BrandCL> brandsInProduct = brandBLL.viewBrand();
                //Initialises the Brands from the DataBase.
                lstPBrandName.DataSource     = from x in brandsInProduct select x;
                lstPBrandName.DataTextField  = "name";
                lstPBrandName.DataValueField = "id";
                //Adds the Names of Brands in the DropDown List.
                lstPBrandName.DataBind();
                //Binds the data in the DropDown List.
                lstCParentCategory.DataSource     = from x in categoriesInProduct select x;
                lstCParentCategory.DataTextField  = "name";
                lstCParentCategory.DataValueField = "id";
                //Adds the Names of Categories in the DropDown List.
                lstCParentCategory.DataBind();
            }
        }
Esempio n. 11
0
 public int BLLUpdateCategory(CategoryBLL ct)
 {
     return(status = categoryDALObj.DALUpdateCategory(ct));
 }
Esempio n. 12
0
 public async Task <IActionResult> Delete([FromServices] CategoryBLL service, int id = 0)
 {
     return(Json(await service.Delete(id)));
 }
Esempio n. 13
0
 public CategoryController(IRepository <Category> repository)
 {
     this.categoryBLL = new CategoryBLL(repository);
 }
Esempio n. 14
0
 private void load_dlSelectCategory()
 {
     category = new CategoryBLL();
     this.load_DropdownList(dlSelectCategory, category.ListAllCategory(), "NameVN", "ID");
     dlSelectCategory.Items.Insert(0, new ListItem("-- Selected Category --", "0"));
 }
 public CategoryController()
 {
     this._bll = new CategoryBLL();
 }
Esempio n. 16
0
        /// <summary>
        /// 文档发布时候发生
        /// </summary>
        /// <param name="archive"></param>
        static void WatchService_OnArchivePublished(Archive archive)
        {
            return;
            if (archive == null) return;

            //更新标签链接
            ArchiveUtility.UpdateArchiveTagLinks("/tags/{0}",archive,true);
            Category category = new CategoryBLL().Get(a => a.ID == archive.Cid);
            PageGenerator.Generate(PageGeneratorObject.ArchivePage,category,archive);
        
        }
Esempio n. 17
0
        string categoryIDSearch;             //存放查询的ID值

        public Frm_Category()
        {
            InitializeComponent();
            categoryBll = new CategoryBLL();  //将对象实例化
            BindDateGridView();               //调用封装的方法
        }
Esempio n. 18
0
 public CategoryController(CategoryBLL db)
 {
     _dB = db;
 }
Esempio n. 19
0
 public ProductController()
 {
     probll  = new ProductBLL();
     catebll = new CategoryBLL();
 }
Esempio n. 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Helper.Sepet != null)
            {
                ltrQuantiy.Text = Helper.Sepet.Count.ToString();
                decimal total = 0;
                foreach (var p in Helper.Sepet)
                {
                    total += p.Price * p.Quantity;
                }
                ltrTotal.Text = String.Format("{0:0.00}", total);
            }
            else
            {
                ltrQuantiy.Text = "0";
                ltrTotal.Text = "0";
            }

            if (IsPostBack) return;

            CategoryBLL cb = new CategoryBLL();

            rptCategories.DataSource = cb.Get(x => x.IsActive == true).ToList();
            rptCategories.DataBind();
        }
Esempio n. 21
0
 public CategoryService()
 {
     categoryBLL = new CategoryBLL();
 }
Esempio n. 22
0
 public CategoryController(CategoryBLL categoryBll)
 {
     _categoryBll = categoryBll;
 }
Esempio n. 23
0
        //end thêm thiết bị

        //cập nhật và xóa thiết bị

        private void btnSua_Click(object sender, EventArgs e)
        {
            Product tb  = new Product();
            int     idx = dgvDSTB.CurrentRow.Index;

            if (txtTenTB.Text != "")
            {
                if (txtSLTon.Text != "")
                {
                    tb.Id       = dgvDSTB.Rows[idx].Cells[0].Value.ToString();
                    tb.Id_cate  = CategoryBLL.LayMaLoaiTuTenLoai(cmbLoaiTB.Text);
                    tb.Name_pro = txtTenTB.Text;
                    tb.Qty      = int.Parse(txtSLTon.Text);

                    bool kt;
                    kt = ProductBLL.KiemTraTenTBCapNhat(txtTenTB.Text, tb.Id);
                    if (kt == true)
                    {
                        try
                        {
                            int gia = int.Parse(txtDonGia.Text);
                            if (gia > 0)
                            {
                                tb.Price = gia;
                                bool kq1 = ProductBLL.CapNhatThietBi(tb);
                                if (kq1 == true)
                                {
                                    MessageBox.Show("Cập nhật thiết bị thành công!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    txtTenTB.Text  = "";
                                    txtSLTon.Text  = "";
                                    txtDonGia.Text = "";
                                    cmbTraCuuLoaiTB_SelectedValueChanged(sender, e);
                                }
                                else
                                {
                                    MessageBox.Show("Cập nhật thiết bị thất bại!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                MessageBox.Show("Đơn giá phải lớn hơn 0!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                txtDonGia.Text = "";
                                txtDonGia.Focus();
                            }
                        }
                        catch
                        {
                            MessageBox.Show("Chưa nhập đơn giá hoặc kiểu dữ liệu đơn giá không đúng!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            txtDonGia.Text = "";
                            txtDonGia.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Tên thiết bị bị trùng!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtTenTB.Text = "";
                        txtTenTB.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Chưa nhập số lượng tồn!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtSLTon.Text = "";
                    txtSLTon.Focus();
                }
            }
            else
            {
                MessageBox.Show("Chưa nhập tên thiết bị!", "Thông báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTenTB.Text = "";
                txtTenTB.Focus();
            }
        }
Esempio n. 24
0
 //单个删除
 public void DeleteCate(int id)
 {
     CategoryBLL.DeleteCate(id);
 }
 public CategoryController()
 {
     _categoryBLL = new CategoryBLL();
 }
Esempio n. 26
0
 private int currentIndex;     //定义一个字段,用于存放该视图当前选中行的下标
 public Frm_Category()
 {
     InitializeComponent();
     cBLL = new CategoryBLL();
 }
Esempio n. 27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Navbar.SetLinks(CategoryBLL.GetCategoryByRole(0));
 }
 public ProductAdController()
 {
     catebll = new CategoryBLL();
     probll  = new ProductBLL();
 }
Esempio n. 29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UserInfo.IsFeedback)
     {
         sn = "<input type=\"radio\" name=\"isAnonymity\" value=\"0\" checked=\"checked\" />实名";
     }
     else
     {
         sn = "<input type=\"radio\" name=\"isAnonymity\" value=\"1\" />匿名<input type=\"radio\" name=\"isAnonymity\" value=\"0\" checked=\"checked\" />实名";
     }
     if (UserInfo != null)
     {
         userName = UserInfo.LoginName;
         if (UserInfo.IsADUser)
         {
             intIsADUser = 1;
         }
         loginname = UserInfo.LoginName;
     }
     if (!IsPostBack)
     {
         listAllPost = pBll.GetPostsList();
         if (!string.IsNullOrEmpty(Request.QueryString["fatherID"]))
         {
             fatherID = Convert.ToInt32(Request.QueryString["fatherID"].ToString());
         }
         if (!string.IsNullOrEmpty(Request.QueryString["pageIndex"]))
         {
             pageIndex = int.Parse(Request.QueryString["pageIndex"]);
         }
         if (!string.IsNullOrEmpty(Request.QueryString["content"]))
         {
             content = Request.QueryString["content"].ToString().Trim().Replace("&nbsp;", "");
         }
         //增加浏览次数
         PostsBLL postBll = new PostsBLL();
         postModel            = postBll.GetPostsEntity(fatherID);
         postModel.LookCount += 1;
         postBll.UpdatePosts(postModel);
         cID = Convert.ToInt32(postModel.CID);
         //导航
         CategoryBLL     catBll  = new CategoryBLL();
         List <Category> listCat = catBll.GetCategoryList().Where(c => c.ID == cID).ToList();
         if (listCat.Count > 0)
         {
             Category catModel = listCat[0];
             catName = catModel.Name;
             catId   = catModel.ID.ToString();
         }
         title = "意见与反馈 - " + catName;
         //绑定回复数据
         if (content == "请输入搜索内容")
         {
             content = "";
         }
         repTo.Content  = content;
         repTo.FatherID = fatherID;
         string orderBy = " isReFeedback desc,ReDatetime asc";
         dtReposts = repBll.GetRePostsList(repTo, pageIndex, pageSize, orderBy, out rowCount);
         //分页
         string url = "detail.aspx?pageIndex={0}&fatherID=" + fatherID;
         strtt = DividePage.Pager(pageSize, rowCount, pageIndex, url);
         //获取当前页
         if (rowCount % pageSize == 0)
         {
             pageNum = rowCount / pageSize;
         }
         else
         {
             pageNum = (rowCount / pageSize) + 1;
         }
     }
 }
Esempio n. 30
0
 // GET: api/Categories
 public IHttpActionResult GetCategories()
 {
     return(Ok(CategoryBLL.GetCategories()));
 }
Esempio n. 31
0
 public int BLLInsertCategory(CategoryBLL ct)
 {
     return(status = categoryDALObj.DALInsertCategory(ct));
 }
Esempio n. 32
0
        /// <summary>
        /// 已上傳商品
        /// </summary>
        /// <returns></returns>
        public ActionResult ProductInfoList(string startTime, string endTime, string spu, string sku, string productName, int supplierId = 0, int productStatus = -1, int salesTerritory = -1,
                                            int inventoryStatus = -1, int isOnSales = -1, int fstCagegoryId = 0, int sndCagegoryId = 0, int trdCagegoryId = 0)
        {
            var queryInfo = new ProductAuditingQuyModel();

            if (string.IsNullOrEmpty(startTime) || string.IsNullOrEmpty(endTime))
            {
                queryInfo.CreateTimeStart = DateTime.Now.AddMonths(-3);
                queryInfo.CreateTimeEnd   = DateTime.Now;
            }
            else
            {
                queryInfo.CreateTimeStart = DateTime.Parse(startTime);
                queryInfo.CreateTimeEnd   = DateTime.Parse(endTime);
            }
            queryInfo.Spu             = spu;
            queryInfo.Sku             = sku;
            queryInfo.ProductName     = productName;
            queryInfo.ProductStatus   = productStatus;
            queryInfo.InventoryStatus = inventoryStatus;
            queryInfo.SupplierId      = supplierId;
            queryInfo.IsOnSales       = isOnSales;
            queryInfo.SalesTerritory  = salesTerritory;
            queryInfo.FstCagegoryId   = fstCagegoryId;
            queryInfo.SndCagegoryId   = sndCagegoryId;
            queryInfo.TrdCagegoryId   = trdCagegoryId;

            ViewBag.QueryInfo = queryInfo;

            PageOf <ProductAuditingListModel> dataList = null;

            try
            {
                var page = new PagingModel()
                {
                    PageIndex = PageNo, PageSize = 50
                };

                ViewBag.FirCategoryId = CategoryBLL.GetChildrenCategories(LanguageEnum.TraditionalChinese, 0, 0);
                List <CategoryModel> second = new List <CategoryModel>();
                if (fstCagegoryId > 0)
                {
                    second = CategoryBLL.GetChildrenCategories(LanguageEnum.TraditionalChinese, 1, fstCagegoryId);
                }
                ViewBag.SndCategoryId = second;

                List <CategoryModel> thrid = new List <CategoryModel>();
                if (sndCagegoryId > 0)
                {
                    thrid = CategoryBLL.GetChildrenCategories(LanguageEnum.TraditionalChinese, 2, sndCagegoryId);
                }
                ViewBag.TrdCategoryId = thrid;

                dataList = productBll.GetProductList(queryInfo, LanguageEnum.TraditionalChinese, page);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
            return(View(dataList));
        }
Esempio n. 33
0
    public DataTable BLLGetSelectedCategory(CategoryBLL ct)
    {
        DataTable dtCategoryGetSelected = categoryDALObj.DALGetSelectedCategory(ct);

        return(dtCategoryGetSelected);
    }
Esempio n. 34
0
 public CategoryController()
 {
     this.categoryBLL = new CategoryBLL();
 }
Esempio n. 35
0
    public string GetCategoryName(object obj)
    {
        CategoryBLL cbll = new CategoryBLL();

        return(cbll.GetModel(int.Parse(obj.ToString())).title);
    }
Esempio n. 36
0
 private int SumCount()
 {
     return(Convert.ToInt32(CategoryBLL.SumCount()));
 }
Esempio n. 37
0
 public CategoryController(CategoryBLL stub)
 {
     _categoryBLL = stub;
 }
Esempio n. 38
0
 private void Fill()
 {
     CategoryBLL cb = new CategoryBLL();
     rptCategories.DataSource = cb.Get(x => x.IsActive == true).ToList();
     rptCategories.DataBind();
 }
        private void showList()
        {
            Page <ShamirasRestaurant.Domain.CustomModels.CustomCategory> categories = CategoryBLL.Search(pageSize, pageIndex, sortOrder, keyword, this.parentId);

            lblPages.Content   = "page " + pageIndex + " of " + categories.PageCount;
            lblResults.Content = "Search Result : " + categories.QueryCount + " Categories";
            queryCount         = categories.QueryCount;
            pageCount          = categories.PageCount;
            grList.ItemsSource = categories.Items;
            txtPageSize.Text   = categories.PageSize.ToString();
        }
        public void SetViewBag(int?selectedID = null)
        {
            var category = CategoryBLL.GetAllCategory();

            ViewBag.Category = new SelectList(category, "ID", "Name", selectedID);
        }