protected void bt_Add_Click(object sender, EventArgs e) { int count = 0; foreach (GridViewRow row in gv_List.Rows) { CheckBox cbx = (CheckBox)row.FindControl("cbx"); if (cbx != null && cbx.Checked) { int id = (int)gv_List.DataKeys[row.RowIndex]["PDT_Product_ID"]; PDT_ProductBLL bll = new PDT_ProductBLL(id); PDT_ProductExtInfo extinfo = new PDT_ProductExtInfo(); extinfo.Code = bll.Model.FactoryCode == "" ? bll.Model.Code : bll.Model.FactoryCode; extinfo.Supplier = (int)Session["OwnerClient"]; bll.SetProductExtInfo(extinfo); count++; } } if (count > 0) { MessageBox.Show(this, string.Format("成功将{0}个商品加入经营范围!", count)); cbx_CheckAll.Checked = false; BindGrid(); } else { MessageBox.Show(this, "请选择要加入经营产商品!"); } }
protected void bt_Add_Click(object sender, EventArgs e) { int count = 0; foreach (GridViewRow row in gv_List.Rows) { CheckBox cbx = (CheckBox)row.FindControl("cbx"); if (cbx != null && cbx.Checked) { int id = (int)gv_List.DataKeys[row.RowIndex]["PDT_Product_ID"]; PDT_ProductBLL bll = new PDT_ProductBLL(id); PDT_ProductExtInfo extinfo = new PDT_ProductExtInfo(); extinfo.Code = bll.Model.FactoryCode == "" ? bll.Model.Code : bll.Model.FactoryCode; extinfo.Supplier = (int)Session["OwnerClient"]; bll.SetProductExtInfo(extinfo); count++; } } if (count > 0) { MessageBox.Show(this, string.Format("成功将{0}个商品加入经营范围!", count)); cbx_CheckAll.Checked = false; BindGrid(); } else MessageBox.Show(this, "请选择要加入经营产商品!"); }
protected void bt_AddAll_Click(object sender, EventArgs e) { string ConditionStr = " PDT_Product.ID NOT IN (SELECT Product FROM MCS_PUB.dbo.PDT_ProductExtInfo WHERE Supplier=" + Session["OwnerClient"].ToString() + ")"; if (tr_List.SelectedValue != "" && tr_List.SelectedValue != "1") { string _categoryids = ""; DataTable dt = TreeTableBLL.GetAllChildByNodes("MCS_Pub.dbo.PDT_Category", "ID", "SuperID", tr_List.SelectedValue); for (int i = 0; i < dt.Rows.Count; i++) { _categoryids += dt.Rows[i]["ID"].ToString() + ","; } _categoryids += tr_List.SelectedValue; ConditionStr += " AND PDT_Product.Category IN (" + _categoryids + ")"; } int count = 0; IList <PDT_Product> product = PDT_ProductBLL.GetModelList(ConditionStr); foreach (PDT_Product p in product) { int id = p.ID; PDT_ProductBLL bll = new PDT_ProductBLL(id); PDT_ProductExtInfo extinfo = new PDT_ProductExtInfo(); extinfo.Code = bll.Model.FactoryCode == "" ? bll.Model.Code : bll.Model.FactoryCode; extinfo.Supplier = (int)Session["OwnerClient"]; bll.SetProductExtInfo(extinfo); count++; } if (count > 0) { MessageBox.Show(this, string.Format("成功将{0}个商品加入经营范围!", count)); BindGrid(); } else { MessageBox.Show(this, "请选择要加入经营产商品!"); } }
protected void bt_AddAll_Click(object sender, EventArgs e) { string ConditionStr = " PDT_Product.ID NOT IN (SELECT Product FROM MCS_PUB.dbo.PDT_ProductExtInfo WHERE Supplier=" + Session["OwnerClient"].ToString() + ")"; if (tr_List.SelectedValue != "" && tr_List.SelectedValue != "1") { string _categoryids = ""; DataTable dt = TreeTableBLL.GetAllChildByNodes("MCS_Pub.dbo.PDT_Category", "ID", "SuperID", tr_List.SelectedValue); for (int i = 0; i < dt.Rows.Count; i++) { _categoryids += dt.Rows[i]["ID"].ToString() + ","; } _categoryids += tr_List.SelectedValue; ConditionStr += " AND PDT_Product.Category IN (" + _categoryids + ")"; } int count = 0; IList<PDT_Product> product = PDT_ProductBLL.GetModelList(ConditionStr); foreach (PDT_Product p in product) { int id = p.ID; PDT_ProductBLL bll = new PDT_ProductBLL(id); PDT_ProductExtInfo extinfo = new PDT_ProductExtInfo(); extinfo.Code = bll.Model.FactoryCode == "" ? bll.Model.Code : bll.Model.FactoryCode; extinfo.Supplier = (int)Session["OwnerClient"]; bll.SetProductExtInfo(extinfo); count++; } if (count > 0) { MessageBox.Show(this, string.Format("成功将{0}个商品加入经营范围!", count)); BindGrid(); } else MessageBox.Show(this, "请选择要加入经营产商品!"); }