private void BindDrop() { int total = 0; List <Employee> list = EmployeeDAL.Getlist("销售部", 3, out total); if (list != null && list.Count > 0) { cbxemployee.DataSource = list; cbxemployee.DisplayMember = "EmpName"; cbxemployee.ValueMember = "EmpId"; } List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total); if (goodslist.Count > 0) { diclist = goodslist.ToDictionary(x => x.GoodsId); } List <Dic> dickeylist = DicDAL.Getlist("", 0, out total); if (dickeylist != null && dickeylist.Count > 0) { dickeys = dickeylist.ToDictionary(x => x.KeyId); } }
private void binddrop() { int N = 0; List <Dic> list = DicDAL.Getlist("", 2, out N); brandlist = list.Where(x => x.KeyType == "商品品牌").ToList(); unitlist = list.Where(x => x.KeyType == "商品单位").ToList(); goodtypelist = list.Where(x => x.KeyType == "商品类别").ToList(); //品牌 cbxbrand.DataSource = brandlist; cbxbrand.DisplayMember = "KeyName"; cbxbrand.ValueMember = "KeyId"; cbxbrand.SelectedIndex = 0; //单位 cbxunit.DataSource = unitlist; cbxunit.DisplayMember = "KeyName"; cbxunit.ValueMember = "KeyId"; cbxunit.SelectedIndex = 0; //类别 cbxtype.DataSource = goodtypelist; cbxtype.DisplayMember = "KeyName"; cbxtype.ValueMember = "KeyId"; cbxtype.SelectedIndex = 0; suplist = SupplierDAL.Getlist("", 30, out N); if (suplist != null && suplist.Count > 0) { cbxsuplier.DataSource = suplist; cbxsuplier.DisplayMember = "Name"; cbxsuplier.ValueMember = "SupplierId"; cbxsuplier.SelectedIndex = 0; } }
public void BinddgvData() { int N = 0; List <Dic> list = DicDAL.Getlist("", 2, out N); diclist = list.ToDictionary(x => x.KeyName); brandlist = list.Where(x => x.KeyType == "商品品牌").ToList(); unitlist = list.Where(x => x.KeyType == "商品单位").ToList(); goodtypelist = list.Where(x => x.KeyType == "商品类别").ToList(); //品牌 if (brandlist != null && brandlist.Count > 0) { dgvbrandlist.RowCount = brandlist.Count; for (int i = 0; i < brandlist.Count; i++) { dgvbrandlist[0, i].Value = brandlist[i].KeyId; dgvbrandlist[1, i].Value = brandlist[i].KeyName; dgvbrandlist[2, i].Value = brandlist[i].SortId; } } else { dgvtypelist.Rows.Clear(); } //单位 if (unitlist != null && unitlist.Count > 0) { dgvunitlist.RowCount = unitlist.Count; for (int i = 0; i < unitlist.Count; i++) { dgvunitlist[0, i].Value = unitlist[i].KeyId; dgvunitlist[1, i].Value = unitlist[i].KeyName; dgvunitlist[2, i].Value = unitlist[i].SortId; } } else { dgvtypelist.Rows.Clear(); } //类别 if (goodtypelist != null && goodtypelist.Count > 0) { dgvtypelist.RowCount = goodtypelist.Count; for (int i = 0; i < goodtypelist.Count; i++) { dgvtypelist[0, i].Value = goodtypelist[i].KeyId; dgvtypelist[1, i].Value = goodtypelist[i].KeyName; dgvtypelist[2, i].Value = goodtypelist[i].SortId; } } else { dgvtypelist.Rows.Clear(); } //清空 currmodel.KeyId = 0; }
private void initdata() { int total = 0; List <Dic> dicslist = DicDAL.Getlist("", 0, out total); if (dicslist.Count > 0) { diclist = dicslist.ToDictionary(x => x.KeyId); } List <Supplier> suplist = SupplierDAL.Getlist("", 4, out total); if (suplist != null && suplist.Count > 0) { suplierIdlist = suplist.ToDictionary(x => x.SupplierId); } }
//品牌-删 private void tsbranddelete_Click(object sender, EventArgs e) { if (dgvbrandlist.Rows.Count > 0) { string key = this.dgvbrandlist[1, this.dgvbrandlist.CurrentCell.RowIndex].Value.ToString(); currmodel = diclist[key]; if (currmodel != null) { if (MessageBox.Show("确认删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { DicDAL.DeleteEntry <Dic, long>(currmodel.KeyId); BinddgvData(); MessageBox.Show("保存成功"); } } } }
private void BindDrop() { int total = 0; List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total); if (goodslist.Count > 0) { diclist = goodslist.ToDictionary(x => x.GoodsId); } List <Dic> dickeylist = DicDAL.Getlist("", 0, out total); if (dickeylist != null && dickeylist.Count > 0) { dickeys = dickeylist.ToDictionary(x => x.KeyId); } }
//品牌-保存 private void btnbrandsave_Click(object sender, EventArgs e) { if (getvalue(txtbrandname.Text.Trim())) { currmodel.KeyName = txtbrandname.Text.Trim(); currmodel.SortId = Convert.ToInt32(updownbrand.Value); currmodel.KeyType = "商品品牌"; if (currmodel.KeyId == 0) { DicDAL.add(currmodel); } else { DicDAL.edit(currmodel); } BinddgvData(); MessageBox.Show("保存成功"); } }
private void initKeylist() { List <Dic> dickeylist = DicDAL.Getlist("", 0, out total); if (dickeylist != null && dickeylist.Count > 0) { dickeys = dickeylist.ToDictionary(x => x.KeyId); } List <Goods> goodslist = GoodsDAL.Getlist("", 0, out total); if (goodslist.Count > 0) { diclist = goodslist.ToDictionary(x => x.GoodsId); } List <Ware> wlist = WareDAL.Getlist(); if (wlist.Count > 0) { warelist = wlist.ToDictionary(x => x.WareId); } }