void UCPurchaseOrderView_SaveEvent(object sender, EventArgs e) { try { List <SysSQLString> listSql = new List <SysSQLString>(); SysSQLString sysStringSql = new SysSQLString(); sysStringSql.cmdType = CommandType.Text; Dictionary <string, string> dic = new Dictionary <string, string>();//参数 string sql1 = string.Format(@" Update tb_parts_purchase_order Set is_suspend=@is_suspend,suspend_reason=@suspend_reason,update_by=@update_by, update_name=@update_name,update_time=@update_time,operators=@operators,operator_name=@operator_name where order_id=@order_id;"); dic.Add("is_suspend", chkis_suspend.Checked ? "0" : "1");//选中(中止):0,未选中(不中止):1 dic.Add("suspend_reason", txtsuspend_reason.Caption.Trim()); dic.Add("update_by", GlobalStaticObj.UserID); dic.Add("update_name", GlobalStaticObj.UserName); dic.Add("update_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString()); dic.Add("operators", GlobalStaticObj.UserID); dic.Add("operator_name", GlobalStaticObj.UserName); dic.Add("order_id", orderId); sysStringSql.sqlString = sql1; sysStringSql.Param = dic; listSql.Add(sysStringSql); foreach (DataGridViewRow dr in gvPurchaseList.Rows) { string is_suspend = "1"; if (dr.Cells["is_suspend"].Value == null) { is_suspend = "1"; } if ((bool)dr.Cells["is_suspend"].EditedFormattedValue) { is_suspend = "0"; } else { is_suspend = "1"; } sysStringSql = new SysSQLString(); sysStringSql.cmdType = CommandType.Text; dic = new Dictionary <string, string>(); dic.Add("is_suspend", is_suspend); dic.Add("order_id", orderId); dic.Add("parts_code", dr.Cells["parts_code"].Value.ToString()); string sql2 = "Update tb_parts_purchase_order_p set is_suspend=@is_suspend where order_id=@order_id and parts_code=@parts_code;"; sysStringSql.sqlString = sql2; sysStringSql.Param = dic; listSql.Add(sysStringSql); } if (DBHelper.BatchExeSQLStringMultiByTrans("修改采购订单", listSql)) { MessageBoxEx.Show("保存成功!"); uc.BindgvPurchaseOrderList(); deleteMenuByTag(this.Tag.ToString(), uc.Name); } else { MessageBoxEx.Show("保存失败!"); } } catch (Exception ex) { MessageBoxEx.Show("操作失败!"); } }