Ejemplo n.º 1
0
        public ActionResult ThemMoiBrand(Brand objBrand, HttpPostedFileBase fUpload)
        {
            if (objBrand != null)
            {
                string fileName = "";
                if (fUpload != null && fUpload.ContentLength > 0)
                {
                    fileName = Path.GetFileName(fUpload.FileName);

                    fUpload.SaveAs(Server.MapPath("~/Content/Images/" + fileName));
                    //Lưu vào db
                    objBrand.Image = fileName;
                }

                //xu ly
                BrandBusiness brandBusiness = new BrandBusiness();
                bool          ketQua        = brandBusiness.ThemMoiBrand(objBrand);
                if (ketQua)
                {
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                return(HttpNotFound());
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult DanhSachBrand()
        {
            BrandBusiness brandBusiness = new BrandBusiness();
            List <Brand>  lstBrand      = brandBusiness.LayDanhSachBrand();

            return(View(lstBrand));
        }
        public void HienThiBrand()
        {
            BrandBusiness brandBusiness = new BrandBusiness();
            List <Brand>  lstBrand      = brandBusiness.LayDanhSachBrand();

            ViewBag.Brand = new SelectList(lstBrand, "Id", "Name");
        }
Ejemplo n.º 4
0
        public static Brand ConvertToDataEntity(BrandBusiness brand)
        {
            var dataObject = new Brand(brand.Name);

            dataObject.Models = (ICollection <Model>)brand.Models;

            return(dataObject);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Brand mapping methods
        /// </summary>
        /// <param name="brand"></param>
        /// <returns></returns>
        ///
        public static BrandBusiness ConvertToBusinessEntity(Brand brand)
        {
            var businessObject = new BrandBusiness(brand.Name);

            businessObject.Models = (ICollection <ModelBusiness>)brand.Models;


            return(businessObject);
        }
Ejemplo n.º 6
0
 public LoadPartialController()
 {
     this._unitOfWork          = new UnitOfWork(_df);
     this._categoryBusiness    = new CategoryBusiness(_df, this._unitOfWork);
     this._subCategoryBusiness = new SubCategoryBusiness(_df, this._unitOfWork);
     this._brandBusiness       = new BrandBusiness(_df, this._unitOfWork);
     this._productBusiness     = new ProductBusiness(_df, this._unitOfWork);
     this._sliderBusiness      = new SliderBusiness(_df, this._unitOfWork);
     this._ImageBusiness       = new ImageBusiness(_df, this._unitOfWork);
 }
Ejemplo n.º 7
0
        public void fillDDL()
        {
            string        conn     = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness brand    = new BrandBusiness(conn);
            DataSet       dsResult = brand.getAllBrands();

            ddlBrand.DataSource     = dsResult;
            ddlBrand.DataTextField  = "name";
            ddlBrand.DataValueField = "idBrand";
            ddlBrand.DataBind();
        }
Ejemplo n.º 8
0
        public string getBrandById(string idBrand, string key)
        {
            EncryptionMethods em   = new EncryptionMethods();
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness     b    = new BrandBusiness(conn);
            int    t        = Int32.Parse(em.decrypting(idBrand + "", key));
            Brand  brand    = b.getBrandById(t);
            string response = brand.IdBrand + ";" + brand.Name;

            return(em.encrypt(response, key));
        }
Ejemplo n.º 9
0
        public string deleteBrand(string idBrand, string key)
        {
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness     b    = new BrandBusiness(conn);
            EncryptionMethods em   = new EncryptionMethods();
            int    t        = Int32.Parse(em.decrypting(idBrand + "", key));
            int    r        = b.deleteBrand(t);
            string response = em.encrypt(r + "", key);

            return(response);
        }
Ejemplo n.º 10
0
        //
        // GET: /Product/

        public AdminProductController()
        {
            this._unitOfWork               = new UnitOfWork(_df);
            this._productBusiness          = new ProductBusiness(_df, this._unitOfWork);
            this._productSizeBusiness      = new ProductSizeBusiness(_df, this._unitOfWork);
            this._productAttributeBusiness = new ProductAttributeBusiness(_df, this._unitOfWork);
            this._brandBusiness            = new BrandBusiness(_df, this._unitOfWork);
            this._categoryBusiness         = new CategoryBusiness(_df, this._unitOfWork);
            this._imageBusiness            = new ImageBusiness(_df, this._unitOfWork);
            this._sliderBusiness           = new SliderBusiness(_df, this._unitOfWork);
            this._subCategoryBusiness      = new SubCategoryBusiness(_df, this._unitOfWork);
        }
Ejemplo n.º 11
0
        public ActionResult Xoa(string Id)
        {
            BrandBusiness brandBusiness = new BrandBusiness();

            bool ketQua = brandBusiness.XoaBrand(Id);

            if (ketQua)
            {
                return(RedirectToAction("Index"));
            }

            return(View());
        }
Ejemplo n.º 12
0
 public ProductController()
 {
     this._unitOfWork               = new UnitOfWork(_df);
     this._categoryBusiness         = new CategoryBusiness(_df, this._unitOfWork);
     this._subCategoryBusiness      = new SubCategoryBusiness(_df, this._unitOfWork);
     this._brandBusiness            = new BrandBusiness(_df, this._unitOfWork);
     this._productBusiness          = new ProductBusiness(_df, this._unitOfWork);
     this._productSizeBusiness      = new ProductSizeBusiness(_df, this._unitOfWork);
     this._productAttributeBusiness = new ProductAttributeBusiness(_df, this._unitOfWork);
     this._ImageBusiness            = new ImageBusiness(_df, this._unitOfWork);
     this._AddToCartBusiness        = new AddToCartBusiness(_df, this._unitOfWork);
     this._WishListBusiness         = new WishListBusiness(_df, this._unitOfWork);
     this._CompareListBusiness      = new CompareListBusiness(_df, this._unitOfWork);
 }
Ejemplo n.º 13
0
        public string getPhoneById(string idPhone, string key)
        {
            EncryptionMethods em   = new EncryptionMethods();
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            int           t        = Int32.Parse(em.decrypting(idPhone, key));
            PhoneBusiness pb       = new PhoneBusiness(conn);
            BrandBusiness bb       = new BrandBusiness(conn);
            Phone         phone    = pb.getPhoneById(t);
            Brand         brand    = bb.getBrandById(phone.Brand.IdBrand);
            string        path     = phone.Image;
            string        response = phone.IdPhone + ";" + phone.Model + ";" + brand.Name + ";" + phone.OS + ";" + phone.NetworkMode + ";" + phone.InternalMemory + ";" + phone.ExternalMemory + ";" +
                                     phone.Pixels + ";" + phone.Flash + ";" + phone.Resolution + ";" + phone.Price + ";" + phone.Quantity + ";" + "http://25.45.62.52/CoreVises" + path.Substring(2, path.Length - 2);

            return(em.encrypt(response, key));
        }
Ejemplo n.º 14
0
        public string getAllBrands(string key)
        {
            string            response          = "";
            string            conn              = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness     b                 = new BrandBusiness(conn);
            EncryptionMethods em                = new EncryptionMethods();
            DataSet           dsBrand           = b.getAllBrands();
            DataRowCollection dataRowCollection = dsBrand.Tables["TBrand"].Rows;

            foreach (DataRow currentRow in dataRowCollection)
            {
                response += currentRow["idBrand"].ToString() + ";" + currentRow["name"].ToString() + "#";
            }

            return(em.encrypt(response, key));
        }
Ejemplo n.º 15
0
        // GET: api/Brand
        // Brings all brands
        // SOAP Name = FetchAllBrands
        public IHttpActionResult Get()
        {
            var content = new Response <Brand>();

            try
            {
                using (var brandBusiness = new BrandBusiness())
                {
                    content = brandBusiness.FetchAllBrands();
                }
            } catch (Exception ex)
            {
                content.isSuccess = false;
                content.Message  += ex.Message;
            }
            return(new StandartResult <Brand>(content, Request));
        }
        public Response <Brand> FetchAllBrands()
        {
            Response <Brand> res = new Response <Brand>();

            try
            {
                using (var brandBusiness = new BrandBusiness())
                {
                    res = brandBusiness.FetchAllBrands();
                }
            }
            catch (Exception ex)
            {
                res.Message   = "An error occured in FetchAllBrands() func. in Spice-Websevice.BrandService\n" + ex.Message;
                res.isSuccess = false;
            }
            return(res);
        }
        public Response <Brand> UpdateBrand(Brand entity)
        {
            Response <Brand> res = new Response <Brand>();

            try
            {
                using (var brandBusiness = new BrandBusiness())
                {
                    res = brandBusiness.UpdateBrand(entity);
                }
            }
            catch (Exception ex)
            {
                res.isSuccess = false;
                res.Message   = "An error occured in UpdateBrand() function in Spice-WebService.BrandService\n" + ex.Message;
            }
            return(res);
        }
Ejemplo n.º 18
0
        // PUT: api/Brand
        // updates a brand
        // body = Brand object
        // SOAP Name = UpdateBrand
        public IHttpActionResult Put([FromBody] Brand brand)
        {
            var content = new Response <Brand>();

            try
            {
                using (var brandBusiness = new BrandBusiness())
                {
                    content = brandBusiness.UpdateBrand(brand);
                }
            }
            catch (Exception ex)
            {
                content.isSuccess = false;
                content.Message  += ex.Message;
            }
            return(new StandartResult <Brand>(content, Request));
        }
        public Response <Brand> FetchOneBrandById(int BrandID)
        {
            Response <Brand> res = new Response <Brand>();

            try
            {
                using (var brandBusiness = new BrandBusiness())
                {
                    res = brandBusiness.FetchOneBrandById(BrandID);
                }
            }
            catch (Exception ex)
            {
                res.Message   = "An error occured in FetchOneBrandById() in Spice-WebService.BrandService\n" + ex.Message;
                res.isSuccess = false;
            }
            return(res);
        }
Ejemplo n.º 20
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            Brand brand = new Brand();

            brand.Name = txtName.Text;
            string        conn   = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            BrandBusiness brandB = new BrandBusiness(conn);
            int           exists = brandB.insertBrand(brand);

            if (exists == -1)
            {
                Response.Cookies["message"].Value   = "Somenthing is wrong, sorry.";
                Response.Cookies["message"].Expires = DateTime.Now.AddSeconds(5);
                Response.Redirect("./InsertBrand.aspx");
            }
            else
            {
                Response.Cookies["message"].Value   = "The brand was correctly added.";
                Response.Cookies["message"].Expires = DateTime.Now.AddSeconds(5);
                Response.Redirect("./InsertBrand.aspx");
            }
        }
Ejemplo n.º 21
0
        public string getPhones(string key)
        {
            string            response          = "";
            string            conn              = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            PhoneBusiness     pb                = new PhoneBusiness(conn);
            EncryptionMethods em                = new EncryptionMethods();
            DataSet           dsPhone           = pb.getPhones();
            DataRowCollection dataRowCollection = dsPhone.Tables["TPhone"].Rows;
            BrandBusiness     bb                = new BrandBusiness(conn);
            string            path              = "";

            foreach (DataRow currentRow in dataRowCollection)
            {
                Brand brand = bb.getBrandById(Int32.Parse(currentRow["idBrand"].ToString()));
                path      = currentRow["imagePhone"].ToString();
                response += currentRow["idPhone"].ToString() + ";" + currentRow["model"].ToString() + ";" + brand.Name + ";" + currentRow["OS"].ToString()
                            + ";" + currentRow["networkMode"].ToString() + ";" + currentRow["internalMemory"].ToString() + ";" + currentRow["externalMemory"].ToString() + ";" + currentRow["pixels"].ToString() + ";" +
                            currentRow["flash"].ToString() + ";" + currentRow["resolution"].ToString() + ";" + currentRow["price"].ToString() + ";" + currentRow["quantity"].ToString() + ";" + "http://25.45.62.52/CoreVises" + path.Substring(2, path.Length - 2) + "#";
            }

            return(em.encrypt(response, key));
        }
Ejemplo n.º 22
0
 public AdminBrandController()
 {
     this._unitOfWork       = new UnitOfWork(_df);
     this._brandBusiness    = new BrandBusiness(_df, this._unitOfWork);
     this._categoryBusiness = new CategoryBusiness(_df, this._unitOfWork);
 }