private void RenderGrid() { var brandBll = new BrandBll(); GridBrands.DataSource = brandBll.GetBrands(); GridBrands.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var user = (User)Session["user"]; if (user == null) { Response.Redirect("Default.aspx"); } if (!user.IsAdmin) { Response.Redirect("Default.aspx"); } var categoryBll = new CategoryBll(); var brandBll = new BrandBll(); var categories = categoryBll.GetCategories(); var brands = brandBll.GetBrands(); if (categories is null || brands is null) { Response.Redirect("Default.aspx"); } if (!IsPostBack) { brand.DataSource = brands; brand.DataBind(); category.DataSource = categories; category.DataBind(); } }
/// <summary> /// Fill controls on datagridview cell double click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvBrand_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { BrandInfo infoBrand = new BrandInfo(); BrandBll BllBrand = new BrandBll(); strBrandName = dgvBrand.CurrentRow.Cells["Column1"].Value.ToString(); if (strBrandName != "NA") { decBrandId = Convert.ToDecimal(dgvBrand.Rows[e.RowIndex].Cells["dgvtxtBrandid"].Value.ToString()); infoBrand = BllBrand.BrandView(decBrandId); txtBrandName.Text = infoBrand.BrandName; txtManufacturer.Text = infoBrand.Manufacturer; txtNarration.Text = infoBrand.Narration; btnSave.Text = "Update"; txtBrandName.Focus(); btnDelete.Enabled = true; strBrandName = infoBrand.BrandName; } else { Messages.WarningMessage("NA Brand cannot update or delete"); Clear(); } } } catch (Exception ex) { MessageBox.Show("BR19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { BrandBll BllBrand = new BrandBll(); BrandInfo infoBrand = new BrandInfo(); infoBrand.BrandName = txtBrandName.Text.Trim(); infoBrand.Narration = txtNarration.Text.Trim();; infoBrand.Manufacturer = txtManufacturer.Text.Trim(); infoBrand.ExtraDate = DateTime.Now; infoBrand.Extra1 = string.Empty; infoBrand.Extra2 = string.Empty; if (BllBrand.BrandCheckIfExist(txtBrandName.Text.Trim(), 0) == false) { decIdentity = BllBrand.BrandAdd(infoBrand); Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage("Brand name already exist"); txtBrandName.Focus(); } } catch (Exception ex) { MessageBox.Show("BR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult Merge(int ID, string BName) { BrandBll bll = new BrandBll(); ViewBag.BrandList = bll.GetEBListExceptSelf(ID, bll.GetByID(ID).EnterpriseID); return(View()); }
public string Add(Brand model) { if (ModelState.IsValid) { } model.BIMG = model.BIMG.TrimEnd("_1".ToCharArray()); model.AddTime = DateTime.Now; BrandBll bll = new BrandBll(); return bll.Add(model, Request["CIds[]"]); }
public ActionResult Edit(int ID) { BrandBll bll = new BrandBll(); ViewBag.Enterprise = new EnterpriseBll().getIDAndEName(); ViewBag.htBrandGC = bll.GetBrandGC(ID); Brand model = bll.GetByID(ID); ViewBag.BIMG = ImageHelper.GetImgUrl(model.BIMG); return View(model); }
/// <summary> /// 在售车辆 /// </summary> /// <returns></returns> public ActionResult CarOnSale() { CarOnSaleViewModel model=new CarOnSaleViewModel(); BrandBll brandBll=new BrandBll(); CarTypeBll carTypeBll=new CarTypeBll(); model.brands = brandBll.GetAllBrands(); model.carTypes = carTypeBll.GetAllCarTypes(); return View(model); }
/// <summary> /// Function to edit /// </summary> public void EditFunction() { try { BrandBll BllBrand = new BrandBll(); BrandInfo infoBrand = new BrandInfo(); infoBrand.BrandName = txtBrandName.Text.Trim(); infoBrand.Narration = txtNarration.Text.Trim(); infoBrand.Manufacturer = txtManufacturer.Text.Trim(); infoBrand.Extra1 = string.Empty; infoBrand.Extra2 = string.Empty; infoBrand.ExtraDate = DateTime.Now; infoBrand.BrandId = decBrandId; if (txtBrandName.Text != strBrandName) { if (CheckExistenceOfBrandName() == false) { if (BllBrand.BrandEdit(infoBrand)) { Messages.UpdatedMessage(); Clear(); txtBrandName.Focus(); } else if (infoBrand.BrandId == 1) { Messages.InformationMessage("Cannot update"); Clear(); txtBrandName.Focus(); } } else { Messages.InformationMessage("Brand name already exists"); txtBrandName.Focus(); } } else if (infoBrand.BrandId == 1) { Messages.InformationMessage("Cannot update"); Clear(); txtBrandName.Focus(); } else { if (BllBrand.BrandEdit(infoBrand)) { Messages.UpdatedMessage(); Clear(); } } } catch (Exception ex) { MessageBox.Show("BR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public string Add(Brand model) { if (ModelState.IsValid) { } model.BIMG = model.BIMG.TrimEnd("_1".ToCharArray()); model.AddTime = DateTime.Now; BrandBll bll = new BrandBll(); return(bll.Add(model, Request["CIds[]"])); }
public ActionResult Edit(int ID) { BrandBll bll = new BrandBll(); ViewBag.Enterprise = new EnterpriseBll().getIDAndEName(); ViewBag.htBrandGC = bll.GetBrandGC(ID); Brand model = bll.GetByID(ID); ViewBag.BIMG = ImageHelper.GetImgUrl(model.BIMG); return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { var user = (User)Session["user"]; if (user == null) { Response.Redirect("Default.aspx"); } if (!user.IsAdmin) { Response.Redirect("Default.aspx"); } if (string.IsNullOrEmpty(Request.QueryString["id"])) { Response.Redirect("Default.aspx"); } var isInt = int.TryParse(Request.QueryString["id"], out int id); if (!isInt) { Response.Redirect("Default.aspx"); } var categoryBll = new CategoryBll(); var brandBll = new BrandBll(); var productBll = new ProductBll(); var categories = categoryBll.GetCategories(); var brands = brandBll.GetBrands(); var product = productBll.GetProduct(id); if (categories is null || brands is null) { Response.Redirect("Default.aspx"); } if (!IsPostBack) { productId.Text = product.Id.ToString(); name.Text = product.Name; price.Text = product.Price.ToString(); brand.SelectedValue = product.BrandId.ToString(); category.SelectedValue = product.CategoryId.ToString(); isAvailable.Checked = product.IsAvailable; brand.DataSource = brands; brand.DataBind(); category.DataSource = categories; category.DataBind(); } }
protected void button_OnClick(object sender, EventArgs e) { var brandBll = new BrandBll(); try { brandBll.CreateBrand(name.Text); Response.Redirect("/brands"); } catch (Exception exception) { lblError.Text = exception.Message; } }
/// <summary> /// Function to fill datagridview /// </summary> public void GridFill() { try { BrandBll BllBrand = new BrandBll(); List <DataTable> listBrand = new List <DataTable>(); listBrand = BllBrand.BrandSearch(txtBrandNameSearch.Text.Trim()); dgvBrand.DataSource = listBrand[0]; } catch (Exception ex) { MessageBox.Show("BR7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult Operate(int id = 0) { ViewBag.gbId = id; //价格区间 ViewBag.isPrice = LoginUser.UserBasic.Enterprise.ISPrice; ViewBag.priceLower = LoginUser.UserBasic.Enterprise.PriceLower; ViewBag.priceUpper = LoginUser.UserBasic.Enterprise.PriceUpper; GoodsBasicBll bll = new GoodsBasicBll(); GoodsGroupBll ggBll = new GoodsGroupBll(); GoodsBasic list = new GoodsBasic(); ViewBag.gAttr = new List <Hashtable>(); ViewBag.pClass = 0; int gclassP; if (id != 0) { list = bll.GetModelByGBid(id, out gclassP, LoginUser.UserBasic.EnterpriseID); ViewBag.pClass = gclassP; if (list != null) { //商品属性 AttributesBll gavBll = new AttributesBll(); ViewBag.gAttr = gavBll.GetListByGBid(id); ////商品销售卖点 //SellPointBll spBll = new SellPointBll(); //list.SellPointList = spBll.GetListByGBid(id); //商品可视分组 list.GoodsGroupList = ggBll.GetListByGBid(id); } else { Response.Redirect("/Login/Index"); return(Content("此商品不存在")); } } //有货状态 SelectLists sList = new SelectLists(); ViewBag.ISNormal = new SelectList(sList.GetGBISNormal(), "value", "text", list.ISNormal); //价格模式 ViewBag.RType = new SelectList(sList.GetGBRType(), "value", "text", list.RType); //可视分组 ViewBag.gGroupList = ggBll.GetGGList(LoginUser.UserBasic.EnterpriseID); //所属品牌 BrandBll bBll = new BrandBll(); ViewBag.BrandID = new SelectList(bBll.GetEBList(LoginUser.UserBasic.EnterpriseID), "ID", "BName", list.BrandID); return(View(list)); }
protected void search_OnClick(object sender, EventArgs e) { var brandBll = new BrandBll(); try { GridBrands.DataSource = brandBll.SearchBrands(searchTerm.Text); GridBrands.DataBind(); } catch (Exception exception) { error.InnerText = exception.Message; } }
public ActionResult AddProduct() { ICategoryBll _categoryBll = new CategoryBll(new CategoryDal()); IBrandBll _brandBll = new BrandBll(new BrandDal()); //todo kategoriler parent-child kategoriye çevrilince düzenlenecek. AddProductModel addProduct = new AddProductModel { Brands = _brandBll.ListThem(), Categories = _categoryBll.ListThem() }; return(View(addProduct)); }
/// <summary> /// Function to fill Brand combobox /// </summary> public void BrandComboFill() { try { List <DataTable> listBrand = new List <DataTable>(); BrandBll BllBrand = new BrandBll(); listBrand = BllBrand.BrandViewAll(); DataRow dr = listBrand[0].NewRow(); dr["brandName"] = "All"; dr["brandId"] = 0; listBrand[0].Rows.InsertAt(dr, 0); cmbBrand.DataSource = listBrand[0]; cmbBrand.DisplayMember = "brandName"; cmbBrand.ValueMember = "brandId"; } catch (Exception ex) { MessageBox.Show("ST:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete /// </summary> public void DeleteFunction() { try { BrandBll BllBrand = new BrandBll(); if (BllBrand.BrandDeleteCheckExistence(decBrandId) <= 0) { Messages.ReferenceExistsMessage(); } else { Clear(); btnSave.Text = "Save"; Messages.DeletedMessage(); } } catch (Exception ex) { MessageBox.Show("BR6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void button_OnClick(object sender, EventArgs e) { var brandBll = new BrandBll(); var isInt = int.TryParse(brandId.Text, out int id); if (!isInt) { Response.Redirect("Brands.aspx"); } try { brandBll.EditBrand(id, name.Text); Response.Redirect("Brands.aspx"); } catch (Exception exception) { lblError.Text = exception.Message; } }
protected void Page_Load(object sender, EventArgs e) { var user = (User)Session["user"]; if (user == null) { Response.Redirect("Brands.aspx"); } if (!user.IsAdmin) { Response.Redirect("Brands.aspx"); } if (Page.IsPostBack) { return; } if (string.IsNullOrEmpty(Request.QueryString["id"])) { Response.Redirect("Brands.aspx"); } var isInt = int.TryParse(Request.QueryString["id"], out int id); if (!isInt) { Response.Redirect("Brands.aspx"); } var brandBll = new BrandBll(); var brand = brandBll.GetBrand(id); if (brand is null) { Response.Redirect("Brands.aspx"); } brandId.Text = brand.Id.ToString(); name.Text = brand.Name; }
/// <summary> /// Function to check existence of brand name /// </summary> /// <returns></returns> public bool CheckExistenceOfBrandName() { bool isExist = false; try { BrandBll BllBrand = new BrandBll(); isExist = BllBrand.BrandCheckIfExist(txtBrandName.Text.Trim(), 0); if (isExist) { string strBrandNames = txtBrandName.Text.Trim(); if (strBrandNames.ToLower() == strBrandName.ToLower()) { isExist = false; } } } catch (Exception ex) { MessageBox.Show("BR8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isExist); }
protected void orderByName_OnClick(object sender, EventArgs e) { var brandBll = new BrandBll(); var orderName = (string)Session["orderName"]; var brands = brandBll.SearchBrands(searchTerm.Text); if (orderName == "desc") { orderName = "asc"; brands = brands.OrderBy(p => p.Name).ToList(); } else { orderName = "desc"; brands = brands.OrderByDescending(p => p.Name).ToList(); } Session["orderName"] = orderName; GridBrands.DataSource = brands; GridBrands.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { User user = (User)Session["user"]; if (!string.IsNullOrEmpty(Request.QueryString["Delete"]) && (User)Session["user"] != null && ((User)Session["user"]).IsAdmin) { var isInt = int.TryParse(Request.QueryString["Delete"], out int id); if (isInt) { var brandBll = new BrandBll(); try { brandBll.DeleteBrand(id); Response.Redirect("Brands.aspx"); } catch (Exception exception) { error.InnerText = exception.Message; } } } RenderGrid(); }
public ActionResult Operate(int id = 0) { ViewBag.gbId = id; //价格区间 ViewBag.isPrice = LoginUser.UserBasic.Enterprise.ISPrice; ViewBag.priceLower = LoginUser.UserBasic.Enterprise.PriceLower; ViewBag.priceUpper = LoginUser.UserBasic.Enterprise.PriceUpper; GoodsBasicBll bll = new GoodsBasicBll(); GoodsGroupBll ggBll = new GoodsGroupBll(); GoodsBasic list = new GoodsBasic(); ViewBag.gAttr = new List<Hashtable>(); ViewBag.pClass = 0; int gclassP; if (id != 0) { list = bll.GetModelByGBid(id, out gclassP, LoginUser.UserBasic.EnterpriseID); ViewBag.pClass = gclassP; if (list != null) { //商品属性 AttributesBll gavBll = new AttributesBll(); ViewBag.gAttr = gavBll.GetListByGBid(id); ////商品销售卖点 //SellPointBll spBll = new SellPointBll(); //list.SellPointList = spBll.GetListByGBid(id); //商品可视分组 list.GoodsGroupList = ggBll.GetListByGBid(id); } else { Response.Redirect("/Login/Index"); return Content("此商品不存在"); } } //有货状态 SelectLists sList = new SelectLists(); ViewBag.ISNormal = new SelectList(sList.GetGBISNormal(), "value", "text", list.ISNormal); //价格模式 ViewBag.RType = new SelectList(sList.GetGBRType(), "value", "text", list.RType); //可视分组 ViewBag.gGroupList = ggBll.GetGGList(LoginUser.UserBasic.EnterpriseID); //所属品牌 BrandBll bBll = new BrandBll(); ViewBag.BrandID = new SelectList(bBll.GetEBList(LoginUser.UserBasic.EnterpriseID), "ID", "BName", list.BrandID); return View(list); }
public ActionResult Merge(int ID, int NewID) { BrandBll bll = new BrandBll(); return(Json(bll.Merge(ID, NewID))); }
public ActionResult Merge(int ID,string BName) { BrandBll bll = new BrandBll(); ViewBag.BrandList = bll.GetEBListExceptSelf(ID,bll.GetByID(ID).EnterpriseID); return View(); }
public ActionResult Merge(int ID, int NewID) { BrandBll bll = new BrandBll(); return Json(bll.Merge(ID,NewID)); }