示例#1
0
        public ActionResult Update(long id)
        {
            var model = new BrandDao().GetByID(id);

            GetDropdown(long.Parse(model.ParentID.ToString()));
            return(View(model));
        }
示例#2
0
 /// <summary>
 /// Constructeur privé du registre, instancie les DAOs.
 /// </summary>
 private DaoRegistry()
 {
     BrandDao     = new BrandDao();
     FamilyDao    = new FamilyDao();
     SubFamilyDao = new SubFamilyDao(FamilyDao);
     ArticleDao   = new ArticleDao(SubFamilyDao, BrandDao);
 }
示例#3
0
        public UnitOfWork(IDbConnection connection)
        {
            _connection = connection;

            StoredProcedures          = new StoredProcedures(connection);
            Brands                    = new BrandDao(connection);
            Carts                     = new CartDao(connection);
            Categories                = new CategoryDao(connection);
            CategoryProducts          = new CategoryProductDao(connection);
            ContactInfo               = new ContactInfoDao(connection);
            Characteristics           = new CharacteristicDao(connection);
            CharacteristicProducts    = new CharacteristicProductDao(connection);
            FavouriteProducts         = new FavouriteProductDao(connection);
            Items                     = new ItemDao(connection);
            OptionalParameters        = new OptionalParameterDao(connection);
            OptionalParameterProducts = new OptionalParameterProductDao(connection);
            Orders                    = new OrderDao(connection);
            OrderDeliveryTypes        = new OrderDeliveryTypeDao(connection);
            OrderPaymentTypes         = new OrderPaymentTypeDao(connection);
            OrderProducts             = new OrderProductDao(connection);
            OrderStatuses             = new OrderStatusDao(connection);
            Products                  = new ProductDao(connection);
            ProductImages             = new ProductImageDao(connection);
            Roles                     = new RoleDao(connection);
            SupportMessages           = new SupportMessageDao(connection);
            Users                     = new UserDao(connection);
        }
示例#4
0
 public ActionResult Update(Brand entity)
 {
     if (ModelState.IsValid)
     {
         bool result;
         try
         {
             result = new BrandDao().Update(entity);
         }
         catch (Exception ex)
         {
             return(View("Eror", new HandleErrorInfo(ex, "Brand", "Index")));
         }
         if (result)
         {
             ModelState.AddModelError("", "Cập nhật thành công");
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật không thành công");
             return(RedirectToAction("Index"));
         }
     }
     else
     {
         ModelState.AddModelError("", "Vui lòng nhập đầy đủ thông tin");
         return(View());
     }
 }
        // GET: Admin/Brand
        public ActionResult DSChiNhanh(int page = 1, int pagesize = 10)
        {
            var accDao = new BrandDao();
            var model  = accDao.ListChiNhanhAll(page, pagesize);

            return(View(model));
        }
示例#6
0
        // GET: LoadBrand
        public ActionResult ChiNhanh()
        {
            var product = new BrandDao();

            ViewBag.DSChiNhanh = product.ListAll();
            return(View());
        }
示例#7
0
        public ActionResult Create(Brand entity)
        {
            if (ModelState.IsValid)
            {
                var brandDao = new BrandDao();

                entity.Name = entity.Name.Trim();
                long result = brandDao.Insert(entity);
                if (result > 0)
                {
                    ShowNotify("Update successfully", "success");
                    return(RedirectToAction("Index", "Brand"));
                }
                else if (result == -1)
                {
                    ShowNotify("This name already exists", "error");
                }
                else
                {
                    ShowNotify("System error", "error");
                }
            }

            return(View("Create"));
        }
示例#8
0
        private void BrandSearch_Click(object sender, EventArgs e)
        {
            BrandDao dao = new BrandDao();

            //dao.test();
            dao.test();
        }
示例#9
0
        // GET: Admin/Brand
        public ActionResult IndexBrand(int page = 1, int pageSize = 5)
        {
            var dao   = new BrandDao();
            var model = dao.ListBrand(page, pageSize);

            return(View(model));
        }
示例#10
0
        public ActionResult Edit(int id)
        {
            var brand = new BrandDao().Viewdetail(id);

            ViewBag.topBrand = brand.topBrand;
            return(View(brand));
        }
示例#11
0
 public ActionResult Create(Brand entity)
 {
     if (ModelState.IsValid)
     {
         long id;
         try
         {
             entity.Status    = true;
             entity.CreatedOn = DateTime.Now;
             id = new BrandDao().Insert(entity);
         }
         catch (Exception ex)
         {
             return(View("Error", new HandleErrorInfo(ex, "Brand", "Index")));
         }
         if (id > 0)
         {
             ModelState.AddModelError("", "Thêm mới thành công");
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm mới không thành công");
             return(RedirectToAction("Create"));
         }
     }
     else
     {
         SetViewBag();
         ModelState.AddModelError("", "Vui lòng nhập đầy đủ thông tin");
         return(RedirectToAction("Create"));
     }
 }
        public ActionResult Edit(int id)
        {
            var dao  = new BrandDao();
            var sach = dao.GetChiNhanh(id);

            SetViewBag(sach.ID);
            return(View(sach));
        }
示例#13
0
 /// <summary>
 /// Instancie un nouveau menu d'import.
 /// </summary>
 public ImporterMenu()
 {
     InitializeComponent();
     ArticleDao   = DaoRegistry.GetInstance.ArticleDao;
     FamilyDao    = DaoRegistry.GetInstance.FamilyDao;
     BrandDao     = DaoRegistry.GetInstance.BrandDao;
     SubFamilyDao = DaoRegistry.GetInstance.SubFamilyDao;
 }
示例#14
0
        public ActionResult Brandlist(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new BrandDao();
            var model = dao.ListAllBrand(searchString, page, pageSize);

            ViewBag.searchString = searchString;
            return(View(model));
        }
示例#15
0
        public ActionResult EditBrand(long id)
        {
            var dao   = new BrandDao();
            var brand = dao.GetByID(id);

            SetViewBag(brand.Category_ID);
            return(View());
        }
 public ReplacePhoneManage(BrandContext brandContext, BrandTypeContext brandTypeContext, BrandTypeProductNoContext brandTypeProductNoContext, TypeYearContext typeYearContext)
 {
     _brandContext              = brandContext;
     _brandTypeContext          = brandTypeContext;
     _brandTypeProductNoContext = brandTypeProductNoContext;
     _typeYearContext           = typeYearContext;
     brandDao              = new BrandDao(_brandContext);
     brandTypeDao          = new BrandTypeDao(_brandTypeContext);
     brandTypeProductNoDao = new BrandTypeProductNoDao(_brandTypeProductNoContext);
     typeYearDao           = new TypeYearDao(typeYearContext);
 }
示例#17
0
 public LoginManage(UserContext userContext, PhoneContext phoneContext, BrandContext brandContext, BrandTypeContext brandTypeContext, BrandTypeProductNoContext brandTypeProductNoContext, TypeYearContext typeYearContext, DeleteReasonContext deleteReasonContext)
 {
     _userContext          = userContext;
     userIQ                = _userContext.Users;
     phoneDao              = new PhoneDao(phoneContext);
     brandDao              = new BrandDao(brandContext);
     brandTypeDao          = new BrandTypeDao(brandTypeContext);
     brandTypeProductNoDao = new BrandTypeProductNoDao(brandTypeProductNoContext);
     typeYearDao           = new TypeYearDao(typeYearContext);
     deleteReasonDao       = new DeleteReasonDao(deleteReasonContext);
 }
示例#18
0
        public ActionResult SideBar()
        {
            BrandDao brandDao = new BrandDao();

            ViewBag.brandDao = brandDao.getList();
            StypeDao stypesDao = new StypeDao();

            ViewBag.stypesDao = stypesDao.getList();
            ColorDao colorDao = new ColorDao();

            ViewBag.colorDao = colorDao.getList();
            return(PartialView("_PartialSideBar"));
        }
示例#19
0
        public ActionResult Combobox()
        {
            BrandDao brandDao = new BrandDao();

            ViewBag.Brand = brandDao.getList();
            StypeDao stypesDao = new StypeDao();

            ViewBag.Stype = stypesDao.getList();
            ColorDao colorDao = new ColorDao();

            ViewBag.Color = colorDao.getList();
            return(PartialView("_PartialCombobox"));
        }
示例#20
0
        public ActionResult CreateBrand([Bind(Include = "ID,Name,MetaTitle,Image,CreateDate,CreateBy,Category_ID,Status")] Brand brand, HttpPostedFileBase image)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var dao      = new BrandDao();
                    var filename = "";
                    var path     = "";
                    if (image != null)
                    {
                        filename = DateTime.Now.ToString("dd-MM-yy-hh-mm-ss-") + image.FileName;
                        path     = Path.Combine(Server.MapPath("~/Image"), filename);
                        image.SaveAs(path);
                        brand.Image = filename;
                    }
                    //else
                    //{

                    //    content.Image = "~/Image/logo.png";
                    //}
                    brand.Name        = brand.Name;
                    brand.CreateDate  = Convert.ToDateTime(DateTime.UtcNow.ToLocalTime());
                    brand.MetaTitle   = StringHelper.ToUnsignString(brand.Name);
                    brand.Category_ID = brand.Category_ID;
                    brand.Status      = Convert.ToBoolean(true);
                    var id = dao.Insert(brand);
                    if (id > 0)
                    {
                        SetAlert("Thêm mới thành thành công", "success");
                        ViewBag.Success = "Thêm thành công";
                        brand           = new Brand();
                        return(RedirectToAction("Index", "Brand"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Thêm mới ko thành công");
                    }
                }
            }
            catch (DbEntityValidationException e)
            {
                throw e;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            SetViewBag();
            return(View(brand));
        }
示例#21
0
        private void initData()
        {
            BrandDao     dao  = new BrandDao();
            List <Brand> list = dao.getBrands();

            foreach (Brand brand in list)
            {
                int index = dataGridView1.Rows.Add();
                dataGridView1.Rows[index].Cells[0].Value = brand.BrandId;
                dataGridView1.Rows[index].Cells[1].Value = brand.BrandCode;
                dataGridView1.Rows[index].Cells[2].Value = brand.BrandName;
                dataGridView1.Rows[index].Cells[3].Value = brand.BrandState;
            }
        }
示例#22
0
        public ActionResult Delete(string id)
        {
            if (id == null || !Regex.IsMatch(id, @"\d"))
            {
                return(RedirectToAction("Index", "Brand"));
            }

            var brandDao = new BrandDao();

            brandDao.Delete(Int32.Parse(id));

            ShowNotify("Delete successfully", "success");
            return(RedirectToAction("Index"));
        }
        public ActionResult Delete(int id)
        {
            bool result = new BrandDao().Delete(id);

            if (result)
            {
                return(Redirect("/Admin/Brand/DSChiNhanh"));;
            }
            else
            {
                ModelState.AddModelError("", "Xóa món thất bại");
            }
            return(Redirect("/Admin/Brand/DSChiNhanh"));;
        }
示例#24
0
        public ActionResult Edit(ProductViewModel entity)
        {
            if (ModelState.IsValid)
            {
                var product = new Product();
                product.ID          = entity.ID;
                product.Name        = entity.Name.Trim();
                product.MetaTitle   = entity.MetaTitle;
                product.Description = entity.Description;
                product.Image       = entity.Image;
                product.MoreImages  = entity.MoreImages;
                product.Price       = entity.Price;
                product.CategoryID  = entity.CategoryID;
                product.Detail      = entity.Detail;
                product.BrandID     = entity.BrandID;
                product.Status      = entity.Status;
                product.TopHot      = entity.TopHot;

                var productDao  = new ProductDao();
                var categoryDao = new CategoryDao();
                var brandDao    = new BrandDao();

                long result = productDao.Update(product);
                if (result > 0)
                {
                    ShowNotify("Update successfully", "success");
                    return(RedirectToAction("Index", "Product"));
                }
                else if (result == -1)
                {
                    ShowNotify("This '" + categoryDao.GetByID(product.CategoryID).Name + "' category is locked", "error");
                }
                else if (result == -2)
                {
                    ShowNotify("This '" + brandDao.GetByID(product.BrandID).Name + "' brand is locked", "error");
                }
                else if (result == -3)
                {
                    ShowNotify("Input price of product please !!!", "error");
                }
                else
                {
                    ShowNotify("System error", "error");
                }
            }
            SetViewBagBrand(entity.BrandID, false);
            SetViewBagCategory(entity.CategoryID, false);
            return(View("Edit"));
        }
        public ActionResult Edit(ChiNhanh model)
        {
            if (ModelState.IsValid)
            {
                SetViewBag(model.ID);
                var kq = new BrandDao().Update(model);
                if (kq)

                {
                    return(Redirect("/Admin/Brand/DSChiNhanh"));
                }
            }
            SetViewBag();
            return(View(model));
        }
        public ActionResult EditProducts(string id)
        {
            BrandDao brandDao = new BrandDao();

            ViewBag.Brand = brandDao.getList();
            StypeDao stypesDao = new StypeDao();

            ViewBag.Stype = stypesDao.getList();
            ColorDao colorDao = new ColorDao();

            ViewBag.Color = colorDao.getList();
            var model = new ProductDao().getByID(id);

            return(View(model));
        }
示例#27
0
        public ActionResult Delete(long id)
        {
            bool result = new BrandDao().Delete(id);

            if (result)
            {
                ModelState.AddModelError("", "Xóa thành công");
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Xóa không thành công");
                return(RedirectToAction("Index"));
            }
        }
示例#28
0
        public ActionResult Edit(string id)
        {
            if (id == null || !Regex.IsMatch(id, @"\d"))
            {
                return(RedirectToAction("Index", "Brand"));
            }

            var brandDao = new BrandDao();
            var product  = brandDao.GetByID(Int32.Parse(id));

            if (product == null)
            {
                return(RedirectToAction("Index", "Brand"));
            }

            return(View(product));
        }
示例#29
0
        public ActionResult EditBrand([Bind(Include = "ID,Name,MetaTitleImage,CreateDate,CreateBy,ModifiedDate,ModifiedBy,Category_ID,Status")] Brand model, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                var dao = new BrandDao();

                var a        = new Brand();
                var path     = "";
                var filename = "";
                if (image != null)
                {
                    filename = DateTime.Now.ToString("dd-MM-yy-hh-mm-ss-") + image.FileName;
                    path     = Path.Combine(Server.MapPath("~/Image"), filename);
                    image.SaveAs(path);
                    model.Image = filename;
                }
                //else
                //{

                //    content.Image = "~/Image/logo.png";
                //}
                model.Name        = model.Name;
                model.CreateDate  = Convert.ToDateTime(DateTime.UtcNow.ToLocalTime());
                model.MetaTitle   = StringHelper.ToUnsignString(model.Name);
                model.Category_ID = model.Category_ID;
                model.Status      = Convert.ToBoolean(true);
                var result = dao.Update(model);
                if (result)
                {
                    SetAlert("Sửa thành công", "success");
                    ViewBag.Success = "Cập nhật thành công";
                    model           = new Brand();
                    return(RedirectToAction("Index", "Brand"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật ko thành công");
                }
            }
            SetViewBag(model.Category_ID);
            return(View());
        }
示例#30
0
        public ActionResult Brand(long cateid, int page = 1 /*, int pageSize = 2*/)
        {
            var category = new CategoryDao().ViewDetail(cateid);

            ViewBag.Category = category;
            var mbrand = new BrandDao().ViewDetail(cateid);

            ViewBag.Mbrand = mbrand;
            var brand = new BrandDao().GetByID(cateid);

            ViewBag.Brand = brand;


            ViewBag.Subcategory = new ProductDao().ListSubCategory(cateid);
            ViewBag.ListBrand   = new ProductDao().ListBrandByCategoryId(cateid);
            var model = new ProductDao().ListByBrandId(cateid);

            ViewBag.Cate = new CategoryDao().ListCategory();
            return(View(model.ToPagedList(page, 8)));
        }