private void Update_Click(object sender, EventArgs e) { var row = gridViewStockTakingMaster.GetFocusedDataRow() as DataRow; if (row != null) { var status = int.Parse(row["Status"].ToString()); var stockRevise = bool.Parse(row["StockRevise"].ToString()); var number = row["number"].ToString(); if (status == 2 && (!stockRevise)) { if (XtraMessageBox.Show(string.Format("确定根据编号[{0}]的盘点记录调整库存吗?", number), "操作提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { var id = new Guid(row["ID"].ToString()); var result = stock.UpdateStockByStockTakingMasterID(id); if (result) { this.BindStockTakingMaster(); XtraMessageBox.Show("调整库存成功!", "操作成功", MessageBoxButtons.OK); } else { XtraMessageBox.Show("调整库存失败!", "操作未成功", MessageBoxButtons.OK); } } } else if (stockRevise) { XtraMessageBox.Show("您所选盘点记录已经调整库存,不能重新调整", "操作提示", MessageBoxButtons.OK); } else { XtraMessageBox.Show("您所选盘点记录还未结束盘点,不能调整库存", "操作提示", MessageBoxButtons.OK); } } }