private void dataGridViewX1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { //修改的是加点 if (e.ColumnIndex == dataGridViewX1.Columns["Price_Plus"].Index) { soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); string ID = dataGridViewX1.Rows[e.RowIndex].Cells["ID"].Value.ToString(); string CateGory = dataGridViewX1.Rows[e.RowIndex].Cells["CateGory"].Value.ToString(); Decimal Price_Plus = dataGridViewX1.Rows[e.RowIndex].Cells["Price_Plus"].Value == null ? 0 : Convert.ToDecimal(dataGridViewX1.Rows[e.RowIndex].Cells["Price_Plus"].Value); bll.SetPricePlus(ID, Price_Plus, CateGory); } //修改的是售价 if (e.ColumnIndex == dataGridViewX1.Columns["Price_Sale"].Index) { soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); string ID = dataGridViewX1.Rows[e.RowIndex].Cells["ID"].Value.ToString(); string CateGory = dataGridViewX1.Rows[e.RowIndex].Cells["CateGory"].Value.ToString(); Decimal Price = dataGridViewX1.Rows[e.RowIndex].Cells["Price"].Value == null ? 0 : Convert.ToDecimal(dataGridViewX1.Rows[e.RowIndex].Cells["Price"].Value); Decimal Price_Sale = dataGridViewX1.Rows[e.RowIndex].Cells["Price_Sale"].Value == null ? 0 : Convert.ToDecimal(dataGridViewX1.Rows[e.RowIndex].Cells["Price_Sale"].Value); decimal Price_Plus = Price_Sale / Price; bll.SetPricePlus(ID, Price_Plus, CateGory); } //重新绑定数据 Bind(); }