private void button_release_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("是否确认发布测试项目?所有测试计划涉及到的人员将会被通知!", "发布测试项目", MessageBoxButtons.OKCancel);

            if (result == DialogResult.Cancel)
            {
                return;
            }
            //添加计划信息到数据库,通知相关人员
            string project_name        = preForm.textBox_projectName.Text;
            string project_description = preForm.textBox_description.Text;
            string project_managerID   = preForm.textBox_managerID.Text;
            string project_managerName = preForm.textBox_managerName.Text;
            int    plan_nums           = plans.Count;

            // try
            // {
            string projectID = Global_Database.AddProjectToDatabase(project_name, project_description, project_managerID, project_managerName, plan_nums);

            //MessageBox.Show(projectID);
            Global_Database.AddPlanToDatabase(plans, projectID);
            MessageBox.Show("项目发布成功!");
            this.Close();
            //  }
            //  catch(MySqlException ex)
            //  {
            //     MessageBox.Show("数据库连接异常!");
            //     MessageBox.Show(ex.Message);
            // }
        }
Exemple #2
0
 public void InitiateInfo()
 {
     dict = Global_Database.SearchTesterInfo();
     foreach (var item in dict)
     {
         comboBox_managerName.Items.Add(item.Key);
     }
 }
        public ViewPlan_Tester_2(string planID)
        {
            InitializeComponent();
            this.planID = planID;

            lockStatus = Global_Database.SearchPlanLock(planID);
            if (lockStatus == 1)
            {
                mode = 1;
            }

            InititateDataGridView();
        }
        private void button_release_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("确认用例已编辑完毕吗?确认后用例将不能再被编辑!", "添加完毕", MessageBoxButtons.OKCancel);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            Global_Database.AddPlanLock(planID);
            lockStatus = 1;
            InititateDataGridView();
            MessageBox.Show("用例信息已确认!");
        }
        private void button_deletePLan_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("确认要删除选中的用例吗?", "删除用例", MessageBoxButtons.OKCancel);

            if (result == DialogResult.Cancel)
            {
                return;
            }
            int    index   = dataGridView1.SelectedCells[0].RowIndex;
            string case_id = dataGridView1.Rows[index].Cells["case_id"].Value.ToString();

            Global_Database.DeleteCaseFromDatabase(case_id);
            this.InititateDataGridView();
            MessageBox.Show("删除成功");
        }
        private void InitiateInfos()
        {
            plan   p           = new plan("", "", "", "", 0);
            string projectID   = "";
            int    plan_status = 0;

            Global_Database.SearchPlanInfo(planID, out p, out plan_status, out projectID);

            MessageBox.Show(p.description);
            textBox_planName.Text           = p.name;
            comboBox_priority.SelectedIndex = p.priority;
            textBox_manageName.Text         = p.manager_name;
            textBox_manageName.ReadOnly     = true;
            textBox_managerID.Text          = p.manager_id;
            textBox_description.Text        = p.description;
            comboBox_priority.Enabled       = false;
        }
 private void Initiate()
 {
     haveBugs = Global_Database.WhetherHaveBug(caseID);
     if (haveBugs)
     {
         comboBox_result.SelectedIndex = 1;
         comboBox_result.Enabled       = false;
         button_uploadBug.Enabled      = true;
     }
     if (!haveBugs)
     {
         if (comboBox_result.SelectedIndex == 1)
         {
             button_uploadResult.Enabled = false;
         }
     }
 }
 private void button_nextPage_Click(object sender, EventArgs e)
 {
     if (textBox_description.Text.Length == 0 || textBox_caseName.Text.Length == 0 ||
         textBox_step.Text.Length == 0)
     {
         MessageBox.Show("带*号的项目必须填写!");
         return;
     }
     if (mode == 1)
     {
         Global_Database.AddCaseToDatabase(textBox_caseName.Text, comboBox_status.SelectedIndex + 1, textBox_description.Text, textBox_step.Text, planID);
         MessageBox.Show("添加完成!");
         preform.InititateDataGridView();
         this.Close();
     }
     else if (mode == 2)
     {
         Global_Database.AlterCaseFromDatabase(textBox_ID.Text, textBox_caseName.Text, comboBox_status.SelectedIndex + 1, textBox_description.Text, textBox_step.Text);
         preform.InititateDataGridView();
         MessageBox.Show("修改完成");
         this.Close();
     }
 }
        private void button_uploadResult_Click(object sender, EventArgs e)
        {
            int status = 3 - comboBox_result.SelectedIndex;

            Global_Database.UploadTestResult(caseID, status);
            //case 完成情况1 情况2为审核缺陷通过。在那里要先通过bug确定case是否完成。
            //case 完成 更新plan状态.
            //plan 完成 更新project状态.
            string planID = "";

            MessageBox.Show("提交成功!");
            bool planCompleted = Global_Database.UpdatePlanStatus(caseID, out planID);

            if (planCompleted)
            {
                MessageBox.Show("所属计划已完成!");
                if (Global_Database.UpdateProjectStatus(planID))
                {
                    MessageBox.Show("所属项目已完成!");
                }
            }

            this.Close();
        }
        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();
            }
        }