public RecordLootDialog(frmMain owner, string name, string date) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("frmRecordLoot.log"); #endif debugLogger.WriteDebug_3("Begin Method: frmRecordLoot.frmRecordLoot(frmMain,string,string) (" + owner.ToString() + "," + name.ToString() + "," + date.ToString() + ")"); InitializeComponent(); this.owner = owner; lblRaidName.Text = name; lblRaidDate.Text = date; string connectionStr; connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + owner.DBString; try { dbConnect = new OleDbConnection(connectionStr); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to open data connection: " + ex.Message); MessageBox.Show("Could not create data connection. \n(" + ex.Message + ")", "Error"); } try { this.dtPeople = new DataTable("People"); this.dtLoot = new DataTable("Loot"); dkpDA = new OleDbDataAdapter("SELECT DISTINCT DKS.Name FROM DKS", dbConnect); dbConnect.Open(); dkpDA.Fill(dtPeople); dkpDA = new OleDbDataAdapter("SELECT * FROM LootDKP ORDER BY LootName ASC", dbConnect); cmdBld = new OleDbCommandBuilder(dkpDA); dkpDA.Fill(dtLoot); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to load loot tables: " + ex.Message); MessageBox.Show("Could not open data connection. \n(" + ex.Message + ")", "Error"); } finally { dbConnect.Close(); } dtPeople.Rows.Add(new object[] { "*** Select" }); dtLoot.Rows.Add(new object[] { "*** Select", 0 }); DataView dvP = new DataView(dtPeople, "", "Name ASC", DataViewRowState.CurrentRows); DataView dvL = new DataView(dtLoot, "", "LootName ASC", DataViewRowState.CurrentRows); cboPrice.DataSource = dvL; cboPrice.DisplayMember = "DKP"; cboPeople.DataSource = dvP; cboPeople.DisplayMember = "Name"; cboLoot.DataSource = dvL; cboLoot.DisplayMember = "LootName"; debugLogger.WriteDebug_3("End Method: frmRecordLoot.frmLootRecord()"); }
public Raider(frmMain owner, string p, string t, double d, double a) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("Raider.log"); #endif debugLogger.WriteDebug_3("Begin Method: Raider.Raider(frmMain,string,string,double,double) (" + owner.ToString() + "," + p.ToString() + "," + t.ToString() + "," + d.ToString() + "," + a.ToString() + ")"); this.owner = owner; Person = p; Tier = t; DKP = d; AttendancePCT = a; MINDKP = owner.MinDKP; debugLogger.WriteDebug_3("End Method: Raider.Raider()"); }
public TableViewer(frmMain owner, DataTable dt) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("frmTable.log"); #endif debugLogger.WriteDebug_3("Begin Method: frmTable.frmTable(frmMain,DataTable) (" + owner.ToString() + "," + dt.ToString() + ")"); this.owner = owner; local=true; InitializeComponent(); dataGrid.ReadOnly = true; dbTable = dt; dataGrid.SetDataBinding(dbTable,""); this.dbTable.RowChanged += new DataRowChangeEventHandler(dbTable_Changed); this.dbTable.RowDeleted += new DataRowChangeEventHandler(dbTable_Changed); debugLogger.WriteDebug_3("End Method: frmTable.frmTable()"); }
public AddRemoveDialog(frmMain owner, DataTable dt, int addOrRemove, string raidname, DateTime date) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("frmAddRemove.log"); #endif debugLogger.WriteDebug_3("Begin Method: frmAddRemove.frmAddRemove(frmMain,DataTable,int,string,DateTime) (" + owner.ToString() + "," + dt.ToString() + "," + addOrRemove.ToString() + "," + date.ToShortDateString() + ")"); InitializeComponent(); this.owner = owner; cboPeople.DataSource = dt; cboPeople.DisplayMember = "Name"; lblRaid.Text = "Raid: " + raidname; lblDate.Text = "Date: " + date.Month + "/" + date.Day + "/" + date.Year; if (addOrRemove == ADD) { btnAddRemove.Text = "Add"; add = true; } else if (addOrRemove == REMOVE) { btnAddRemove.Text = "Remove"; add = false; } debugLogger.WriteDebug_3("End Method: frmAddRemove.frmAddRemove()"); }
public LogParser(frmMain owner, string log) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("LogParser.log"); #endif debugLogger.WriteDebug_3("Begin Method: LogParser.LogParser(frmMain,log) (" + owner.ToString() + "," + log.ToString() + ")"); this.owner = owner; this.log = log; try { logStream = new FileStream(log,FileMode.OpenOrCreate,FileAccess.Read); logPointer = logSize = logStream.Length; logStream.Close(); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to initialize log parser: " + ex.Message); MessageBox.Show("Error initializing log parser.\n\n" + ex.Message,"Error"); } try { logWatcher = new FileSystemWatcher(Path.GetDirectoryName(log),Path.GetFileName(log)); logWatcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.FileName | NotifyFilters.Size; logWatcher.Changed += new System.IO.FileSystemEventHandler(OnChanged); logWatcher.EnableRaisingEvents = true; } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to initialize log watcher: " + ex.Message); MessageBox.Show("Error initializing file system watcher.\n\n" + ex.Message,"Error"); } TellsOn = false; AttendanceOn = false; Tells = new ArrayList(); TellsDKP = new ArrayList(); logTimer = new System.Timers.Timer(5000); logTimer.Start(); logTimer.Elapsed += new System.Timers.ElapsedEventHandler(logTimer_Elapsed); LoadNamesTiers(); debugLogger.WriteDebug_3("End Method: LogParser.LogParser()"); }
public Raid(frmMain owner) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("Raid.log"); #endif debugLogger.WriteDebug_3("Begin Method: Raid.Raid(frmMain) (" + owner.ToString() + ")"); this.owner = owner; this.ignore = new ArrayList(); DoubleTier = false; string connectionStr; connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + owner.DBString; try { dbConnect = new OleDbConnection(connectionStr); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to create data connection: " + ex.Message); MessageBox.Show("Could not create data connection. \n(" + ex.Message + ")","Error"); } dkpDA = new OleDbDataAdapter(); dbRaid = new DataTable("Raid"); dbRaid.Columns.Add("Name",System.Type.GetType("System.String")); dbRaid.Columns.Add("Date",System.Type.GetType("System.DateTime")); dbRaid.Columns.Add("EventNameOrLoot",System.Type.GetType("System.String")); dbRaid.Columns.Add("PTS",System.Type.GetType("System.Double")); dbRaid.Columns.Add("Comment",System.Type.GetType("System.String")); dbRaid.Columns.Add("LootRaid",System.Type.GetType("System.String")); dbPeople = new DataTable("People"); try { string query = "SELECT DISTINCT Name FROM DKS WHERE (Name<>\"zzzDKP Retired\")"; dkpDA.SelectCommand = new OleDbCommand(query,dbConnect); dbConnect.Open(); dkpDA.Fill(dbPeople); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to load people table: " + ex.Message); MessageBox.Show("Could not open data connection. \n(" + ex.Message + ")","Error"); } finally { dbConnect.Close(); } debugLogger.WriteDebug_3("End Method: Raid.Raid()"); }
public AppAltDialog(frmMain owner, string name, DataTable dt) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("frmAppAlt.log"); #endif debugLogger.WriteDebug_3("Begin Method: frmAppAlt.frmAppAlt(frmMain,string,DataTable) (" + owner.ToString() + "," + name.ToString() + "," + dt.ToString() + ")"); InitializeComponent(); this.owner = owner; this.name = name; lblNotFound.Text = name + " not found in database. Who is s/he?"; cboPeople.DataSource = dt; cboPeople.DisplayMember = "Name"; rdoApp.Checked = true; cboClass.Items.AddRange( new object[] { "BER", "BRD", "BST", "CLR", "DRU", "ENC", "MAG", "MNK", "NEC", "PAL", "RNG", "ROG", "SHD", "SHM", "WAR", "WIZ" }); debugLogger.WriteDebug_3("End Method: frmAppAlt.frmAppAlt()"); }
public ChooseRaidDialog(frmMain owner) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("frmChooseRaid.log"); #endif debugLogger.WriteDebug_3("Enter Method: frmChooseRaid.frmChooseRaid(frmMain) (" + owner.ToString() + ")"); this.owner = owner; InitializeComponent(); string connectionStr; connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + owner.DBString; try { dbConnect = new OleDbConnection(connectionStr); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to create data connection: " + ex.Message); MessageBox.Show("Could not create data connection. \n(" + ex.Message + ")","Error"); } try { this.dateTable = new DataTable("Dates"); dkpDA = new OleDbDataAdapter("SELECT DISTINCT FORMAT(DKS.Date,\"yyyy/mm/dd\") AS formatDate FROM DKS",dbConnect); dbConnect.Open(); dkpDA.Fill(dateTable); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to open list of dates: " + ex.Message); MessageBox.Show("Could not open data connection. \n(" + ex.Message + ")","Error"); } finally { dbConnect.Close(); } cboDate.DataSource = new DataView(dateTable,"","formatDate DESC",DataViewRowState.CurrentRows); cboDate.DisplayMember = "formatDate"; debugLogger.WriteDebug_3("End Method: frmChooseRaid.frmChooseRaid()"); }
public SettingsDialog(frmMain owner) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("frmSettings.txt"); #endif debugLogger.WriteDebug_3("Begin Method: frmSettings.frmSettings(frmMain) (" + owner.ToString() + ")"); this.owner = owner; InitializeComponent(); Directory.SetCurrentDirectory(Directory.GetParent(Application.ExecutablePath).FullName); iniFile = new IniConfigSource(Directory.GetCurrentDirectory() + "\\settings.ini"); txtLogFile.Text = iniFile.Configs["Files"].GetString("logfile",""); txtLocalDBFile.Text = iniFile.Configs["Files"].GetString("dbfile",""); txtOutputDirectory.Text = iniFile.Configs["Files"].GetString("outdir",""); txtTax.Text = iniFile.Configs["Other"].GetDouble("tax",0)*100 + ""; txtMinDKP.Text = iniFile.Configs["Other"].GetDouble("mindkp", 0) + ""; txtTierAPct.Text = iniFile.Configs["Other"].GetDouble("tierapct", 0.60) + ""; txtTierBPct.Text = iniFile.Configs["Other"].GetDouble("tierbpct", 0.40) + ""; txtTierCPct.Text = iniFile.Configs["Other"].GetDouble("tiercpct", 0.30) + ""; txtGuildNames.Text = iniFile.Configs["Other"].GetString("GuildNames", "Eternal Sovereign"); debugLogger.WriteDebug_3("End Method: frmSettings.frmSettings()"); }
public static void DailyReport(frmMain owner, DateTime t) { OleDbConnection dbCon = null; DataTable dtTotal = new DataTable("DKSALL"); DataTable dtDKS = new DataTable("DKS"); DataTable dtEL = new DataTable("EventLog"); DataTable dtNT = new DataTable("NamesTiers"); DataTable dtAllEvents = new DataTable("NTALL"); DataTable dtFinal = new DataTable("FINAL"); FileStream fs = null; FileStream fs2 = null; StreamWriter sw = null; StreamWriter sw2 = null; int i = 1; double dkp = 0.0; int ppl = 1; bool twotier = false; double earned; double totalnetchange = 0.0; double totaldkp = 0.0; owner.PBMin = 0; owner.PBMax = 110; owner.PBVal = 0; string connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + owner.DBString; try { dbCon = new OleDbConnection(connectionStr); } catch (Exception ex) { MessageBox.Show("Could not create data connection. \n(" + ex.Message + ")","Error"); } string query = "SELECT * FROM DKS WHERE Date=#" + t.Month + "/" + t.Day + "/" + t.Year + "# ORDER BY Name"; try { OleDbDataAdapter da = new OleDbDataAdapter(query,dbCon); dbCon.Open(); da.Fill(dtDKS); query = "SELECT * FROM EventLog WHERE EventDate=#" + t.Month + "/" + t.Day + "/" + t.Year + "# ORDER BY RaidNumber ASC"; da = new OleDbDataAdapter(query,dbCon); da.Fill(dtEL); owner.PBVal += 10; query = "SELECT * FROM NamesTiers"; da = new OleDbDataAdapter(query,dbCon); da.Fill(dtNT); owner.PBVal += 10; query = "SELECT Name, Sum(PTS) AS Total FROM DKS GROUP BY Name HAVING Name<>'zzzDKP Retired'"; da = new OleDbDataAdapter(query,dbCon); da.Fill(dtTotal); owner.PBVal += 10; DataTable temp = new DataTable(); query = "SELECT DISTINCT EventDate FROM EventLog ORDER BY EventDate DESC"; da = new OleDbDataAdapter(query,dbCon); da.Fill(temp); owner.PBVal += 10; DateTime tempdate = (DateTime)temp.Rows[19]["EventDate"]; query = "SELECT * FROM EventLog WHERE EventDate>=#" + tempdate.Month + "/" + tempdate.Day + "/" + tempdate.Year + "# ORDER BY EventDate ASC, RaidNumber ASC"; da = new OleDbDataAdapter(query,dbCon); da.Fill(dtAllEvents); owner.PBVal += 10; query = "SELECT DKS.Name, Sum(DKS.PTS) AS Total, NamesTiers.Tier, NamesTiers.NumRaids, NamesTiers.TPercent "; query += "FROM DKS INNER JOIN NamesTiers ON DKS.Name=NamesTiers.Name GROUP BY DKS.Name, NamesTiers.Tier, NamesTiers.TPercent, NamesTiers.NumRaids"; da = new OleDbDataAdapter(query,dbCon); da.Fill(dtFinal); owner.PBVal += 10; } catch (Exception ex) { MessageBox.Show("Could not open data connection. \n(" + ex.Message + ")","Error"); } finally { dbCon.Close(); } try { // Terrible hack while I convert to BBCode output fs = new FileStream(owner.OutputDirectory + "DKPReport.txt",FileMode.Create); sw = new StreamWriter(fs); fs2 = new FileStream(owner.OutputDirectory + "DKPReport-bbcode.txt", FileMode.Create); sw2 = new StreamWriter(fs2); } catch (Exception ex) { MessageBox.Show("File IO Error. \n(" + ex.Message + ")","Error"); } // Events + Loot table sw.Write("<table width ='100%' border='1' cellspacing='0' cellpadding='3' bordercolor='#0000ff' bordercolorlight='#000000' bordercolordark='#ffffff' frame='border' rules='all' class='gensmall'>"); sw.Write("<tr><td colspan='4' bgcolor='black'><b>Events and Loot</b></td></tr>"); sw2.Write("[p][table][tr][th][b]Events and Loot[/b][/th][/tr]"); foreach (DataRow ev in dtEL.Select("EventName NOT LIKE '%1'","RaidNumber ASC")) { dkp=0; twotier=false; ppl = dtDKS.Select("EventNameOrLoot='" + ev["EventName"] + "'").Length; string evstr = (string)ev["EventName"]; if (Regex.IsMatch(evstr,".*?0")) { evstr = evstr.TrimEnd(new char[] { '0' }); twotier = true; } sw.Write("<tr><td colspan='4' bgcolor='black'><b>" + i + ".</b> " + evstr); sw2.Write("[tr][th][b]" + i + ".[/b] " + evstr); if (twotier) { sw.Write("<b><i> Double Tier</b></i>"); sw2.Write("[b][i] Double Tier[/b][/i]"); } sw.Write("</td></tr>"); sw2.Write("[/th][/tr]"); sw.Write("<tr><td width='30%'><i><b>Loot</b></i></td><td width='25%'><b><i>Recipient</b></i></td><td width='15%'><b><i>Cost</b></i></td><td width='30%'><b><i>DKP Per Person</b></i></td></tr>"); sw2.Write("[tr][td][i][b]Loot[/b][/i][/td][td][b][i]Recipient[/b][/i][/td][td][b][i]Cost[/b][/i][/td][td][b][i]DKP Per Person[/b][/i][/td][/tr]"); DataRow[] loots = dtDKS.Select("LootRaid='" + ev["EventName"] + "'"); i++; foreach (DataRow r in loots) { dkp += (double)r["PTS"] * -1; sw.Write("<tr><td>" + r["EventNameOrLoot"] + "</td><td>" + r["Name"] + "</td><td>" + r["PTS"] + "</td><td>" + (double)r["PTS"] * -1 / ppl * (1 - owner.DKPTax) + "</td></tr>"); sw2.Write("[tr][td]" + r["EventNameOrLoot"] + "[/td][td]" + r["Name"] + "[/td][td]" + r["PTS"] + "[/td][td]" + (double)r["PTS"] * -1 / ppl * (1 - owner.DKPTax) + "[/td][/tr]"); } sw.Write("<tr><td><b><i>Totals:</b></i></td><td>-</td><td>" + dkp * -1 + "</td><td>" + dkp/ppl * (1 - owner.DKPTax) + "</td></tr>"); sw2.Write("[tr][td][b][i]Totals:[/b][/i][/td][td]-[/td][td]" + dkp * -1 + "[/td][td]" + dkp / ppl * (1 - owner.DKPTax) + "[/td][/tr]"); } sw.Write("</table>\n\n"); sw2.Write("[/table][/p]"); owner.PBVal += 10; // Attendance table sw.Write("<table width ='100%' border='1' cellspacing='0' cellpadding='3' bordercolor='#0000ff' bordercolorlight='#000000' bordercolordark='#ffffff' frame='border' rules='all' class='gensmall'>"); sw2.Write("[p][table]"); i=1; sw.Write("<tr><td colspan='" + (5 + dtEL.Select("EventName NOT LIKE '%1'").Length) + "' bgcolor='black'><b>Attendance</b></td></tr>"); sw2.Write("[tr][th][b]Attendance[/b][/th][/tr]"); sw.Write("<tr><td width='15%'><b><i>Name</b></i></td>"); sw2.Write("[tr][td][b][i]Name[/b][/i][/td]"); foreach (DataRow ev in dtEL.Select("EventName NOT LIKE '%1'")) { sw.Write("<td width='15'><b><i>" + i + "</b></i></td>"); sw2.Write("[td][b][i]" + i + "[/i][/b][/td]"); i++; } sw.Write("<td width='15%'><b><i>DKP Net Change</b></i></td><td width='15%'><b><i>DKP Total</b></i><td width='15'></td><td width='*'><b><i>Tier</b></i></td></tr>"); sw2.Write("[td][b][i]DKP Net Change[/i][/b][/td][td][b][i]DKP Total[/i][/b][/td][td][/td][td][b][i]Tier[/i][/b][/td][/tr]"); owner.PBVal += 10; foreach (DataRow r in dtNT.Rows) { earned = 0; if (dtTotal.Select("Name='" + r["Name"] + "'").Length==0) continue; sw.Write("<td>" + r["Name"] + "</td>"); sw2.Write("[tr][td]" + r["Name"] + "[/td]"); int event_counter = 1; foreach (DataRow ev in dtEL.Select("EventName NOT LIKE '%1'","RaidNumber ASC")) { if (dtDKS.Select("Name='" + r["Name"] + "' AND EventNameOrLoot='" + ev["EventName"] + "'").Length>0) { earned += (double)dtDKS.Select("Name='" + r["Name"] + "' AND EventNameOrLoot='" + ev["EventName"] + "'")[0]["PTS"]; sw.Write("<td>•</td>"); sw2.Write("[td]" + event_counter + "[/td]"); } else { sw.Write("<td></td>"); sw2.Write("[td][/td]"); } event_counter++; } foreach (DataRow deduct in dtDKS.Select("Name='" + r["Name"] + "' AND PTS<0")) earned += (double)deduct["PTS"]; totalnetchange += earned; totaldkp += (double)dtTotal.Select("Name='" + r["Name"] + "'")[0]["Total"]; sw.Write("<td>" + String.Format("{0:+0.00;-0.00;00.00}",earned) + "</td>"); sw.Write("<td>" + String.Format("{0:+0.000#;-0.000#;00.000#}",dtTotal.Select("Name='" + r["Name"]+ "'")[0]["Total"]) + "</td>"); sw.Write("<td>" + r["Tier"] + "</td><td>" + String.Format("{0:00.00}",r["TPercent"]) + "% (" + r["NumRaids"] + "/" + dtAllEvents.Rows.Count + ")</td></tr>"); sw2.Write("[td]" + String.Format("{0:+0.00;-0.00;00.00}",earned) + "[/td]"); sw2.Write("[td]" + String.Format("{0:+0.000#;-0.000#;00.000#}",dtTotal.Select("Name='" + r["Name"]+ "'")[0]["Total"]) + "[/td]"); sw2.Write("[td]" + r["Tier"] + "[/td][td]" + String.Format("{0:00.00}",r["TPercent"]) + "% (" + r["NumRaids"] + "/" + dtAllEvents.Rows.Count + ")[/td][/tr]"); } sw.Write("<tr><td><b><i>Totals:</b></i></td>"); sw2.Write("[tr][td][b][i]Totals:[/i][/b][/td]"); foreach (DataRow ev in dtEL.Select("EventName NOT LIKE '%1'")) { sw.Write("<td></td>"); sw2.Write("[td][/td]"); } sw.Write("<td>" + String.Format("{0:+0.00;-0.00;00.00}",totalnetchange) + "</td>"); sw.Write("<td>" + String.Format("{0:0.0#}",totaldkp) + "</td><td></td><td></td></tr>"); sw.Write("</table>\n\n"); sw2.Write("[td]" + String.Format("{0:+0.00;-0.00;00.00}",totalnetchange) + "[/td]"); sw2.Write("[td]" + String.Format("{0:0.0#}",totaldkp) + "[/td][td][/td][td][/td][/tr]"); sw2.Write("[/table][/p]\n\n"); owner.PBVal += 10; // Tier table DataRow[] a = dtFinal.Select("Tier='A'","Total DESC"); DataRow[] b = dtFinal.Select("Tier='B'","Total DESC"); DataRow[] c = dtFinal.Select("Tier='C'","Total DESC"); int j =0; sw.Write("<table width ='100%' border='1' cellspacing='0' cellpadding='3' bordercolor='#0000ff' bordercolorlight='#000000' bordercolordark='#ffffff' frame='border' rules='all' class='gensmall'>"); sw.Write("<tr><td colspan='3' bgcolor='black'><b>Tier A</b></td><td colspan='3' bgcolor='black'><b>Tier B</b></td><td colspan='3' bgcolor='black'><b>Tier C</b></td></tr>"); sw.Write("<tr><td width='15%'><b><i>Name</b></i></td><td width='5%'><b><i>%</b></i></td><td width='13%'><b><i>DKP Total</b></i></td><td width='15%'><b><i>Name</b></i></td><td width='5%'><b><i>%</b></i></td><td width='13%'><b><i>DKP Total</b></i></td><td width='15%'><b><i>Name</b></i></td><td width='5%'><b><i>%</b></i></td><td width='13%'><b><i>DKP Total</b></i></td></tr>"); sw2.Write("[p][table][tr][th][b]Tier A[/b][/th][th][/th][th][/th][th][b]Tier B[/b][/th][th][/th][th][/th][th]>[b]Tier C[/b][/th][th][/th][th][/th][/tr]"); sw2.Write("[tr][td][b][i]Name[/i][/b][/td][td][b][i]%[/i][/b][/td][td][b][i]DKP Total[/i][/b][/td][td][b][i]Name[/i][/b][/td][td][b][i]%[/i][/b][/td][td][b][i]DKP Total[/i][/b][/td][td][b][i]Name[/i][/b][/td][td][b][i]%[/i][/b][/td][td][b][i]DKP Total[/i][/b][/td][/tr]"); double atd, btd, ctd, att, btt, ctt; atd = btd = ctd = att = btt = ctt = 0.00; while (a.Length>j||b.Length>j||c.Length>j) { sw.Write("<tr>"); sw2.Write("[tr]"); if (a.Length > j) { sw.Write("<td>" + a[j]["Name"] + "</td><td>" + String.Format("{0:00.00}", a[j]["TPercent"]) + "</td><td>" + String.Format("{0:+0.0#;-0.0#;0.00}", a[j]["Total"])); sw2.Write("[td]" + a[j]["Name"] + "[/td][td]" + String.Format("{0:00.00}", a[j]["TPercent"]) + "[/td][td]" + String.Format("{0:+0.0#;-0.0#;0.00}", a[j]["Total"]) + "[/td]"); atd += (double)a[j]["Total"]; att += double.Parse(a[j]["TPercent"].ToString()); } else { sw.Write("<td></td><td></td><td></td>"); sw2.Write("[td][/td][td][/td][td][/td]"); } if (b.Length > j) { sw.Write("<td>" + b[j]["Name"] + "</td><td>" + String.Format("{0:00.00}", b[j]["TPercent"]) + "</td><td>" + String.Format("{0:+0.0#;-0.0#;0.00}", b[j]["Total"])); sw2.Write("[td]" + b[j]["Name"] + "[/td][td]" + String.Format("{0:00.00}", b[j]["TPercent"]) + "[/td][td]" + String.Format("{0:+0.0#;-0.0#;0.00}", b[j]["Total"]) + "[/td]"); btd += (double)b[j]["Total"]; btt += double.Parse(b[j]["TPercent"].ToString()); } else { sw.Write("<td></td><td></td><td></td>"); sw2.Write("[td][/td][td][/td][td][/td]"); } if (c.Length > j) { sw.Write("<td>" + c[j]["Name"] + "</td><td>" + String.Format("{0:00.00}", c[j]["TPercent"]) + "</td><td>" + String.Format("{0:+0.0#;-0.0#;0.00}", c[j]["Total"])); sw2.Write("[td]" + c[j]["Name"] + "[/td][td]" + String.Format("{0:00.00}", c[j]["TPercent"]) + "[/td][td]" + String.Format("{0:+0.0#;-0.0#;0.00}", c[j]["Total"]) + "[/td]"); ctd += (double)c[j]["Total"]; ctt += double.Parse(c[j]["TPercent"].ToString()); } else { sw.Write("<td></td><td></td><td></td>"); sw2.Write("[td][/td][td][/td][td][/td]"); } sw.Write("</tr>"); sw2.Write("[/tr]"); j++; } sw.Write("<tr><td><b><i>Averages:</i></b></td><td>" + String.Format("{0:00.00}",att/a.Length) + "</td><td>" + String.Format("{0:+0.0#;-0.0#;0.00}",atd/a.Length) + "</td><td></td><td>" + String.Format("{0:00.00}",btt/b.Length) + "</td><td>" + String.Format("{0:+0.0#;-0.0#;0.00}",btd/b.Length) + "</td><td></td><td>" + String.Format("{0:00.00}",ctt/c.Length) + "</td><td>" + String.Format("{0:+0.0#;-0.0#;0.00}",ctd/c.Length) + "</td></tr>"); sw2.Write("[tr][td][b][i]Averages:[/i][/b][/td][td]" + String.Format("{0:00.00}", att / a.Length) + "[/td][td]" + String.Format("{0:+0.0#;-0.0#;0.00}", atd / a.Length) + "[/td][td][/td][td]" + String.Format("{0:00.00}", btt / b.Length) + "[/td][td]" + String.Format("{0:+0.0#;-0.0#;0.00}", btd / b.Length) + "[/td][td][/td][td]" + String.Format("{0:00.00}", ctt / c.Length) + "[/td][td]" + String.Format("{0:+0.0#;-0.0#;0.00}", ctd / c.Length) + "[/td][/tr]"); sw.Write("</table>\n\n"); sw2.Write("[/table][/p]\n\n"); owner.PBVal += 10; // Events Table sw.Write("<table width ='100%' border='1' cellspacing='0' cellpadding='3' bordercolor='#0000ff' bordercolorlight='#000000' bordercolordark='#ffffff' frame='border' rules='all' class='gensmall'>"); sw.Write("<tr><td colspan='2' bgcolor='black'><b>Events Counted Towards Tier</b></td>"); sw2.Write("[p][table][tr][th][b]Events Counted Towards Tier[/b][/th][th][/th][/tr]"); sw2.Write("[tr][td]"); DateTime n = new DateTime(1,1,1); foreach (DataRow r in dtAllEvents.Rows) { if (!((DateTime)r["EventDate"]).Equals(n)) { n = (DateTime)r["EventDate"]; sw.Write("</td></tr><tr><td>" + n.Month + "/" + n.Day + "/" + n.Year + "</td><td>"); sw2.Write("[/td][/tr][tr][td]" + n.Month + "/" + n.Day + "/" + n.Year + "[/td][td]"); } sw.Write(r["EventName"] + "\n"); sw2.Write(r["EventName"] + "\n"); } sw.Write("</td></tr></table>"); sw2.Write("[/td][/tr][/table][/p]"); owner.PBVal += 10; sw.Close(); fs.Close(); sw2.Close(); fs2.Close(); owner.StatusMessage = "Finished writing daily report..."; }
public TableViewer(frmMain owner, int queryType, string query, bool readOnly) { #if (DEBUG_1||DEBUG_2||DEBUG_3) debugLogger = new DebugLogger("frmTable.log"); #endif debugLogger.WriteDebug_3("Begin Method: frmTable.frmTable(frmMain,int,string,bool) (" + owner.ToString() + "," + queryType.ToString() + "," + query.ToString() + "," + readOnly.ToString() + ")"); this.owner = owner; local = false; if (queryType == TableViewer.DKPSELECT) { debugLogger.WriteDebug_2("SELECT query initiated: " + query); InitializeComponent(); changed = false; dataGrid.ReadOnly = readOnly; this.query = query; string connectionStr; connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + owner.DBString; try { dbConnect = new OleDbConnection(connectionStr); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to create data connection: " + ex.Message); MessageBox.Show("Could not create data connection. \n(" + ex.Message + ")", "Error"); } try { this.dbTable = new DataTable("Data"); dkpDA = new OleDbDataAdapter(query, dbConnect); dbConnect.Open(); dkpDA.Fill(dbTable); dataGrid.SetDataBinding(dbTable, ""); cmdBld = new OleDbCommandBuilder(dkpDA); this.dbTable.RowChanged += new DataRowChangeEventHandler(dbTable_Changed); this.dbTable.RowDeleted += new DataRowChangeEventHandler(dbTable_Changed); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to retrieve SELECT query: " + ex.Message); MessageBox.Show("Could not open data connection. \n(" + ex.Message + ")", "Error"); } finally { dbConnect.Close(); } } else if (queryType == TableViewer.DKPUPDATE) { debugLogger.WriteDebug_2("UPDATE query initiated: " + query); string connectionStr; connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + owner.DBString; try { dbConnect = new OleDbConnection(connectionStr); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to create data connection: " + ex.Message); MessageBox.Show("Could not create data connection. \n(" + ex.Message + ")", "Error"); } try { OleDbCommand updateCommand = new OleDbCommand(query, dbConnect); dbConnect.Open(); int changes = updateCommand.ExecuteNonQuery(); debugLogger.WriteDebug_1("UPDATE query changed " + changes + " rows."); MessageBox.Show("Updated " + changes + " rows."); } catch (Exception ex) { debugLogger.WriteDebug_1("Failed to perform UPDATE query: " + ex.Message); MessageBox.Show("Could not open data connection. \n(" + ex.Message + ")", "Error"); } finally { dbConnect.Close(); } this.Dispose(); } }
public DKPOverTimeDialog(frmMain parent) { InitializeComponent(); this.parent = parent; }