public bool Add(SupplierBrandModel brandinfo) { var sql = @"INSERT INTO SupplierBrand (SupplierId,NameCN,NameHK,NameEN,Logo,Banner,IntroductionCN,IntroductionHK,IntroductionEN,CountryId,CountryName,CategoryId,CategoryName,CreateTime,Status) VALUES (@SupplierId,@NameCN,@NameHK,@NameEN,@Logo,@Banner,@IntroductionCN,@IntroductionHK,@IntroductionEN,@CountryId,@CountryName,@CategoryId,@CategoryName,@CreateTime,@Status)"; var db = DbSFO2OMain; var parameters = db.CreateParameterCollection(); parameters.Append("SupplierId", brandinfo.SupplierId); parameters.Append("NameCN", brandinfo.NameCN); parameters.Append("NameHK", brandinfo.NameHK); parameters.Append("NameEN", brandinfo.NameEN); parameters.Append("Logo", brandinfo.Logo); parameters.Append("Banner", brandinfo.Banner); parameters.Append("IntroductionCN", brandinfo.IntroductionCN); parameters.Append("IntroductionHK", brandinfo.IntroductionHK); parameters.Append("IntroductionEN", brandinfo.IntroductionEN); parameters.Append("CountryId", brandinfo.CountryId); parameters.Append("CountryName", brandinfo.CountryName); parameters.Append("CategoryId", brandinfo.CategoryId); parameters.Append("CategoryName", brandinfo.CategoryName); parameters.Append("CreateTime", DateTime.Now); parameters.Append("Status", 1); return((int)db.ExecuteSqlNonQuery(sql, parameters) > 0); }
public JsonResult SaveBrand(string brand) { try { var result = false; SupplierBrandBLL brandBLL = new SupplierBrandBLL(); SupplierBrandModel brandinfo = JsonHelper.ToObject <SupplierBrandModel>(brand); brandinfo.SupplierId = CurrentUser.SupplierID; if (brandinfo.Id > 0) { result = brandBLL.UpdateById(brandinfo); } else { result = brandBLL.Add(brandinfo); } return(Json(new { result = result, msg = "" })); } catch (Exception ex) { LogHelper.Error(ex); return(Json(new { result = false, msg = "" })); } }
public ActionResult BrandEdit(int brandId = 0) { try { SupplierBrandModel model = new SupplierBrandModel(); SupplierBrandBLL supplierBLL = new SupplierBrandBLL(); if (brandId > 0) { ViewBag.Operation = "edit"; model = supplierBLL.GetBrandById(brandId); } else { ViewBag.Operation = "add"; } ViewBag.FirstCategory = CategoryBLL.GetFristLevelCategories(LanguageEnum.TraditionalChinese); ViewBag.Country = CommonBLL.GetDicsInfoByKey("CountryOfManufacture"); ViewBag.Brand = model; return(View(model)); } catch (Exception ex) { LogHelper.Error(ex); } return(View()); }
public bool UpdateById(SupplierBrandModel brandinfo) { var sql = @"UPDATE SupplierBrand SET NameCN = @NameCN ,NameHK = @NameHK ,NameEN = @NameEN ,Logo = @Logo ,Banner = @Banner ,IntroductionCN = @IntroductionCN ,IntroductionHK = @IntroductionHK ,IntroductionEN = @IntroductionEN ,CountryId = @CountryId ,CountryName = @CountryName ,CategoryId = @CategoryId ,CategoryName = @CategoryName WHERE Id=@Id "; var db = DbSFO2OMain; var parameters = db.CreateParameterCollection(); parameters.Append("SupplierId", brandinfo.SupplierId); parameters.Append("NameCN", brandinfo.NameCN); parameters.Append("NameHK", brandinfo.NameHK); parameters.Append("NameEN", brandinfo.NameEN); parameters.Append("Logo", brandinfo.Logo); parameters.Append("Banner", brandinfo.Banner); parameters.Append("IntroductionCN", brandinfo.IntroductionCN); parameters.Append("IntroductionHK", brandinfo.IntroductionHK); parameters.Append("IntroductionEN", brandinfo.IntroductionEN); parameters.Append("CountryId", brandinfo.CountryId); parameters.Append("CountryName", brandinfo.CountryName); parameters.Append("CategoryId", brandinfo.CategoryId); parameters.Append("CategoryName", brandinfo.CategoryName); parameters.Append("Id", brandinfo.Id); return((int)db.ExecuteSqlNonQuery(sql, parameters) > 0); }
public ActionResult BrandView(int brandId = 0) { try { SupplierBrandModel model = new SupplierBrandModel(); SupplierBrandBLL supplierBLL = new SupplierBrandBLL(); model = supplierBLL.GetBrandById(brandId); var page = new PageDTO() { PageIndex = PageNo, PageSize = int.MaxValue }; PageOf <StoreModel> storeList = supplierBLL.GetStoreListByBrandId(brandId, 0, LanguageEnum.TraditionalChinese, page); ViewBag.Brand = model; ViewBag.StoreList = storeList; return(View()); } catch (Exception ex) { LogHelper.Error(ex); } return(View()); }
public bool Add(SupplierBrandModel brandinfo) { return(dal.Add(brandinfo)); }
public bool UpdateById(SupplierBrandModel brandinfo) { return(dal.UpdateById(brandinfo)); }