Ejemplo n.º 1
0
        private void 打开CMSTreeNode_Click(object sender, EventArgs e)
        {
            DbCommand cmd = conn.CreateCommand();

            cmd.CommandText = String.Format("SELECT TOP 1000 * from {0}", treeView1.SelectedNode.Text);
            textBox1.Text   = cmd.CommandText;
            DbDataReader reader = cmd.ExecuteReader();

            ListViewTool.RefreshByDbDataReader(listView1, reader);
            reader.Close();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int value = (int)numericUpDown1.Value;

            cmd.CommandText = String.Format(@"
            IF OBJECT_ID(N'tbC2Inew',N'U') is not null
	            DROP TABLE tbC2Inew
            CREATE TABLE [dbo].[tbC2Inew]
            (
	            [SCell] [varchar](50) NULL,
	            [Ncell] [varchar](50) NULL,
	            [C2I_mean] [float] NULL,
	            [C2I_std] [float] NULL,
	            [PrbC2I9] [float] NULL,
	            [PrbABS6] [float] NULL
            )");
            cmd.ExecuteNonQuery();

            cmd.CommandText = String.Format("SELECT * FROM #C2ITemp WHERE count>={0}", value);
            reader          = cmd.ExecuteReader();
            List <C2I> C2IList = new List <C2I>();

            while (reader.Read())
            {
                C2I c2i = new C2I();
                c2i.SCell    = reader["SCell"].ToString();
                c2i.NCell    = reader["NCell"].ToString();
                c2i.C2I_mean = double.Parse(reader["C2I_mean"].ToString());
                c2i.C2I_std  = double.Parse(reader["C2I_std"].ToString());
                if (c2i.C2I_std == 0)
                {
                    c2i.PrbC2I9 = c2i.C2I_mean < 9 ? 1 : 0;
                }
                else
                {
                    if (c2i.C2I_mean <= 9)
                    {
                        c2i.PrbC2I9 = Prb.getProbability(c2i.C2I_mean, 9, c2i.C2I_mean, c2i.C2I_std) + 0.5;
                    }
                    else
                    {
                        c2i.PrbC2I9 = 0.5 - Prb.getProbability(9, c2i.C2I_mean, c2i.C2I_mean, c2i.C2I_std);
                    }
                    c2i.PrbABS6 = Prb.getProbability(-6, 6, c2i.C2I_mean, c2i.C2I_std);
                }
                C2IList.Add(c2i);
            }
            reader.Close();

            foreach (C2I c2i in C2IList)
            {
                cmd.CommandText = String.Format(@"
                INSERT INTO [dbo].[tbC2Inew]
                           ([SCell]
                           ,[Ncell]
                           ,[C2I_mean]
                           ,[C2I_std]
                           ,[PrbC2I9]
                           ,[PrbABS6])
                     VALUES
                           ('{0}','{1}',{2},{3},{4},{5})
                ", c2i.SCell, c2i.NCell, c2i.C2I_mean, c2i.C2I_std, c2i.PrbC2I9, c2i.PrbABS6);
                cmd.ExecuteNonQuery();
            }

            cmd.CommandText = "SELECT * FROM tbC2Inew";
            reader          = cmd.ExecuteReader();
            ListViewTool.RefreshByDbDataReader(listview, reader);
            reader.Close();
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            double value = (double)numericUpDown1.Value / 100;

            C2I3List.Clear();

            foreach (C2IPanel.C2I c2i in C2IList)
            {
                C2I3 c2i3 = new C2I3();
                c2i3.a = c2i.SCell;
                c2i3.b = c2i.NCell;

                if (c2i.PrbABS6 < value)
                {
                    continue;
                }

                foreach (C2IPanel.C2I c2i_ in C2IList)
                {
                    if (c2i_.PrbABS6 < value)
                    {
                        continue;
                    }
                    if (match(c2i, c2i_) == MatchType.SS)
                    {
                        foreach (C2IPanel.C2I c2i__ in C2IList)
                        {
                            if (c2i__.PrbABS6 < value)
                            {
                                continue;
                            }
                            C2IPanel.C2I c2iTemp = new C2IPanel.C2I()
                            {
                                SCell = c2i.NCell, NCell = c2i_.NCell
                            };
                            MatchType type = match(c2i__, c2iTemp);
                            if (type == MatchType.NSBoth || type == MatchType.SNBoth)
                            {
                                c2i3.c = c2i_.NCell;
                                C2I3List.Add(c2i3);
                            }
                        }
                    }
                    else if (match(c2i, c2i_) == MatchType.SN)
                    {
                        foreach (C2IPanel.C2I c2i__ in C2IList)
                        {
                            if (c2i__.PrbABS6 < value)
                            {
                                continue;
                            }
                            C2IPanel.C2I c2iTemp = new C2IPanel.C2I()
                            {
                                SCell = c2i.SCell, NCell = c2i_.NCell
                            };
                            MatchType type = match(c2i__, c2iTemp);
                            if (type == MatchType.NSBoth || type == MatchType.SNBoth)
                            {
                                c2i3.c = c2i_.NCell;
                                C2I3List.Add(c2i3);
                            }
                        }
                    }
                    else if (match(c2i, c2i_) == MatchType.NN)
                    {
                        foreach (C2IPanel.C2I c2i__ in C2IList)
                        {
                            if (c2i__.PrbABS6 < value)
                            {
                                continue;
                            }
                            C2IPanel.C2I c2iTemp = new C2IPanel.C2I()
                            {
                                SCell = c2i.SCell, NCell = c2i_.SCell
                            };
                            MatchType type = match(c2i__, c2iTemp);
                            if (type == MatchType.NSBoth || type == MatchType.SNBoth)
                            {
                                c2i3.c = c2i_.SCell;
                                C2I3List.Add(c2i3);
                            }
                        }
                    }
                    else if (match(c2i, c2i_) == MatchType.NS)
                    {
                        foreach (C2IPanel.C2I c2i__ in C2IList)
                        {
                            if (c2i__.PrbABS6 < value)
                            {
                                continue;
                            }
                            C2IPanel.C2I c2iTemp = new C2IPanel.C2I()
                            {
                                SCell = c2i.NCell, NCell = c2i_.SCell
                            };
                            MatchType type = match(c2i__, c2iTemp);
                            if (type == MatchType.NSBoth || type == MatchType.SNBoth)
                            {
                                c2i3.c = c2i_.SCell;
                                C2I3List.Add(c2i3);
                            }
                        }
                    }
                }
            }

            cmd.CommandText = String.Format(@"
            IF OBJECT_ID(N'tbC2I3',N'U') is not null
	            DROP TABLE tbC2I3
            CREATE TABLE [dbo].[tbC2I3](
	            [aCell] [varchar](50) NULL,
	            [bCell] [varchar](50) NULL,
	            [cCell] [varchar](50) NULL
            )");
            cmd.ExecuteNonQuery();

            for (int i = 0; i < C2I3List.Count; i++)
            {
                for (int j = i + 1; j < C2I3List.Count; j++)
                {
                    if (IsSimaliar(C2I3List[i], C2I3List[j]))
                    {
                        C2I3List.RemoveAt(j);
                        j--;
                    }
                }
            }

            foreach (C2I3 c2i3 in C2I3List)
            {
                cmd.CommandText = String.Format(@"
                INSERT INTO [dbo].[tbC2I3]
                           ([aCell]
                           ,[bCell]
                           ,[cCell])
                VALUES('{0}','{1}','{2}')", c2i3.a, c2i3.b, c2i3.c);
                cmd.ExecuteNonQuery();
            }

            cmd.CommandText = "SELECT * FROM tbC2I3";
            reader          = cmd.ExecuteReader();
            ListViewTool.RefreshByDbDataReader(listview, reader);
            reader.Close();
        }