Exemplo n.º 1
0
        public List <List <string> > GetData()
        {
            List <List <string> > rtn_list = new List <List <string> >();
            Case_tagClass         ct       = new Case_tagClass();
            List <Case_tagClass>  list     = ct.Read();
            TcaseClass            tc       = new TcaseClass();
            TagsClass             tags     = new TagsClass();


            foreach (var item in tc.Read())
            {
                List <string> myArrayList = new List <string>();
                myArrayList.Add(item.case_id_name);
                myArrayList.Add(item.case_id.ToString());
                int i = 0;
                foreach (var item1 in tags.Read())
                {
                    if (i == 0)
                    {
                        myArrayList.Add(item1.tag_id.ToString());
                    }
                    i++;
                    if (list.Any(cus => cus.f_case_id == item.case_id && cus.f_tag_id == item1.tag_id))
                    {
                        myArrayList.Add("checked");
                    }
                    else
                    {
                        myArrayList.Add("");
                    }
                }
                rtn_list.Add(myArrayList);
            }
            return(rtn_list);
        }
Exemplo n.º 2
0
        public void Retire(TcaseClass p)
        {
            MysqlConnect();
            string       query = "UPDATE `tcase` SET `retire` = 1 WHERE `tcase`.`case_id` = " + p.case_id;
            MySqlCommand comm  = new MySqlCommand(query);

            comm.Connection = mysql;
            mysql.Open();
            comm.ExecuteNonQuery();
            mysql.Close();
            return;
        }
Exemplo n.º 3
0
        public void Add(TcaseClass p)
        {
            MysqlConnect();
            string       query = "INSERT INTO `tcase` (`case_id`, `case_id_name`) VALUES(NULL, '" + p.case_id_name + "');";
            MySqlCommand comm  = new MySqlCommand(query);

            comm.Connection = mysql;
            mysql.Open();
            comm.ExecuteNonQuery();
            mysql.Close();
            return;
        }
Exemplo n.º 4
0
        public bool isRealExist(TcaseClass p)
        {
            MysqlConnect();
            string       query = "select * from tcase where retire=0 and case_id_name='" + p.case_id_name + "'";
            MySqlCommand comm  = new MySqlCommand(query);

            comm.Connection = mysql;
            mysql.Open();

            MySqlDataReader dr  = comm.ExecuteReader();
            bool            flg = dr.HasRows;

            mysql.Close();
            if (flg)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        public TcaseClass Detail(int id)
        {
            MysqlConnect();
            string       query = "select * from tcase where retire=0 and case_id=" + id;
            MySqlCommand comm  = new MySqlCommand(query);

            comm.Connection = mysql;
            mysql.Open();

            MySqlDataReader dr = comm.ExecuteReader();

            dr.Read();
            TcaseClass x =
                new TcaseClass
            {
                case_id      = (int)dr["case_id"],
                case_id_name = dr["case_id_name"].ToString()
            };

            mysql.Close();

            return(x);
        }
Exemplo n.º 6
0
        public string GetRelationOfTestcaseAndTagCode(string[] child_names)
        {
            string code = "";

            Case_tagClass case_TagClass = new Case_tagClass();
            TcaseClass    tcaseClass    = new TcaseClass();
            TagsClass     tagsClass     = new TagsClass();

            List <TcaseClass> list_case = tcaseClass.Read();


            string real_code = "";

            foreach (var case_ in list_case)
            {
                Boolean flg = false;
                code  = "<tr>";
                code += "<td>";
                code += case_.case_id_name;
                code += "</td>";

                foreach (string child_name in child_names)
                {
                    string r_child_name = child_name.Split('#')[0];
                    string type         = child_name.Split('#')[3];


                    TagsClass tc = new TagsClass();
                    if (tagsClass.isRealExist(new TagsClass {
                        tag_name = r_child_name
                    }))
                    {
                        tc = tagsClass.Detail(r_child_name);
                        if (case_TagClass.isExist(new Case_tagClass {
                            f_tag_id = tc.tag_id, f_case_id = case_.case_id
                        }))
                        {
                            code += "<td>Yes</td>";
                            flg   = true;
                            continue;
                        }
                        else
                        {
                            code += "<td></td>";
                            if (type == "and")
                            {
                                flg = false;
                                break;
                            }
                        }
                    }
                    else
                    {
                        code += "<td>" + "</td>";
                        if (type == "and")
                        {
                            flg = false;
                            break;
                        }
                    }
                }
                code += "</tr>";

                if (flg)
                {
                    real_code += code;
                }
            }
            return(real_code);
        }