private void processByOrigTkpr() { List <ThousandMatters> matters = new List <ThousandMatters>(); ThousandMatters tm = null; int counter = 0; string matList = ""; string SQL = "SELECT MOrigMat FROM MatOrigAtty where MOrigAtty in (" + employeesOrig + ")"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQL); foreach (DataRow dr in myRSTkpr.Tables[0].Rows) { matList = matList + dr["MOrigMat"].ToString() + ","; counter++; if (counter == 1000) { tm = new ThousandMatters(); matList = matList.TrimEnd(','); tm.matters = matList; matters.Add(tm); counter = 0; matList = ""; } } if (!string.IsNullOrEmpty(matList)) { tm = new ThousandMatters(); matList = matList.TrimEnd(','); tm.matters = matList; matters.Add(tm); matList = ""; } runUpdateSQL(matters, false); }
private void processByBillTkpr() { String SQL = ""; string matList = ""; List <ThousandMatters> matters = new List <ThousandMatters>(); ThousandMatters tm = null; int counter = 0; SQL = "SELECT MatSysNbr FROM [BillTo] inner join matter on BillToSysNbr = MatBillTo where BillToBillingAtty in (" + employeesBill + ")"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQL); foreach (DataRow dr in myRSTkpr.Tables[0].Rows) { matList = matList + dr["MatSysNbr"].ToString() + ","; counter++; if (counter == 1000) { tm = new ThousandMatters(); matList = matList.TrimEnd(','); tm.matters = matList; matters.Add(tm); counter = 0; matList = ""; } } if (!string.IsNullOrEmpty(matList)) { tm = new ThousandMatters(); matList = matList.TrimEnd(','); tm.matters = matList; matters.Add(tm); matList = ""; } runUpdateSQL(matters, false); }
private void processByClient() { if (!allSelected) { string cliList = ""; string matList = ""; List <ThousandMatters> clients = new List <ThousandMatters>(); List <ThousandMatters> matters = new List <ThousandMatters>(); ThousandMatters tm = null; int counter = 0; foreach (ListViewItem eachItem in listViewClient.CheckedItems) { cliList = cliList + eachItem.SubItems[0].Text + ","; //get the client id from each item selected counter++; if (counter == 1000) { tm = new ThousandMatters(); cliList = cliList.TrimEnd(','); tm.matters = cliList; clients.Add(tm); counter = 0; cliList = ""; } } if (!string.IsNullOrEmpty(cliList)) { tm = new ThousandMatters(); cliList = cliList.TrimEnd(','); tm.matters = cliList; clients.Add(tm); cliList = ""; } if (clients.Count != 0) { MessageBox.Show("This process can take a long time for large data sets. " + "\r\n" + "The report will load once all your data has been read." + "\r\n" + "It is normal for the screen to do nothing during this time." + "\r\n" + "Press 'OK' to continue", "Long process warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //get matterIDs from clients foreach (ThousandMatters ttt in clients) { string SQL = "SELECT MatSysNbr FROM Matter where MatCliNbr in (" + ttt.matters + ") and MatStatusFlag <> 'C'"; DataSet myRSTkpr = _jurisUtility.RecordsetFromSQL(SQL); counter = 0; foreach (DataRow dr in myRSTkpr.Tables[0].Rows) { matList = matList + dr["MatSysNbr"].ToString() + ","; counter++; if (counter == 1000) { tm = new ThousandMatters(); matList = matList.TrimEnd(','); tm.matters = matList; matters.Add(tm); counter = 0; matList = ""; } } if (!string.IsNullOrEmpty(matList)) { tm = new ThousandMatters(); matList = matList.TrimEnd(','); tm.matters = matList; matters.Add(tm); matList = ""; } } //now do the damn thing runUpdateSQL(matters, allSelected); //make objects 100 (or whateve)_ ids at a time and fun in a loop } else //there were no matters selected { MessageBox.Show("Please select at least one client", "Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } else { runUpdateSQL(null, allSelected); } }