Beispiel #1
0
        private void charactersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <Character> toons = new List <Character>();

            FrmNewCharacters frmX = new FrmNewCharacters(toons, GetStatusType(), GetMains());
        }
Beispiel #2
0
        private void buttonImportRaidDump_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            List <Character> List1 = GetRaidDumpFile(out DateTime dumptime);
            List <Character> List2 = GetCharsFromDB();

            IEnumerable <Character> query = from a in List1
                                            join b in List2 on a.Name equals b.Name into c
                                            from x in c.DefaultIfEmpty()
                                            where x == null
                                            select a;
            List <Character> newChar = query.ToList <Character>();

            newChar = newChar.OrderBy(o => o.Name).ToList();
            if (newChar.Count > 0)
            {
                FrmNewCharacters frmX = new FrmNewCharacters(newChar, GetStatusType(), GetMains());
                Cursor.Current = Cursors.Default;
                if (frmX.ShowDialog() == DialogResult.OK)
                {
                    AddNewPlayers(frmX.GetList());
                }
                frmX.Dispose();
                List2.Clear();
                List2 = GetCharsFromDB();
            }
            IEnumerable <Character> query2 = from a in List2
                                             join b in List1 on a.Name equals b.Name
                                             select a;
            List <Character> players = query2.ToList <Character>();

            int sched = 0;

            if (checkBoxAttendence.Checked == true)
            {
                sched = CreateScheduleEntry(dumptime);
                if (sched == 0)
                {
                    MessageBox.Show("An error occurred while trying to create a Schedule entry.\nPlease Try Again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else if (sched < 0)
                {
                    DialogResult = MessageBox.Show("You are using a dump file that has already been used for attendance.\nA Dump file for attendance can only be used once.\nPlease Try Again.", "Error - Duplicate File", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                foreach (Character c in players)
                {
                    if (c.StatusName == "Guest")
                    {
                        continue;
                    }
                    SqlCommand cmd = new SqlCommand("usp_AddNewAttendance", cn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@Name", c.Name);
                    cmd.Parameters.AddWithValue("@SchedID", sched);
                    cmd.ExecuteNonQuery();
                    cmd.Dispose();
                }
            }
            LoadDKP(players, (Int16)DKPAward.Value, sched, checkBoxAttendence.Checked);
            // upload raid dump file for storage
            Cursor.Current = Cursors.Default;
        }