Esempio n. 1
0
        public void get_single_by_website_desc(List <BsonDocument> list)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("BY website DESC:" + Environment.NewLine);

            DataTable  dt    = new DataTable();
            DataColumn order = new DataColumn("order");

            order.DataType = Type.GetType("System.Int32");
            dt.Columns.Add(order);
            DataColumn count = new DataColumn("count");

            count.DataType = Type.GetType("System.Int32");
            dt.Columns.Add(count);

            for (int i = 0; i < list.Count; i++)
            {
                DataRow row_new = dt.NewRow();
                row_new["order"] = i;
                BsonArray array = list[i]["websites"].AsBsonArray;
                ArrayList al    = new ArrayList();
                foreach (BsonValue value in array)
                {
                    bool is_has = false;
                    foreach (string name in al)
                    {
                        if (name == value.ToString())
                        {
                            is_has = true;
                        }
                    }
                    if (is_has == false)
                    {
                        al.Add(value.ToString());
                    }
                }
                row_new["count"] = al.Count;
                dt.Rows.Add(row_new);
            }

            dt.DefaultView.Sort = "count desc";
            dt = dt.DefaultView.ToTable();

            foreach (DataRow row in dt.Rows)
            {
                BsonDocument doc = list[Convert.ToInt32(row["order"].ToString())];
                sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
                sb.Append(Match100Analyse2.get_info_from_doc(doc));
            }
            sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
            this.txt_result.Text = sb.ToString();
            Match100Helper.create_log_result(sb.ToString());
            Application.DoEvents();
        }
Esempio n. 2
0
        public void get_single_by_start_time_desc(List <BsonDocument> list)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("BY START TIME ASC:" + Environment.NewLine);

            DataTable  dt    = new DataTable();
            DataColumn order = new DataColumn("order");

            order.DataType = Type.GetType("System.Int32");
            dt.Columns.Add(order);
            DataColumn persent = new DataColumn("start_time");

            persent.DataType = Type.GetType("System.String");
            dt.Columns.Add(persent);

            for (int i = 0; i < list.Count; i++)
            {
                DataRow row_new = dt.NewRow();
                row_new["order"]      = i;
                row_new["start_time"] = list[i]["start_time"].ToString();
                dt.Rows.Add(row_new);
            }

            dt.DefaultView.Sort = "start_time desc";
            dt = dt.DefaultView.ToTable();

            foreach (DataRow row in dt.Rows)
            {
                BsonDocument doc = list[Convert.ToInt32(row["order"].ToString())];
                sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
                sb.Append(Match100Analyse2.get_info_from_doc(doc));
            }
            sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
            this.txt_result.Text = sb.ToString();
            Match100Helper.create_log_result(sb.ToString());
            Application.DoEvents();
        }
Esempio n. 3
0
        private void btn_single_match_Click(object sender, EventArgs e)
        {
            ArrayList list_websites = new ArrayList();

            foreach (DataGridViewRow row in dgv_website.Rows)
            {
                if (Convert.ToBoolean(row.Cells["selected"].Value) == true)
                {
                    string website = row.Cells["website"].Value.ToString();
                    list_websites.Add(website);
                }
            }

            StringBuilder       sb   = new StringBuilder();
            List <BsonDocument> list = new List <BsonDocument>();

            foreach (DataGridViewRow row in dgv_match.Rows)
            {
                if (Convert.ToBoolean(row.Cells["selected"].Value) == true)
                {
                    string start_time = row.Cells["start_time"].Value.ToString();
                    string host       = row.Cells["host"].Value.ToString();
                    string client     = row.Cells["client"].Value.ToString();

                    BsonDocument doc = Match100Analyse2.get_max_from_single_match(start_time, host, client, 50, list_websites);
                    list.Add(doc);


                    sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
                    sb.Append(Match100Analyse2.get_info_from_doc(doc));
                    this.txt_result.Text = sb.ToString();
                    Application.DoEvents();
                }
            }
            sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
            this.txt_result.Text = sb.ToString();
            Application.DoEvents();

            if (cb_persent_asc.Checked)
            {
                get_single_by_persent_asc(list);
            }
            if (cb_persent_desc.Checked)
            {
                get_single_by_persent_desc(list);
            }
            if (cb_website_asc.Checked)
            {
                get_single_by_website_asc(list);
            }
            if (cb_website_desc.Checked)
            {
                get_single_by_website_desc(list);
            }
            if (cb_start_time_asc.Checked)
            {
                get_single_by_start_time_asc(list);
            }
            if (cb_start_time_desc.Checked)
            {
                get_single_by_start_time_desc(list);
            }
        }