Example #1
0
        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()");
        }
Example #2
0
        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()");
        }
Example #3
0
        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()");
        }
Example #4
0
        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()");
        }
Example #5
0
        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()");
        }
Example #6
0
File: Raid.cs Project: esdkp/esdkp
        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()");
        }
Example #7
0
        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()");
        }
Example #8
0
        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()");
        }
Example #9
0
        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()");
        }
Example #10
0
        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();
            }
        }