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()); }
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"); }
public static Brand ConvertToDataEntity(BrandBusiness brand) { var dataObject = new Brand(brand.Name); dataObject.Models = (ICollection <Model>)brand.Models; return(dataObject); }
/// <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); }
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); }
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(); }
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)); }
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); }
// // 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); }
public ActionResult Xoa(string Id) { BrandBusiness brandBusiness = new BrandBusiness(); bool ketQua = brandBusiness.XoaBrand(Id); if (ketQua) { return(RedirectToAction("Index")); } return(View()); }
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); }
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)); }
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)); }
// 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); }
// 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); }
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"); } }
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)); }
public AdminBrandController() { this._unitOfWork = new UnitOfWork(_df); this._brandBusiness = new BrandBusiness(_df, this._unitOfWork); this._categoryBusiness = new CategoryBusiness(_df, this._unitOfWork); }