コード例 #1
0
        private void Tool_packageClearDB_Click(object sender, EventArgs e)
        {
            if (this.radGridViewPackage.RowCount < 1)
            {
                MessageBox.Show("没有可以清除的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("确认要清除当前数据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK)
            {
                return;
            }
            //var delRow = serviceClient.DeleteProductPackage(this.currentQueryCondition,1);
            List <MesService.PackageProductHistory> packageProductHistoryList = new List <MesService.PackageProductHistory>();

            foreach (var rowInfo in this.radGridViewPackage.Rows)
            {
                MesService.PackageProductHistory packageProductHistory = new MesService.PackageProductHistory();
                packageProductHistory.OutCaseCode   = rowInfo.Cells[1].Value.ToString();
                packageProductHistory.ProductTypeNo = rowInfo.Cells[2].Value.ToString();
                packageProductHistory.BindState     = "1";
                packageProductHistoryList.Add(packageProductHistory);
            }
            var delRow = serviceClient.DeleteProductPackageHistory(packageProductHistoryList.ToArray());

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