Esempio n. 1
0
        private void Tool_quanlityClearDB_Click(object sender, EventArgs e)
        {
            if (this.radGridViewQuanlity.RowCount < 1)
            {
                MessageBox.Show("没有可以清除的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("确认要清除当前数据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK)
            {
                return;
            }
            List <MesService.QuanlityHistory> quanlityHistoryList = new List <MesService.QuanlityHistory>();

            foreach (var rowInfo in this.radGridViewQuanlity.Rows)
            {
                MesService.QuanlityHistory quanlityHistory = new MesService.QuanlityHistory();
                var ridCode      = rowInfo.Cells[3].Value.ToString();
                var materialCode = serviceClient.GetMaterialCode(ridCode);
                quanlityHistory.MaterialCode = materialCode;
                quanlityHistoryList.Add(quanlityHistory);
            }
            var delRow = serviceClient.DeleteQuanlityMsg(quanlityHistoryList.ToArray());

            if (delRow > 0)
            {
                MessageBox.Show($"已删除数据{delRow}条!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("未删除任何数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            SelectOfMaterialQuanlity();
        }