Example #1
0
        public ActionResult ItemUpdate(int id)
        {
            ModelState.Clear();
            CategoryBL         category   = new CategoryBL();
            MeasureBL          measure    = new MeasureBL();
            ItemBL             bl         = new ItemBL();
            List <CategoryDTO> categorydt = new List <CategoryDTO>();
            List <MeasureDTO>  measuredt  = new List <MeasureDTO>();
            ItemsDTO           dto        = new ItemsDTO();

            bl.SearchID(id, out dto);
            category.SearchList(out categorydt);
            measure.SearchList(out measuredt);
            ViewBag.CategoryList         = categorydt;
            ViewBag.MeasureList          = measuredt;
            ViewData["tool"]             = dto.manufacture_tool.ToString().ToLower();
            ViewData["make"]             = dto.manufacture_make.ToString().ToLower();
            ViewData["dangerous"]        = dto.dangerous.ToString().ToLower();
            ViewData["good"]             = dto.manufacture_finished_goods.ToString().ToLower();
            ViewData["category"]         = dto.category_id;
            ViewData["inventorymeasure"] = dto.inventory_measure_id;
            ViewData["sizemeasure"]      = dto.manufacture_size_measure_id;
            ViewData["weightmeasure"]    = dto.manufacture_weight_measure_id;
            return(View(dto));
        }
Example #2
0
        private void loadCategory(int categoryID)
        {
            CategoryBL categoryBL = new CategoryBL();
            Category   category   = categoryBL.GetCategory(categoryID);

            txtName.Text               = category.Name;
            txtUrl.Text                = category.Url;
            txtImageUrl.Text           = category.ImageUrl;
            cmbParent.SelectedValue    = cmbParent.Items.FindByValue(category.ParentCategoryID.ToString()).Value;
            txtSortOrder.Text          = category.SortOrder.ToString();
            lblCategoryID.Value        = category.CategoryID.ToString();
            txtPricePercent.Text       = category.PricePercent.ToString();
            txtWebPricePercent.Text    = category.WebPricePercent.ToString();
            chkShowOnFirstPage.Checked = category.ShowOnFirstPage;
            txtNumber.Text             = category.NumberOfProducts.ToString();
            txtSortOrderFirstPage.Text = category.firstPageSortOrder.ToString();
            if (category.firstPageOrderBy != string.Empty && category.firstPageOrderBy != null)
            {
                cmbCriterion.SelectedValue = cmbCriterion.Items.FindByText(category.firstPageOrderBy).Value;
            }
            setFirstPageControls(category.ShowOnFirstPage);
            Page.Title = category.Name + " | Admin panel";
            ViewState.Add("pageTitle", Page.Title);
            txtDescription.Text             = category.Description;
            chkActive.Checked               = category.Active;
            cmbCategoryBanner.SelectedValue = category.CategoryBannerID != null?category.CategoryBannerID.ToString() : "-1";


            if (lblCategoryID.Value != string.Empty)
            {
                AttributeBL attributeBL = new AttributeBL();
                dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(categoryID);
                dgvAttributes.DataBind();
            }
        }
Example #3
0
        private void loadIntoForm()
        {
            loadBrands();

            CategoryBL categoryBL = new CategoryBL();

            cmbCategory.DataSource     = categoryBL.GetCategories();
            cmbCategory.DataTextField  = "name";
            cmbCategory.DataValueField = "categoryID";
            cmbCategory.DataBind();

            VatBL vatBL = new VatBL();

            cmbVat.DataSource     = vatBL.GetVats();
            cmbVat.DataValueField = "vatID";
            cmbVat.DataTextField  = "vatValue";
            cmbVat.DataBind();
            cmbVat.SelectedIndex = 3;

            loadSupplier();

            PromotionBL promotionBL = new PromotionBL();

            cmbPromotions.DataSource     = promotionBL.GetPromotions(true, null, null);
            cmbPromotions.DataTextField  = "name";
            cmbPromotions.DataValueField = "promotionID";
            cmbPromotions.DataBind();
        }
        public void Initialize()
        {
            MapperBL.Initialize();


            categoryBL = new CategoryBL(new CategoryService(), new ProductService());
        }
Example #5
0
        private void loadCategories()
        {
            CategoryBL categoryBL = new CategoryBL();

            dgvCategory.DataSource = categoryBL.GetNestedCategoriesDataTable(true);
            dgvCategory.DataBind();
        }
Example #6
0
        private void saveCategory()
        {
            try
            {
                Category category = new Category();
                category.Name             = txtName.Text;
                category.Url              = txtUrl.Text;
                category.ImageUrl         = txtImageUrl.Text;
                category.ParentCategoryID = int.Parse(cmbParent.SelectedValue);
                if (lblCategoryID.Value != string.Empty)
                {
                    category.CategoryID = int.Parse(lblCategoryID.Value);
                }
                category.SortOrder          = (int.Parse(txtSortOrder.Text));
                category.PricePercent       = double.Parse(txtPricePercent.Text);
                category.WebPricePercent    = double.Parse(txtWebPricePercent.Text);
                category.ShowOnFirstPage    = chkShowOnFirstPage.Checked;
                category.NumberOfProducts   = (txtNumber.Text.Length > 0) ? int.Parse(txtNumber.Text) : 0;
                category.firstPageSortOrder = (txtSortOrderFirstPage.Text.Length > 0) ? int.Parse(txtSortOrderFirstPage.Text) : 0;
                category.firstPageOrderBy   = cmbCriterion.SelectedItem.Text;
                category.Description        = txtDescription.Text;
                category.Active             = chkActive.Checked;
                category.Slider             = new Slider(int.Parse(cmbSlider.SelectedValue), cmbSlider.SelectedItem.Text, DateTime.Now, DateTime.Now, true);
                category.CategoryBannerID   = cmbCategoryBanner.SelectedIndex > -1 ? int.Parse(cmbCategoryBanner.SelectedValue) : -1;
                category.UpdateProductsFromExternalApplication = chkUpdateProductsFromExternalApplication.Checked;
                category.ExportProducts = chkExportProducts.Checked;

                CategoryBL categoryBl = new CategoryBL();
                categoryBl.SaveCategory(category);
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, "danger");
            }
        }
        private void GetCategories()
        {
            CategoryBL CatBL = new CategoryBL();

            this.grdCategories.DataSource = CatBL.GetCategories();
            this.grdCategories.DataBind();
        }
Example #8
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //if(txtSearch.Text==string.Empty)
            //{
            //    MessageBox.Show("Please Select An Category ID ");
            //    return;
            //}

            if (MessageBox.Show("Are You Sure To Update Category?", "UpdateAlert", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                CategoryBL ojcate = new CategoryBL()
                {
                    CategoryID = Convert.ToInt32(txtCategoryID.Text)
                };
                ojcate.Update();
                MessageBox.Show("Record Updated");
                ClearGroup();


                LoadData();
            }
            else
            {
                MessageBox.Show("Record Not Update");
            }
        }
        public ActionResult UpdateCategory(CategoryDTO category)
        {
            CategoryBL categoryBL = new CategoryBL();

            try
            {
                if (ModelState.IsValid)
                {
                    category.created_by = 123;
                    category.updated_by = 123;
                    if (category.id != category.parent_id)
                    {
                        categoryBL.UpdateData(category);
                        return(RedirectToAction("Category"));
                    }
                    else
                    {
                        TempData["Error"] = "id and pararent_id is duplicated!";
                    }
                }
            }
            catch (DataException dex)
            {
                ModelState.AddModelError("", "Unable to perform action. Please contact us.");
                return(RedirectToAction("SubmissionFailed", category));
            }
            category = new CategoryDTO()
            {
                id = category.id
            };
            return(View("Update", LoadCategoryAddForm(category)));
        }
        public IEnumerable <CategoryModel> GetCategory(string catCode)
        {
            ICategoryBL          catBL   = new CategoryBL();
            List <CategoryModel> catList = catBL.GetCategory(catCode);

            return(catList);
        }
        public CategoryBL Create(CategoryBL model)
        {
            var categoryMapper  = _mapper.Map <Category>(model);
            var createdCategory = _categoryRepository.Create(categoryMapper);

            return(_mapper.Map <CategoryBL>(createdCategory));
        }
        public CategoryBL Update(CategoryBL model)
        {
            var categoryMapper  = _mapper.Map <Category>(model);
            var updatedCategory = _categoryRepository.Update(categoryMapper);

            return(_mapper.Map <CategoryBL>(updatedCategory));
        }
Example #13
0
        public ActionResult CategoryUpdate(CategoryDTO category)
        {
            CategoryBL         bl   = new CategoryBL();
            List <CategoryDTO> list = new List <CategoryDTO>();

            bl.SearchListUp(category, out list);
            ViewBag.CaterogyList = list;
            if (ModelState.IsValid)
            {
                category.updated_by = 0;
                int result = bl.UpdateData(category);
                if (result == 1)
                {
                    TempData["Error"]   = "Update badly";
                    TempData["Success"] = "";
                    return(View(category));
                }
                else
                {
                    TempData["Error"]   = "";
                    TempData["Success"] = "Update successfully";
                    return(RedirectToAction("CategorySearch"));
                }
            }
            else
            {
                return(View(category));
            }
        }
Example #14
0
        // GET: Caterogy
        public ActionResult CategorySearch(string Page, CategorySearch model)
        {
            CategoryBL  bl  = new CategoryBL();
            CategoryDTO dto = new CategoryDTO();

            if (!string.IsNullOrEmpty(model.SearchButton) || Page.IsNotNullOrEmpty())
            {
                if (Page != null)
                {
                    dto.page   = int.Parse(Page);
                    model.Page = dto.page;
                }

                List <CategoryDTO> result = new List <CategoryDTO>();
                if (model.CategoryCode.IsNotNullOrEmpty())
                {
                    dto.code = model.CategoryCode;
                }
                if (model.CategoryName.IsNotNullOrEmpty())
                {
                    dto.name = model.CategoryName;
                }
                bl.SearchData(dto, out result);
                model.PageCount     = bl.CountPage(dto);
                model.SearchResults = new StaticPagedList <CategoryDTO>(result, model.Page, 20, model.PageCount);
            }
            return(View(model));
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Category category = null;

            if (!Page.IsPostBack)
            {
                string categoryName = string.Empty;
                if (Page.Request.QueryString.ToString().Contains("category"))
                {
                    categoryName = Page.Request.QueryString["category"];
                }
                if (new CategoryBL().GetCategoryByUrl(categoryName) == null)
                {
                    Server.Transfer("/not-found.aspx");
                }
                ViewState.Add("category", categoryName);
                loadIntoForm();
                loadBrands();
                loadFilter(categoryName);
                loadPrices();
                createQueryString();
                category = new CategoryBL().GetCategoryByUrl(categoryName);
                //ViewState["pageTitle"] = categoryName.Replace(categoryName[0].ToString(), categoryName[0].ToString().ToUpper()) + " | Milupino";
                ViewState["pageTitle"]   = category.Name + " | Milupino";
                ViewState["categoryUrl"] = category.Url;
            }
            Page.Title = ViewState["pageTitle"].ToString();

            canonicalUrl.Text = @"<link rel=""canonical"" href=""" + ConfigurationManager.AppSettings["webShopUrl"] + "/proizvodi/" + ViewState["categoryUrl"].ToString() + @"""/>";
        }
Example #16
0
        public ActionResult CategoryDelete(int id)
        {
            CategoryBL         bl          = new CategoryBL();
            CategoryDTO        categoryDTO = new CategoryDTO();
            List <CategoryDTO> dtos        = new List <CategoryDTO>();

            categoryDTO.id = id;
            bl.SearchData(categoryDTO, out dtos);
            if (dtos.Count <= 0)
            {
                Response.StatusCode = 404;
                return(null);
            }
            else
            {
                int result = bl.DeleteData(id);
                if (result == 1)
                {
                    TempData["Error"]   = "Delete badly";
                    TempData["Success"] = "";
                }
                else
                {
                    TempData["Error"]   = "";
                    TempData["Success"] = "Delete successfully";
                }
            }

            return(RedirectToAction("CategorySearch"));
        }
        public ActionResult Category(string page, ResearchCategoryModel model)
        {
            ModelState.Clear();
            CategoryBL bl = new CategoryBL();

            if (model == null)
            {
                model             = new ResearchCategoryModel();
                model.Category    = new CategoryDTO();
                model.lstCategory = new List <CategoryDTO>();
            }
            else
            {
                if (model.Category == null)
                {
                    model.Category = new CategoryDTO();
                }
                if (model.lstCategory == null)
                {
                    model.lstCategory = new List <CategoryDTO>();
                }
            }
            if (page == null)
            {
                page = "1";
            }
            model.page_count = bl.CountData(model.Category);
            List <CategoryDTO> list;

            model.Category.page = int.Parse(page);
            bl.SearchData(model.Category, out list);
            model.lstCategory   = list;
            TempData["Success"] = model.page_count + " row(s) has found.";
            return(View(model));
        }
        public List <ContentModel> GetPSCategoryList()
        {
            ICategoryBL         catBL   = new CategoryBL();
            List <ContentModel> catList = catBL.GetPSCategoryList();

            return(catList);
        }
Example #19
0
        private void loadCategories()
        {
            CategoryBL categoryBL = new CategoryBL();

            rptCategories.DataSource = categoryBL.GetCategoriesForFirstPage();
            rptCategories.DataBind();
        }
Example #20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CategoryBL    categoryBL     = new CategoryBL();
                BindingSource categoryListBS = (BindingSource)dgvCategory.DataSource;
                var           categoryList   = (List <Category>)categoryListBS.DataSource;

                if (categoryList.Count > 0)
                {
                    foreach (Category category in categoryList)
                    {
                        if (category.IsChanged)
                        {
                            categoryBL.Save(category);
                        }
                    }
                    PoupulateCategoryGrid();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #21
0
        public ActionResult CategoryDeleteMulti(FormCollection frm)
        {
            string[]   ids = frm["CategoryID"].Split(new char[] { ',' });
            CategoryBL bl  = new CategoryBL();

            foreach (string item in ids)
            {
                CategoryDTO categoryDTO = new CategoryDTO();
                int         id          = item.ParseInt32();
                categoryDTO.id = id;
                List <CategoryDTO> dtos = new List <CategoryDTO>();
                int returncode          = bl.SearchData(categoryDTO, out dtos);
                if (returncode == 1)
                {
                    Response.StatusCode = 404;
                    return(null);
                }
                else
                {
                    int result = bl.DeleteData(id);
                    if (result == 1)
                    {
                        TempData["Error"]   = "Delete badly";
                        TempData["Success"] = "";
                    }
                    else
                    {
                        TempData["Error"]   = "";
                        TempData["Success"] = "Insert successfully";
                    }
                }
            }
            return(RedirectToAction("CategorySearch"));
        }
        public SubCategoryViewModel(IRegionManager regionManager)
        {
            _subCategoryBl = new SubCategoryBL();
            _subCategories = new ObservableCollection <SubCategoryVO>(_subCategoryBl.FindAll());

            _categoryBl = new CategoryBL();
            _categories = new ObservableCollection <CategoryVO>(_categoryBl.FindAll());
        }
        /// <summary>
        /// This method is used to get all categories
        /// </summary>
        /// <returns></returns>
        public IEnumerable <CategoryModel> GetAllCategories()
        {
            //IList<CategoryModel> result = new List<CategoryModel>();
            ICategoryBL          catBL   = new CategoryBL();
            List <CategoryModel> catList = catBL.GetAllCategories();

            return(catList);
        }
Example #24
0
        private void fillCategory()
        {
            DataTable dt = CategoryBL.GetAll();

            ddlCategory.DataSource     = dt;
            ddlCategory.DataTextField  = "Name";
            ddlCategory.DataValueField = "Name";
            ddlCategory.DataBind();
        }
        private void FillGridView()
        {
            DataTable dt = new DataTable();

            dt = CategoryBL.GetAll() as DataTable;
            GridView1.DataSource = dt;
            GridView1.DataBind();
            ViewState.Add("Mydt", dt);
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            string NewCat = CatTxt.Text;

            CategoryBL.Insert(NewCat);
            FillGridView();
            CatTxt.Visible = false;
            AddBtn.Visible = false;
        }
Example #27
0
        private void loadCategory(int categoryID)
        {
            CategoryBL categoryBL = new CategoryBL();
            Category   category   = categoryBL.GetCategory(categoryID);

            txtName.Text     = category.Name;
            txtUrl.Text      = category.Url;
            txtImageUrl.Text = category.ImageUrl;
            //cmbParent.SelectedValue = cmbParent.Items.FindByValue(category.ParentCategoryID.ToString()).Value;
            cmbParent.SelectedValue    = category.ParentCategoryID.ToString();
            txtSortOrder.Text          = category.SortOrder.ToString();
            lblCategoryID.Value        = category.CategoryID.ToString();
            txtPricePercent.Text       = category.PricePercent.ToString();
            txtWebPricePercent.Text    = category.WebPricePercent.ToString();
            chkShowOnFirstPage.Checked = category.ShowOnFirstPage;
            txtNumber.Text             = category.NumberOfProducts.ToString();
            txtSortOrderFirstPage.Text = category.firstPageSortOrder.ToString();
            if (category.firstPageOrderBy != string.Empty && category.firstPageOrderBy != null)
            {
                cmbCriterion.SelectedValue = cmbCriterion.Items.FindByText(category.firstPageOrderBy).Value;
            }
            setFirstPageControls(category.ShowOnFirstPage);
            Page.Title = category.Name + " | Admin panel";
            ViewState.Add("pageTitle", Page.Title);
            txtDescription.Text = category.Description;
            chkActive.Checked   = category.Active;
            if (category.Slider != null)
            {
                cmbSlider.SelectedValue = category.Slider.SliderID.ToString();
            }
            cmbCategoryBanner.SelectedValue = category.CategoryBannerID != 0 ? category.CategoryBannerID.ToString() : "-1";
            chkUpdateProductsFromExternalApplication.Checked = category.UpdateProductsFromExternalApplication;
            chkExportProducts.Checked = category.ExportProducts;

            imgIcon.ImageUrl     = category.ImageUrl != string.Empty ? ResolveUrl("~/images/" + category.ImageUrl) : ResolveUrl("~/images/no-image.jpg");
            lblCategoryName.Text = category.Name;
            ViewState.Add("categoryName", category.Name);
            txtExternalID.Text       = category.ExternalID.ToString();
            txtExternalParentID.Text = category.ExternalParentID.ToString();

            if (lblCategoryID.Value != string.Empty)
            {
                AttributeBL attributeBL = new AttributeBL();
                dgvAttributes.DataSource = attributeBL.GetAttributesForCategory(categoryID);
                dgvAttributes.DataBind();
            }

            chkShowInFooter.Checked      = category.ShowInFooter;
            rdbImageTypeStandard.Checked = category.ImageUrlSource == 0;
            rdbImageTypeSprite.Checked   = category.ImageUrlSource == 1;
            txtPositionX.Text            = category.ImageUrlPositionX.ToString();
            txtPositionY.Text            = category.ImageUrlPositionY.ToString();
            txtIcon.Text = category.Icon;
            chkShowProductsFromSubCategories.Checked = category.ShowProductsFromSubCategories;
            txtPriceFixedAmount.Text = string.Format("{0:N2}", category.PriceFixedAmount);
            loadCategoryBrandPrice();
        }
Example #28
0
        private void loadCategories()
        {
            CategoryBL categoryBL = new CategoryBL();

            cmbCategory.DataSource     = categoryBL.GetCategories();
            cmbCategory.DataTextField  = "name";
            cmbCategory.DataValueField = "categoryID";
            cmbCategory.DataBind();
        }
Example #29
0
        public ActionResult CategoryAdd()
        {
            CategoryBL         catelogy = new CategoryBL();
            List <CategoryDTO> catelogydt;

            catelogy.SearchList(out catelogydt);
            ViewBag.CaterogyList = catelogydt;
            return(View());
        }
Example #30
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         categorybl = new CategoryBL();
         DatLstCategories.DataSource = categorybl.GetProjectCategories();
         DatLstCategories.DataBind();
     }
 }
Example #31
0
 internal static bool Insert(CategoryBL categoryBL)
 {
     OnlineExamHelper.Context.sp_OnlineCategoryNewInsertCommand(categoryBL.Category);
     return true;
 }
Example #32
0
 internal static bool Update(CategoryBL categoryBL)
 {
     OnlineExamHelper.Context.sp_OnlineCategoryNewUpdateCommand(categoryBL.Category, categoryBL.CategoryId, categoryBL.CategoryId);
     return true;
 }
Example #33
0
 internal static bool Delete(CategoryBL categoryBL)
 {
     OnlineExamHelper.Context.sp_OnlineOptionsNewDeleteCommand(categoryBL.CategoryId);
     return true;
 }