示例#1
0
        private void btn_two_range_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>();
            DataTable           dt   = new DataTable();

            dt.Columns.Add("start_time");
            dt.Columns.Add("host");
            dt.Columns.Add("client");
            foreach (DataGridViewRow row in dgv_match.Rows)
            {
                if (Convert.ToBoolean(row.Cells["selected"].Value) == true)
                {
                    DataRow row_new = dt.NewRow();
                    row_new["start_time"] = row.Cells["start_time"].Value.ToString();
                    row_new["host"]       = row.Cells["host"].Value.ToString();
                    row_new["client"]     = row.Cells["client"].Value.ToString();
                    dt.Rows.Add(row_new);
                }
            }

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                for (int j = i + 1; j < dt.Rows.Count; j++)
                {
                    for (int k = 1; k < 101; k++)
                    {
                        BsonDocument doc = Match500Analyse.get_max_from_two_match(dt.Rows[i]["start_time"].ToString(),
                                                                                  dt.Rows[i]["host"].ToString(),
                                                                                  dt.Rows[i]["client"].ToString(),
                                                                                  dt.Rows[j]["start_time"].ToString(),
                                                                                  dt.Rows[j]["host"].ToString(),
                                                                                  dt.Rows[j]["client"].ToString(),
                                                                                  k, list_websites);
                        list.Add(doc);
                        sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
                        sb.Append(Match500Analyse.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();
        }
示例#2
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 = Match500Analyse.get_max_from_single_match(start_time, host, client, 50, list_websites);
                    list.Add(doc);


                    sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
                    sb.Append(Match500Analyse.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);
            }
        }
示例#3
0
        public void get_two_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(Match500Analyse.get_info_from_doc(doc));
            }
            sb.Append("----------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
            this.txt_result.Text = sb.ToString();
            Application.DoEvents();
        }
示例#4
0
        public void get_three_by_persent_desc(List <BsonDocument> list)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("BY PERSENT DESC:" + 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("persent");

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

            for (int i = 0; i < list.Count; i++)
            {
                DataRow row_new = dt.NewRow();
                row_new["order"]   = i;
                row_new["persent"] = Convert.ToDouble(list[i]["min_value"].ToString()) / Convert.ToDouble(list[i]["bid_count"].ToString()) * 100;
                dt.Rows.Add(row_new);
            }

            dt.DefaultView.Sort = "persent 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(Match500Analyse.get_info_from_doc(doc));
            }
            sb.Append("------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" + Environment.NewLine);
            this.txt_result.Text = sb.ToString();
            Application.DoEvents();
        }