Example #1
0
        private void DeleteTestProgramVersion()
        {
            if (this.gridProgrameVersion.RowCount < 1)
            {
                MessageBox.Show("没有可以清除的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (MessageBox.Show("是否确认清除当前所有数据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK)
            {
                return;
            }
            List <MesService.ProgramVersionHistory> testStandProgrameList = new List <MesService.ProgramVersionHistory>();

            foreach (GridViewRowInfo rowInfo in this.gridProgrameVersion.Rows)
            {
                MesService.ProgramVersionHistory proHistory = new MesService.ProgramVersionHistory();
                proHistory.ProductTypeNo = rowInfo.Cells[1].Value.ToString();
                proHistory.StationName   = rowInfo.Cells[2].Value.ToString();
                proHistory.ProgramePath  = rowInfo.Cells[3].Value.ToString();
                proHistory.ProgrameName  = rowInfo.Cells[4].Value.ToString();
                proHistory.TeamLeader    = rowInfo.Cells[5].Value.ToString();
                proHistory.Admin         = rowInfo.Cells[6].Value.ToString();
                proHistory.UpdateDate    = rowInfo.Cells[7].Value.ToString();
                testStandProgrameList.Add(proHistory);
            }
            var returnRes = serviceClient.DeleteTestProgrameVersion(testStandProgrameList.ToArray());

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