예제 #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            string codeFileName = bug.Codes.CodeFileName;
            string codeFilePath = bug.Codes.CodeFilePath;
            string c            = fastColoredTextBox1.Text;

            FixerDAO fixerDAO = new FixerDAO();
            BugDAO   bugDAO   = new BugDAO();

            Fixer fixer = new Fixer
            {
                FixedBy = Login.userId,
                BugId   = Program.bugId
            };

            try
            {
                fixerDAO.Insert(fixer);
                bugDAO.BugFixed(Program.bugId);
                MessageBox.Show("Oh great work");
                this.Dispose();
                new Bugs().Show();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            string path = "code/" + codeFileName + ".txt";

            using (StreamWriter sw = File.CreateText(path))
            {
                sw.WriteLine(c);
            }
        }
예제 #2
0
        private void BugStatus_Load(object sender, EventArgs e)
        {
            FixerDAO     fixerDAO = new FixerDAO();
            List <Fixer> list     = null;

            try
            {
                list = fixerDAO.GetBugFixers();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Bug Id");
            dataTable.Columns.Add("Fixed Date");
            dataTable.Columns.Add("Full Name");

            DataRow dataRow = null;

            foreach (var l in list)
            {
                dataRow               = dataTable.NewRow();
                dataRow["Bug Id"]     = l.BugId;
                dataRow["Fixed Date"] = l.FixedDate;
                dataRow["Full Name"]  = l.programmer.FullName;
                try
                {
                    dataTable.Rows.Add(dataRow);
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex);
                }
            }

            foreach (DataRow dt in dataTable.Rows)
            {
                try
                {
                    int num = dataGridView1.Rows.Add();
                    dataGridView1.Rows[num].Cells[0].Value = dt["Bug Id"].ToString();
                    dataGridView1.Rows[num].Cells[1].Value = dt["Fixed Date"].ToString();
                    dataGridView1.Rows[num].Cells[2].Value = dt["Full Name"].ToString();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }