/// <summary> /// 删除类别 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { if (this.lv.SelectedItems.Count == 0) { MessageBox.Show("还没选择项"); } else { DialogResult dr = MessageBox.Show(this, "确定要删除该条数据吗?", "删除提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { string id = this.lv.SelectedItems[0].Text; bool b = ProductTypeBLL.database(id); if (b == true) { MessageBox.Show("删除成功"); this.lv.Items.Clear(); sx(); } else { MessageBox.Show("删除失败"); } } } }
//刷新 private void sx() { List <ProductType> list = ProductTypeBLL.selectall(); ProductType p = new ProductType(); p.id = 0; p.name = "全部"; list.Add(p); list.Reverse(); this.cbotype.DisplayMember = "name"; this.cbotype.ValueMember = "id"; this.cbotype.DataSource = list; // 显示白道一 foreach (var item in list) { if (item.id != 0) { ListViewItem lvi = new ListViewItem(item.id.ToString()); if (item.id != 0) { lvi.SubItems.Add(item.name); } this.lv.Items.Add(lvi); } } }
private void button1_Click(object sender, EventArgs e) { if (this.txtname.Text == "") { MessageBox.Show("未插入数据"); } ///修改类别 // MessageBox.Show(Comm.TypeID); else { string name = this.txtname.Text; // Comm.TypeID; string id = Comm.TypeID; bool b = ProductTypeBLL.update(id, name); if (b == true) { MessageBox.Show("修改成功"); this.Close(); } else { MessageBox.Show("修改失败"); } } }
/// <summary> /// 页面加载方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int attributeClassID = RequestHelper.GetQueryString <int>("ID"); pageAttr = ProductTypeBLL.Read(attributeClassID); if (attributeClassID != int.MinValue) { CheckAdminPower("ReadProductType", PowerCheckType.Single); ProductTypeInfo productType = ProductTypeBLL.Read(attributeClassID); Name.Text = productType.Name; Repeater1.DataSource = ProductTypeAttributeBLL.ReadList(attributeClassID); Repeater1.DataBind(); Repeater2.DataSource = ProductTypeStandardBLL.ReadList(attributeClassID); Repeater2.DataBind(); } if (RequestHelper.GetQueryString <string>("Action") == "GetBrandsByFirstLetter") { GetBrandsByFirstLetter(); } } }
public ActionResult CadastrarProdutoTipo(ProductType produto) { if (Request.IsAjaxRequest()) { if (ModelState.IsValid) { try { if (ProductTypeBLL.Add(produto)) { return(Json(JsonRequestBehavior.AllowGet)); } else { Response.StatusCode = 500; return(PartialView("Error")); } } catch { Response.StatusCode = 401; return(PartialView("Error")); } } } Response.StatusCode = 401; return(PartialView("Error")); }
public ActionResult AlterarDisponibilidadeTipo(string id, bool checkOrNot) { if (Request.IsAjaxRequest()) { if (!string.IsNullOrEmpty(id)) { if (ProductTypeBLL.UpdateStateById(id, checkOrNot)) { return(Json(checkOrNot, JsonRequestBehavior.AllowGet)); } else { Response.StatusCode = 500; return(PartialView("Error")); } } else { Response.StatusCode = 401; return(PartialView("Error")); } } Response.StatusCode = 401; return(PartialView("Error")); }
public IHttpActionResult DelProductType(RequestDelProductType request) { var tokenResult = IdentityValid.ValidateToken(request.Token); if (!tokenResult.IsSuccess) { return(Json(tokenResult)); } var productTypeBll = new ProductTypeBLL(); var productBll = new ProductBLL(); if (productBll.IsExist(o => o.UserName == tokenResult.userName && o.ProductTypeId == request.ProductTypeId)) { return(Json(new ResponseMsg() { IsSuccess = false, Msg = "该物品类别下有物品,不可删除!" })); } if (productTypeBll.IsExist(o => o.ParentProductTypeId == request.ProductTypeId)) { return(Json(new ResponseMsg() { IsSuccess = false, Msg = "请先删除子类别!" })); } bool isSuccess = productTypeBll.Delete(o => o.UserName == tokenResult.userName && o.ProductTypeId == request.ProductTypeId); return(Json(new ResponseMsg() { IsSuccess = isSuccess })); }
private void panel3_VisibleChanged(object sender, EventArgs e) { List <ProductTypeMDL> list = ProductTypeBLL.selectProductType(); dataGridView1.DataSource = list; List <ProductsMDL> list_cm = ProductsBLL.selectProducts(0, ""); dataGridView2.AutoGenerateColumns = false; dataGridView2.DataSource = list_cm; dataGridView2.Columns[3].Visible = false; dataGridView2.Columns[4].Visible = false; dataGridView2.Columns[5].Visible = false; dataGridView2.Columns[6].Visible = false; dataGridView2.Columns[7].Visible = false; List <ProductTypeMDL> list1 = ProductTypeBLL.selectProductType(); list1.Insert(0, (new ProductTypeMDL { PTID = 0, PTName = "全部" })); comboBox2.DisplayMember = "PTName"; comboBox2.ValueMember = "PTID"; comboBox2.DataSource = list1; }
private void 定套餐_Load(object sender, EventArgs e) { //查询所有商品 List <ProductsMDL> list_cm = ProductsBLL.selectProduct(""); dataGridView2.AutoGenerateColumns = false; dataGridView2.DataSource = list_cm; dataGridView2.Columns[2].Visible = false; dataGridView2.Columns[3].Visible = false; dataGridView2.Columns[4].Visible = false; List <ProductTypeMDL> list_PR = ProductTypeBLL.selectProductType(); foreach (var item in list_PR) { TreeNode tr = new TreeNode(); tr.Text = item.PTName; tr.Tag = item.PTID; List <ProductsMDL> list_P = ProductsBLL.selectProducts(item.PTID, ""); foreach (ProductsMDL item_P in list_P) { TreeNode tr_P = new TreeNode(); tr_P.Text = item_P.ProductName; tr_P.Tag = item_P.ProductID; tr_P.Name = item_P.ProductPrice.ToString(); tr.Nodes.Add(tr_P); } treeView1.Nodes.Add(tr); } }
public void GetProductType() { var ProductType = PostDataToModel(); var bll = new ProductTypeBLL(); var data = bll.Get(ProductType); Write(data); }
/// <summary> /// 页面加载方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckAdminPower("ReadProductType", PowerCheckType.Single); BindControl(ProductTypeBLL.ReadList(), RecordList); } }
private void FrmProductsT_Load(object sender, EventArgs e) { List <ProductType> list = ProductTypeBLL.selectall(); this.cbotype.DisplayMember = "name"; this.cbotype.ValueMember = "id"; this.cbotype.DataSource = list; }
private void FrmAddConsumer_Load(object sender, EventArgs e) { lbl_CBID.Text = TablesBLL.GetCBID(TableID); lbl_TBID.Text = TableName; //查询所有商品 List <ProductsMDL> list_cm = ProductsBLL.selectProduct(""); dataGridView2.AutoGenerateColumns = false; dataGridView2.DataSource = list_cm; dataGridView2.Columns[2].Visible = false; dataGridView2.Columns[3].Visible = false; dataGridView2.Columns[4].Visible = false; //查询菜单 List <ConsumerDetails> list = ConsumerDetailsBLL.GetCD(TableID); foreach (ConsumerDetails item in list) { ListViewItem lvi = new ListViewItem(item.ProductName); lvi.SubItems.Add(item.ProductPrice.ToString()); lvi.SubItems.Add(item.CDAmount.ToString()); lvi.SubItems.Add(item.CBJE.ToString()); lvi.SubItems.Add(item.CBDate); lvi.Tag = item.ProductID; listView1.Items.Add(lvi); } foreach (ConsumerDetails item in list) { price += item.CBJE; } label10.Text = price.ToString(); //加载treeview数据 List <ProductTypeMDL> list_PR = ProductTypeBLL.selectProductType(); foreach (var item in list_PR) { TreeNode tr = new TreeNode(); tr.Text = item.PTName; tr.Tag = item.PTID; List <ProductsMDL> list_P = ProductsBLL.selectProducts(item.PTID, ""); foreach (ProductsMDL item_P in list_P) { TreeNode tr_P = new TreeNode(); tr_P.Text = item_P.ProductName; tr_P.Tag = item_P.ProductID; tr_P.Name = item_P.ProductPrice.ToString(); tr.Nodes.Add(tr_P); } treeView1.Nodes.Add(tr); } label9.Text = listView1.Items.Count.ToString(); label11.Text = dataGridView2.SelectedRows[0].Cells[0].Value.ToString(); }
public ActionResult TypeProductsJson() { if (Request.IsAjaxRequest()) { return(Json(ProductTypeBLL.ProductTypeValues(), JsonRequestBehavior.AllowGet)); } else { Response.StatusCode = 401; return(PartialView("Error")); } }
/// <summary> /// 删除按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DeleteButton_Click(object sender, EventArgs e) { CheckAdminPower("DeleteProductType", PowerCheckType.Single); string deleteID = RequestHelper.GetIntsForm("SelectID"); if (deleteID != string.Empty) { ProductTypeBLL.DeleteList(deleteID); AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("AttributeClass"), deleteID); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl); } }
public ActionResult EditTypeProducts(string type_product) { try { ViewBag.ProductTypeToEdit = ProductTypeBLL.ProductTypeValues().Find(x => x.Id == type_product); return(View()); } catch { return(PartialView("Error")); } }
public ActionResult TypeProductsJsonById(string id) { //Debug.WriteLine("Ok"); if (Request.IsAjaxRequest()) { return(Json(ProductTypeBLL.TypeById(id), JsonRequestBehavior.AllowGet)); } else { Response.StatusCode = 401; return(PartialView("Error")); } }
/// <summary> /// 根据首字符筛选品牌 /// </summary> protected void GetBrandsByFirstLetter() { string firstLetter = RequestHelper.GetQueryString <string>("FirstLetter"); string _html = string.Empty; int attributeClassID = RequestHelper.GetQueryString <int>("ID"); pageAttr = ProductTypeBLL.Read(attributeClassID); List <ProductBrandInfo> proBrandList = new List <ProductBrandInfo>(); if (!string.IsNullOrEmpty(firstLetter)) { if (firstLetter == "+") {//其他,不是以字母开头的 Regex regChar = new Regex("^[a-z]"); Regex regDChar = new Regex("^[A-Z]"); proBrandList = ProductBrandBLL.ReadList().Where(k => !regChar.IsMatch(k.Spelling)).Where(k => !regDChar.IsMatch(k.Spelling)).OrderBy(k => k.Spelling).ToList(); } else {//以字母开头的 proBrandList = ProductBrandBLL.ReadList().Where(k => k.Spelling.ToLower().StartsWith(firstLetter.ToLower())).OrderBy(k => k.Spelling).ToList(); } foreach (ProductBrandInfo proBrand in proBrandList) { if (!string.IsNullOrEmpty(pageAttr.BrandIds)) { string brands = ";" + pageAttr.BrandIds + ";"; if (brands.IndexOf(";" + proBrand.Id.ToString() + ";") >= 0) { _html += "<label class=\"ig-checkbox checked\"><input type=\"checkbox\" checked=\"checked\" name=\"proBrand\" value=\"" + proBrand.Id + "\" onclick=\"chooseBrand(this,'" + proBrand.Name + "')\"/>" + proBrand.Name + "</label>"; } else { _html += " <label class=\"ig-checkbox\" ><input type=\"checkbox\" name=\"proBrand\" value=\"" + proBrand.Id + "\" onclick=\"chooseBrand(this,'" + proBrand.Name + "')\"/>" + proBrand.Name + "</label>"; } } else { _html += "<label class=\"ig-checkbox\"><input type=\"checkbox\" name=\"proBrand\" value=\"" + proBrand.Id + "\" onclick=\"chooseBrand(this,'" + proBrand.Name + "')\"/>" + proBrand.Name + "</label>"; } } Response.Clear(); ResponseHelper.Write(JsonConvert.SerializeObject(new { flag = true, content = _html })); } else { Response.Clear(); ResponseHelper.Write(JsonConvert.SerializeObject(new { flag = false, content = _html })); } Response.End(); }
private void FrmProducts_Load(object sender, EventArgs e) { string id = Comm.ProductID; this.txtjp.Text = Comm.ProductJP; this.txtname.Text = Comm.ProductName; this.txtprice.Text = Comm.ProductPrice; List <ProductType> list = ProductTypeBLL.selectall(); this.cbotype.DisplayMember = "name"; this.cbotype.ValueMember = "id"; this.cbotype.DataSource = list; }
/// <summary> /// 页面加载方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { FatherID.DataSource = ProductClassBLL.ReadNamedList(); FatherID.DataTextField = "Name"; FatherID.DataValueField = "ID"; FatherID.DataBind(); FatherID.Items.Insert(0, new ListItem("作为最大类", "0")); //foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList()) //{ // FatherID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|")); //} //FatherID.Items.Insert(0, new ListItem("作为最大类", "0")); ProductType.DataSource = ProductTypeBLL.ReadList(); ProductType.DataTextField = "Name"; ProductType.DataValueField = "ID"; ProductType.DataBind(); ProductType.Items.Insert(0, new ListItem("请选择类型", "0")); int productClassID = RequestHelper.GetQueryString <int>("ID"); int fatherID = RequestHelper.GetQueryString <int>("FatherID"); if (productClassID != int.MinValue) { CheckAdminPower("ReadProductClass", PowerCheckType.Single); ProductClassInfo productClass = ProductClassBLL.Read(productClassID); FatherID.Text = productClass.ParentId.ToString(); OrderID.Text = productClass.OrderId.ToString(); ClassName.Text = productClass.Name; Keywords.Text = productClass.Keywords; Description.Value = productClass.Remark; Photo.Text = productClass.Photo; ProductType.Text = productClass.ProductTypeId.ToString(); EnClassName.Text = productClass.EnClassName; PageTitle.Text = productClass.PageTitle; PageKeyWord.Text = productClass.PageKeyWord; PageSummary.Text = productClass.PageSummary; } else { FatherID.Text = fatherID.ToString(); } } }
private void button11_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count <= 0) { new Warning("请选择一行数据进行删除", 图标.Erro).Show(); return; } //删除 DialogResult d = MessageBox.Show("是否确认删除", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { List <ProductsMDL> listP = ProductsBLL.selectProducts(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value), ""); if (listP.Count > 0) { new Warning("请先移除此类型下的商品", 图标.Erro).Show(); return; } ProductTypeMDL p = new ProductTypeMDL(); p.PTID = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value); if (ProductTypeBLL.DeleteProductType(p) > 0) { new Warning("删除成功", 图标.Yes).Show(); List <ProductTypeMDL> list = ProductTypeBLL.selectProductType(); dataGridView1.DataSource = list; List <ProductTypeMDL> list1 = ProductTypeBLL.selectProductType(); list1.Insert(0, (new ProductTypeMDL { PTID = 0, PTName = "全部" })); comboBox2.DisplayMember = "PTName"; comboBox2.ValueMember = "PTID"; comboBox2.DataSource = list1; } else { MessageBox.Show("删除失败"); } } }
public IHttpActionResult GetProductType(RequestGetProductType request) { var tokenResult = IdentityValid.ValidateToken(request.Token); if (!tokenResult.IsSuccess) { return(Json(tokenResult)); } var bll = new ProductTypeBLL(); var entity = bll.LoadAll(o => o.UserName == tokenResult.userName); //if (request.ParentProductTypeId > 0) //{ // entity = entity.Where(o => o.ParentProductTypeId == request.ParentProductTypeId); //} return(Json <List <ProductType> >(entity.ToList())); }
protected void Page_Load(object sender, EventArgs e) { ClearCache(); int attributeClassID = RequestHelper.GetQueryString <int>("AttributeClassID"); int proTypeID = ProductClassBLL.GetProductClassType(attributeClassID); ProductTypeInfo aci = ProductTypeBLL.Read(proTypeID); if (aci.Id > 0) { string[] strArr = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); int[] intArr = Array.ConvertAll <string, int>(strArr, s => int.Parse(s)); productBrandList = ProductBrandBLL.ReadList(intArr); } }
private void button13_Click(object sender, EventArgs e) { //1,修改 2,删除 Product.type = 1; new FrmEditPT().ShowDialog(); List <ProductTypeMDL> list = ProductTypeBLL.selectProductType(); dataGridView1.DataSource = list; List <ProductTypeMDL> list1 = ProductTypeBLL.selectProductType(); list1.Insert(0, (new ProductTypeMDL { PTID = 0, PTName = "全部" })); comboBox2.DisplayMember = "PTName"; comboBox2.ValueMember = "PTID"; comboBox2.DataSource = list1; }
/// <summary> /// 显示当前用户 /// </summary> /// <returns></returns> public string UserShow() { ProductTypeBLL ptb = new ProductTypeBLL(); string userName = userInfo.User.userName; DataTable dtPersion = ptb.GetPersonaIdByUserName(userName); //通过当前用户查找当前用户所属角色 string Name = dtPersion.Rows[0][1].ToString(); //用户名 string persionName = ptb.GetPersionNameByid(dtPersion.Rows[0][0].ToString()); int thistime = DateTime.Now.Hour; string greeting = ""; if (thistime > 0 && thistime < 12) { greeting = "上午好!@_@"; } else { greeting = "下午好!@_@"; } return(userName + "❤" + Name + "❤" + persionName + "❤" + greeting); }
private void button12_Click(object sender, EventArgs e) { Product.type = 2; Product.ID = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); Product.name = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); new FrmEditPT().ShowDialog(); List <ProductTypeMDL> list = ProductTypeBLL.selectProductType(); dataGridView1.DataSource = list; List <ProductTypeMDL> list1 = ProductTypeBLL.selectProductType(); list1.Insert(0, (new ProductTypeMDL { PTID = 0, PTName = "全部" })); comboBox2.DisplayMember = "PTName"; comboBox2.ValueMember = "PTID"; comboBox2.DataSource = list1; }
private void FrmEditProduct_Load(object sender, EventArgs e) { //高级绑定 List <ProductTypeMDL> list1 = ProductTypeBLL.selectProductType(); comboBox1.DisplayMember = "PTName"; comboBox1.ValueMember = "PTID"; comboBox1.DataSource = list1; OpenType = EditProduct.OpenType; if (OpenType == 1) { this.Text = "增加商品"; label7.Text = "增加商品"; } else { this.Text = "修改商品信息"; label7.Text = "修改商品信息"; comboBox1.SelectedValue = EditProduct.ShopType; textBox1.Text = EditProduct.ShopName; textBox2.Text = EditProduct.ShopJP; textBox3.Text = EditProduct.ShopPrice.ToString(); textBox4.Text = EditProduct.ProductJs; if (EditProduct.ShopPIC == "") { pictureBox1.Image = Image.FromFile(path); return; } path = EditProduct.ShopPIC; try { pictureBox1.Image = Image.FromFile(path); } catch (Exception) { pictureBox1.Image = Image.FromFile("add.jpg"); } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Trim().Length <= 0) { new Warning("请输入类型名称", 图标.Erro).Show(); return; } try { //执行添加 if (type == 1) { this.Text = "添加商品类型"; ProductTypeMDL p = new ProductTypeMDL(); p.PTName = textBox1.Text; int count = ProductTypeBLL.AddProductType(p); if (count > 0) { this.Close(); } } //执行修改 else { this.Text = "修改商品类型"; ProductTypeMDL p = new ProductTypeMDL(); p.PTName = textBox1.Text; p.PTID = Convert.ToInt32(Product.ID); int count = ProductTypeBLL.AlterProductType(p); if (count > 0) { this.Close(); } } } catch (Exception) { MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private IHttpActionResult AddProduct(RequestAddProduct request) { var tokenResult = IdentityValid.ValidateToken(request.Token); if (!tokenResult.IsSuccess) { return(Json(tokenResult)); } var productbll = new ProductBLL(); var productTypebll = new ProductTypeBLL(); var productTypeModel = productTypebll.Get(o => o.ProductTypeName == request.ProductTypeName && o.UserName == tokenResult.userName); if (productTypeModel == null) { productTypebll.Save(new ProductType { ParentProductTypeId = 0, UserName = tokenResult.userName, ProductTypeName = request.ProductTypeName }); productTypeModel = productTypebll.Get(o => o.ProductTypeName == request.ProductTypeName && o.UserName == tokenResult.userName); } var product = new Product() { UserName = tokenResult.userName, Introduce = request.Introduce, ProductImgUrl = request.ProductImgUrl, ProductName = request.ProductName, ProductTypeId = productTypeModel.ProductTypeId, Remark = request.Remark }; bool isSuccess = productbll.Save(product); return(Ok(new ResponseMsg() { IsSuccess = isSuccess })); }
public IHttpActionResult AddProductType(RequestAddProductType request) { var tokenResult = IdentityValid.ValidateToken(request.Token); if (!tokenResult.IsSuccess) { return(Json(tokenResult)); } var bll = new ProductTypeBLL(); var productType = new ProductType() { UserName = tokenResult.userName, ParentProductTypeId = request.ParentProductTypeId, ProductTypeName = request.ProductTypeName }; bool isSuccess = bll.Save(productType); return(Json(new ResponseMsg() { IsSuccess = isSuccess })); }