private void btnDel_Click(object sender, EventArgs e) { int count = this.gdvInfo.SelectedRowsCount; if (count == 0) { MessageBox.Show("请先搜索/刷新并选择需要修改的用户行", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DialogResult dr = MessageBox.Show("确定删除此条信息吗?", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { string paramProductID = this.gdvInfo.GetFocusedRowCellValue("product_id").ToString(); string paramSupplierID = this.gdvInfo.GetFocusedRowCellValue("supplier_id").ToString(); BUProductSupplierInfo myBUProductSupplierInfo = new BUProductSupplierInfo(); int i = myBUProductSupplierInfo.DeleteProSupInfo(paramProductID, paramSupplierID); if (i > 0) { MessageBox.Show("删除成功"); btnSearch_Click(sender, e); } else { MessageBox.Show("删除失败"); } } }
public void GetPrice(string paramProductID, string paramSupplierID) { DataTable myPriceDt = new DataTable(); BUProductSupplierInfo myBUProductSupplierInfo = new BUProductSupplierInfo(); myPriceDt = myBUProductSupplierInfo.GetProductSupplierPrice(paramProductID, paramSupplierID); txtPrice.Text = myPriceDt.Rows[0]["Proprice"].ToString(); }
private void btnSearch_Click(object sender, EventArgs e) { try { string paramProductID = this.txtBoxProductCode.Text.Trim(); string paramSupplierID = this.txtBoxSupplierID.Text.Trim(); DataSet ds = new DataSet(); BUProductSupplierInfo myBUProductSupplierInfo = new BUProductSupplierInfo(); ds = myBUProductSupplierInfo.GetAll_ProSupInfo(paramProductID, paramSupplierID); gdcInfo.DataSource = ds.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void SetSupplier(string paramProductID) { DataTable mySupplierDt = new DataTable(); BUProductSupplierInfo myBUProductSupplierInfo = new BUProductSupplierInfo(); mySupplierDt = myBUProductSupplierInfo.GetAll_ProSupInfo(paramProductID, string.Empty).Tables[0]; combSpplier.DataSource = mySupplierDt; combSpplier.DisplayMember = "name"; combSpplier.ValueMember = "supplier_id"; this.combSpplier.SelectedValueChanged += new System.EventHandler(this.combSpplier_SelectedValueChanged); if (mySupplierDt.Rows.Count > 0) { string paramSupplierID = combSpplier.SelectedValue.ToString(); GetPrice(paramProductID, paramSupplierID); } }