private void buttonX1_Click(object sender, EventArgs e) { var NewData = dataGridViewX1.DataSource as Maptool.soso.ConfigPriceMe[]; if (NewData != null) { //需要更新的价格类型 DataTable dt = new DataTable(); dt.Columns.Add("Price_Plus", typeof(decimal)); dt.Columns.Add("CateGory", typeof(string)); dt.TableName = "Table_PricePlus"; foreach (var item in NewData) { string Name = item.name; float Price_Plus = item.Price_Plus; if (!string.IsNullOrEmpty(Name) && Price_Plus > 0) { var dr = dt.NewRow(); dr["Price_Plus"] = Price_Plus; dr["CateGory"] = Name; dt.Rows.Add(dr); } } soso.syntoolSoapClient bll = new soso.syntoolSoapClient(); bool Result = bll.SetConfigPriceMe(Login.authKey, dt); if (Result) { MessageBox.Show("保存成功!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("保存失败!"); } this.Close(); } }