private void bug_ays_version_combo_SelectedIndexChanged(object sender, EventArgs e)
        {
            int      tmp_id       = int.Parse(bug_ays_version_combo.SelectedItem.ToString());
            TableBug tmp_tableBug = TableBug.Select_From_Table_Bug2(tmp_id);

            init_update_bug_GUI(tmp_tableBug);
        }
示例#2
0
        private void init_grid_waiting_audit(int para_status, int para_case_id)
        {
            MySqlConnection mycon = new MySqlConnection(Form1.CONSTR);

            mycon.Open();

            MySqlCommand mycmd   = null;
            string       tmp_str = null;

            if (para_status == 4)
            {
                tmp_str = "select * from table_bug " +
                          "where " + " case_id =" + para_case_id.ToString();
            }
            else
            {
                if (para_status == 0)
                {
                    tmp_str = "select * from table_bug " +
                              "where " + " reporter_id =" + Global_Userinfo.userid + " and head_tag= '1' ";
                }

                else
                {
                    tmp_str = "select * from table_bug " +
                              "where " + " reporter_id =" + Global_Userinfo.userid + " and head_tag= '1' " + " and bug_status=" + para_status.ToString();
                }

                if (para_case_id != -1)
                {
                    tmp_str = tmp_str + " and case_id=" + para_case_id;
                }
            }


            mycmd = new MySqlCommand(tmp_str, mycon);
            MySqlDataReader dataReader = mycmd.ExecuteReader();

            tableBug = TableBug.CreateBugTable(TableBug.Properties, dataReader, "TableBugAuditing");


            DataView ListViewInfo = new DataView(tableBug);

            waiting_audit_grid.Columns.Clear();
            waiting_audit_grid.AutoGenerateColumns = false;
            waiting_audit_grid.DataSource          = ListViewInfo;

            dataReader.Close();
            mycon.Close();
            int[] add_list = new int[] { 13, 3, 7, 1, 9, 10 };

            for (int i = 0; i < add_list.Length; i++)
            {
                DataGridViewTextBoxColumn dtcTimeStamp = new DataGridViewTextBoxColumn();
                dtcTimeStamp.DataPropertyName = TableBug.Properties[add_list[i]]; //SQL语句得到的列名,可从集合中获得
                dtcTimeStamp.HeaderText       = TableBug.Names[i];                //列头显示的汉字
                dtcTimeStamp.Width            = 110;
                waiting_audit_grid.Columns.Add(dtcTimeStamp);                     //最后一定要添加进去
            }
        }
示例#3
0
        private void bug_cre_btn_eport_bug_Click(object sender, EventArgs e)
        {
            if (!insert_ok())
            {
                MessageBox.Show("请完善信息");
                return;
            }
            if (table_bug.Prior_bug_id != -1)
            {
                ret_id            = TableBug.Add_Bug_To_Table(table_bug, true);
                this.DialogResult = DialogResult.OK;
                this.Close();
                return;
            }

            if (TableBug.Add_Bug_To_Table(table_bug, false) == -1)
            {
                MessageBox.Show("Bug报告成功");
                init_is_ok();
                bug_cre_text_bug_name.Clear();
                bug_cre_description.Clear();
                bug_cre_tabControl.SelectedIndex = 0;
                bug_cre_tabControl_SelectedIndexChanged(sender, e);
            }
            else
            {
                MessageBox.Show("系统维护,请联系管理员");
            }
        }
        private void init_next_list(int row_idx)
        {
            next_id_list.Clear();
            next_id_list.Add(bug_update.Bug_id);
            if (tableBug.Rows[row_idx][10].ToString().Length != 0)
            {
                int next_id = int.Parse(tableBug.Rows[row_idx][10].ToString().Trim());
                init_next_id_list(next_id);
            }
            int tail_id = next_id_list[next_id_list.Count - 1];

            lastTable.Bug_id     = tail_id;
            lastTable.Bug_status = TableBug.Select_From_Table_Bug(tail_id);

            Console.WriteLine(String.Format("Bug_status={0}", lastTable.Bug_status.ToString()));
            bug_ays_version_combo.Items.Clear();

            for (int i = 0; i < next_id_list.Count; i++)
            {
                bug_ays_version_combo.Items.Add(next_id_list[i]);
            }

            bug_ays_version_combo.Enabled       = true;
            bug_ays_version_combo.SelectedIndex = 0;
        }
 private void bug_analysis_btn_update_Click(object sender, EventArgs e)
 {
     try
     {
         bug_update.Bug_id     = int.Parse(bug_ays_lbl_sel_id.Text.Trim());
         bug_update.Bug_reason = bug_ays_version_combo.SelectedIndex + 1;
         if (bug_update.Bug_reason == 0)
         {
             bug_update.Bug_reason = 1;
         }
         bug_update.Bug_analysis = bug_analysis_main_text.Text;
         bug_update.Bug_status   = 2;
         if (TableBug.Update_Bug(bug_update, TableBug.DEVOLOPER) == 1)
         {
             MessageBox.Show("提交成功");
             init_grid(global_status);
         }
         else
         {
             MessageBox.Show("提交系统维护中");
         }
     } catch (Exception ee)
     {
         MessageBox.Show("系统维护中");
     }
 }
        public static string Add_Bug_To_Case(TableBug tableBug)
        {
            string cmd_add_bug_to_case;

            cmd_add_bug_to_case = "update table_case set bug_nums=bug_nums+1 where case_id=" + tableBug.case_id.ToString();

            return(cmd_add_bug_to_case);
        }
        public static string Add_Link_To_Table(TableBug tableBug)
        {
            string cmd_para;

            cmd_para = "select max(bug_id) from table_bug where case_id=" + tableBug.Case_id;

            return(cmd_para);
        }
        private void init_next_id_list(int id)
        {
            next_id_list.Add(id);
            int next_id = TableBug.Get_Next_Id(id);

            if (next_id != -1)
            {
                init_next_id_list(next_id);
            }
        }
        public static int  Add_Bug_To_Table(TableBug tableBug, bool is_child)
        {
            MySqlConnection mycon = new MySqlConnection(Form1.CONSTR);

            mycon.Open();

            MySqlCommand mycmd =
                new MySqlCommand(TableBug.Add_Bug(tableBug)
                                 , mycon);

            if (mycmd.ExecuteNonQuery() > 0)
            {
                if (!is_child)
                {
                    mycmd = new MySqlCommand(TableBug.Add_Bug_To_Case(tableBug), mycon);


                    if (mycmd.ExecuteNonQuery() > 0)
                    {
                        mycon.Close();
                        return(-1);
                    }

                    else
                    {
                        mycon.Close();
                        return(-2);
                    }
                }
                else
                {
                    mycmd = new MySqlCommand(TableBug.Add_Link_To_Table(tableBug), mycon);

                    MySqlDataReader dr = mycmd.ExecuteReader();
                    if (dr.Read())
                    {
                        int res = (int)dr.GetValue(0);
                        dr.Close();
                        mycon.Close();
                        return(res);
                    }
                    else
                    {
                        dr.Close();
                        mycon.Close();
                        return(-2);
                    }
                }
            }
            else
            {
                mycon.Close();
                return(-2);
            }
        }
示例#10
0
        private void bug_audit_btn_accompanished_Click(object sender, EventArgs e)
        {
            if (!is_enable)
            {
                MessageBox.Show("若要更新缺陷,请添加新的缺陷版本");
                return;
            }


            tableAuditBug.Bug_status = bug_cre_audit_status.SelectedIndex + 1;
            //tableAuditBug.Bug_description = bug_cre_audit_desc.Text;

            if (tableAuditBug.Bug_status == 3)
            {
                tableAuditBug.Bug_id = next_id_list[0];
                for (int i = 1; i < next_id_list.Count; i++)
                {
                    TableBug.Update_status_comp(next_id_list[i]);
                }
            }

            int result = TableBug.Update_Bug(tableAuditBug, TableBug.TESTER);

            if (result == 1)
            {
                MessageBox.Show("Bug审核完毕");
            }
            else if (result == 2)
            {
                MessageBox.Show("一个用例已经完成");
            }
            else if (result == 3)
            {
                MessageBox.Show("一个计划已经完成");
            }
            else if (result == 4)
            {
                MessageBox.Show("一个项目已经完成");
            }
            else
            {
                MessageBox.Show("系统维护中");
            }

            bug_cre_audit_desc.Clear();
            bug_cre_audit_analysis.Clear();
            bug_cre_audit_lbl_id.Text  = "";
            bug_audit_auditing_id.Text = "";
        }
示例#11
0
        private void bug_audit_lbl_update_vision_Click(object sender, EventArgs e)
        {
            if (tableAuditBug.Bug_id != -1 && tableAuditBug.Bug_status == 2)
            {
                int tail_id     = lastTable.Bug_id;
                int tail_status = lastTable.Bug_status;
                if (tail_status != 2)
                {
                    MessageBox.Show("开发工程师正在修复此版本");
                    return;
                }

                BugCreater bugCreater_child = new BugCreater(tail_id, tableAuditBug.Case_id);

                if (bugCreater_child.ShowDialog() == DialogResult.OK)
                {
                    int next_id = bugCreater_child.Child_Id();

                    TableBug update_next_id_tablebug = new TableBug();
                    update_next_id_tablebug.Bug_id      = next_id_list[next_id_list.Count - 1];
                    update_next_id_tablebug.Next_bug_id = next_id;
                    if (TableBug.Update_Next_Id(update_next_id_tablebug))
                    {
                        MessageBox.Show("版本更新成功");
                    }
                    else
                    {
                        MessageBox.Show("系统维护中");
                    }
                }
                else
                {
                }
            }
            else if (tableAuditBug.Bug_status == 2)
            {
                MessageBox.Show("请先选择前驱缺陷");
            }
            else
            {
                MessageBox.Show("必须是待确认修复bug才能更新版本");
            }
        }
        public static TableBug Select_From_Table_Bug2(int id)
        {
            TableBug        tableBug = new TableBug();
            string          cmd_str  = "select * from table_bug where bug_id=" + id.ToString();
            MySqlConnection mycon    = new MySqlConnection(Form1.CONSTR);

            mycon.Open();
            MySqlCommand mycmd = new MySqlCommand(cmd_str, mycon);

            MySqlDataReader dr = mycmd.ExecuteReader();

            if (dr.Read())
            {
                tableBug.Bug_id          = id;
                tableBug.Bug_description = dr["bug_description"].ToString();
                tableBug.Bug_status      = int.Parse(dr["bug_status"].ToString());
                if (tableBug.Bug_status != 1)
                {
                    tableBug.Bug_reason   = int.Parse(dr["bug_reason"].ToString());
                    tableBug.Bug_analysis = dr["bug_analysis"].ToString();
                    if (dr["next_bug_id"].ToString().Length != 0)
                    {
                        tableBug.Next_bug_id = int.Parse(dr["next_bug_id"].ToString());
                    }
                    else
                    {
                        tableBug.Next_bug_id = -1;
                    }
                }

                dr.Close();
                mycon.Close();
                return(tableBug);
            }
            else
            {
                dr.Close();
                mycon.Close();
                return(null);
            }
        }
        private void init_update_bug_GUI(TableBug para_tableBug)
        {
            bug_ays_lbl_sel_id.Text = para_tableBug.Bug_id.ToString();
            bug_analysis_desc.Text  = para_tableBug.Bug_description;
            // bug_analysis_status.SelectedIndex = para_tableBug.Bug_status +1;
            if (para_tableBug.Bug_reason != 1)
            {
                bug_analysis_bugReason.SelectedIndex = para_tableBug.Bug_reason - 1;
                bug_analysis_main_text.Text          = para_tableBug.Bug_analysis;
            }
            switch (para_tableBug.Bug_status)
            {
            case 1:
                bug_analysis_btn_update.Enabled = true;
                bug_analysis_status.Enabled     = false;

                bug_analysis_bugReason.Enabled    = true;
                bug_analysis_main_text.Enabled    = true;
                bug_analysis_main_text.ReadOnly   = false;
                bug_analysis_status.SelectedIndex = 0;
                bug_analysis_main_text.Clear();
                bug_analysis_bugReason.SelectedIndex = 0;
                break;

            case 2:
                bug_analysis_btn_update.Enabled = false;
                bug_analysis_status.Enabled     = false;
                bug_analysis_bugReason.Enabled  = false;
                bug_analysis_main_text.Enabled  = false;
                bug_analysis_main_text.ReadOnly = true;
                break;

            case 3:
                bug_analysis_bugReason.Enabled  = false;
                bug_analysis_main_text.Enabled  = false;
                bug_analysis_main_text.ReadOnly = true;
                bug_analysis_btn_update.Enabled = false;
                bug_analysis_status.Enabled     = false;
                break;
            }
        }
示例#14
0
        private void init_audit_GUI(TableBug para_tableBug)
        {
            bug_audit_auditing_id.Text         = para_tableBug.Bug_id.ToString();
            bug_cre_audit_desc.Text            = para_tableBug.Bug_description;
            bug_cre_audit_status.SelectedIndex = para_tableBug.Bug_status - 1;
            if (para_tableBug.Bug_reason != 1)
            {
                bug_cre_audit_reason.SelectedIndex = para_tableBug.Bug_reason - 1;
                bug_cre_audit_analysis.Text        = para_tableBug.Bug_analysis;
            }
            switch (para_tableBug.Bug_status)
            {
            case 1:
                bug_audit_btn_accompanished.Enabled = false;
                bug_cre_audit_status.Enabled        = false;
                bug_cre_audit_analysis.Clear();
                bug_cre_audit_reason.SelectedIndex = 0;
                break;

            case 2:
                if (para_tableBug.Next_bug_id == -1)
                {
                    bug_audit_btn_accompanished.Enabled = true;
                    bug_cre_audit_status.Enabled        = true;
                }
                else
                {
                    bug_audit_btn_accompanished.Enabled = false;
                    bug_cre_audit_status.Enabled        = false;
                }


                break;

            case 3:
                bug_audit_btn_accompanished.Enabled = false;
                bug_cre_audit_status.Enabled        = false;
                break;
            }
        }
        public static bool Update_Next_Id(TableBug tableBug)
        {
            string cmd_str = "update table_bug set next_bug_id="
                             + tableBug.Next_bug_id.ToString() +
                             " where bug_id=" + tableBug.Bug_id;

            MySqlConnection mycon = new MySqlConnection(Form1.CONSTR);

            mycon.Open();
            MySqlCommand mycmd = new MySqlCommand(cmd_str, mycon);

            if (mycmd.ExecuteNonQuery() > 0)
            {
                mycon.Close();
                return(true);
            }
            else
            {
                mycon.Close();
                return(false);
            }
        }
        public static string Add_Bug(TableBug tableBug)
        {
            string cmd_para, cmd_value;

            cmd_para = " insert into" +
                       " table_bug" +
                       "(bug_manager," +
                       "manager_id," +
                       "bug_name,bug_description," +
                       "bug_reporter,reporter_id," +
                       "bug_level,case_id," +
                       "head_tag";
            if (tableBug.next_bug_id != -1)
            {
                cmd_para = cmd_para + ",next_bug_id";
            }
            cmd_para  = cmd_para + ")";
            cmd_value = " values(" +
                        "'" + tableBug.Bug_manager + "'," +
                        " " + tableBug.Manager_id + " ," +
                        "'" + tableBug.Bug_name + "'," +
                        "'" + tableBug.Bug_description + "'," +
                        "'" + tableBug.Bug_reporter + "'," +
                        "" + tableBug.reporter_id.ToString() + "," +
                        "" + tableBug.Bug_level + "," +
                        "" + tableBug.Case_id + "," +

                        "\"" + tableBug.Head_tag + "\"";
            if (tableBug.next_bug_id != -1)
            {
                cmd_value = cmd_value + ", " + tableBug.Next_bug_id + "";
            }

            cmd_value = cmd_value + ");";


            return(cmd_para + cmd_value);
        }
        public static int Update_Bug(TableBug tableBug, int identity)
        {
            MySqlConnection mycon = new MySqlConnection(Form1.CONSTR);

            mycon.Open();

            try
            {
                if (identity == TableBug.DEVOLOPER)
                {
                    string str = "update table_bug set bug_reason="
                                 + tableBug.Bug_reason.ToString() +
                                 " ,bug_analysis=" + "'" + tableBug.Bug_analysis + "' " +
                                 ",bug_status=" + tableBug.Bug_status.ToString() +
                                 " where bug_id = " + tableBug.Bug_id;



                    MySqlCommand mycmd =
                        new MySqlCommand(str
                                         , mycon);

                    if (mycmd.ExecuteNonQuery() > 0)
                    {
                        mycon.Close();
                        return(1);
                    }

                    else
                    {
                        mycon.Close();
                        return(0);
                    }
                }
                else
                {
                    string str = "update table_bug set bug_status="
                                 + tableBug.Bug_status.ToString() +

                                 " where bug_id="
                                 + tableBug.Bug_id.ToString() + "";

                    string       str2  = "update table_case set bug_nums=bug_nums-1 where case_id=" + tableBug.Case_id;
                    MySqlCommand mycmd =
                        new MySqlCommand(str
                                         , mycon);

                    if (mycmd.ExecuteNonQuery() > 0)
                    {
                        Console.WriteLine("11111111");
                        if (tableBug.Bug_status == 3)
                        {
                            mycmd = new MySqlCommand(str2, mycon);
                            if (mycmd.ExecuteNonQuery() > 0)
                            {
                                Console.WriteLine("22222222");
                                mycon.Close();

                                if (Is_Case_Complete(tableBug.Case_id))
                                {
                                    Console.WriteLine("33333333");
                                    string plan_id;

                                    if (Global_Database.UpdatePlanStatus(tableBug.Case_id.ToString(), out plan_id))
                                    {
                                        Console.WriteLine("4444444 plan_id= " + plan_id.ToString());

                                        if (Global_Database.UpdateProjectStatus(plan_id))
                                        {
                                            Console.WriteLine("5555555");
                                            return(4);
                                        }
                                        else
                                        {
                                            return(3);
                                        }
                                    }
                                    else
                                    {
                                        return(2);
                                    }
                                }

                                else
                                {
                                    return(1);
                                }
                            }
                            else
                            {
                                mycon.Close();
                                return(0);
                            }
                        }
                        else
                        {
                            mycon.Close();
                            return(1);
                        }
                    }

                    else
                    {
                        mycon.Close();
                        return(0);
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                mycon.Close();
            }
        }
示例#18
0
        private void waiting_audit_grid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int row_idx     = waiting_audit_grid.CurrentCell.RowIndex;
            int selected_id = int.Parse(waiting_audit_grid.Rows[row_idx].Cells[0].Value.ToString());

            tableAuditBug.Bug_id = selected_id;


            int    reason       = 0;
            string bug_analysis = "";
            string description  = (string)tableBug.Rows[row_idx][4];
            int    status       = int.Parse(tableBug.Rows[row_idx][0].ToString().Trim());

            tableAuditBug.Bug_status = status;


            if (status != 1)
            {
                reason       = int.Parse(tableBug.Rows[row_idx][8].ToString().Trim());
                bug_analysis = (string)tableBug.Rows[row_idx][12];
                bug_cre_audit_reason.SelectedIndex = reason - 1;
                bug_cre_audit_analysis.Text        = bug_analysis;


                //初始化bug版本控制
                next_id_list.Clear();
                next_id_list.Add(tableAuditBug.Bug_id);
                if (tableBug.Rows[row_idx][10].ToString().Length != 0)
                {
                    int next_id = int.Parse(tableBug.Rows[row_idx][10].ToString().Trim());
                    init_next_id_list(next_id);
                }
                if (next_id_list.Count > 1)
                {
                    bug_audit_btn_accompanished.Enabled = false;
                }
                else
                {
                    if (status == 2)
                    {
                        bug_audit_btn_accompanished.Enabled = true;
                    }
                }

                int tail_id = next_id_list[next_id_list.Count - 1];
                lastTable.Bug_id     = tail_id;
                lastTable.Bug_status = TableBug.Select_From_Table_Bug(tail_id);

                Console.WriteLine(String.Format("Bug_status={0}", lastTable.Bug_status.ToString()));
                bug_audit_vision_combo.Items.Clear();

                for (int i = 0; i < next_id_list.Count; i++)
                {
                    bug_audit_vision_combo.Items.Add(next_id_list[i]);
                }

                bug_audit_vision_combo.Enabled       = true;
                bug_audit_vision_combo.SelectedIndex = 0;
            }
            else
            {
                //next_id_list.Clear();
                bug_audit_vision_combo.Enabled = false;
                bug_audit_vision_combo.Items.Clear();
            }

            int case_id = int.Parse(tableBug.Rows[row_idx][9].ToString().Trim());

            tableAuditBug.Case_id              = case_id;
            bug_cre_audit_lbl_id.Text          = selected_id.ToString();
            bug_audit_auditing_id.Text         = selected_id.ToString();
            bug_cre_audit_desc.Text            = description;
            bug_cre_audit_status.SelectedIndex = status - 1;


            if (status == 3)
            {
                bug_cre_audit_status.Enabled        = false;
                bug_audit_btn_accompanished.Enabled = false;
            }
            else if (status == 2)
            {
                tableAuditBug.Bug_status     = 2;
                bug_cre_audit_status.Enabled = true;
                //    bug_audit_btn_accompanished.Enabled = true;
            }
            else
            {
                tableAuditBug.Bug_status            = 1;
                bug_cre_audit_status.Enabled        = false;
                bug_audit_btn_accompanished.Enabled = true;
            }
        }