示例#1
0
        public List <Sob> SobListBD()
        {
            List <Sob> sobs2 = new List <Sob>();

            if (pathBD.Split('.')[1] == "db" || pathBD.Split('.')[1] == "db3")
            {
                DataAccesBDData.Path = pathBD;

                string uslovietime = String.Empty;

                string sz = "  order by Primary_Key";

                // CommandText = "select * from [Событие] Where (ИмяФайла Like '%_" + dateTime.Day.ToString("00") + "."+ dateTime.Month.ToString("00")+".2019 %' ) order by Код desc"

                var ListSob = DataAccesBDData.GetDataSobTop10("10");

                foreach (var d in ListSob)
                {
                    sobs2.Add(new Sob()
                    {
                        dataTime = DateTime.Now
                    });;
                }
            }
            return(sobs2);
        }
示例#2
0
        public void SobListBD()
        {
            if (pathBD.Split('.')[1] == "db" || pathBD.Split('.')[1] == "db3")
            {
                DataAccesBDData.Path = pathBD;

                string uslovietime = String.Empty;

                string sz = "  order by Primary_Key";

                // CommandText = "select * from [Событие] Where (ИмяФайла Like '%_" + dateTime.Day.ToString("00") + "."+ dateTime.Month.ToString("00")+".2019 %' ) order by Код desc"

                var ListSob = DataAccesBDData.GetDataSobTop10(textColSobList.Text);
                list.ItemsSource = ListSob;
                try
                {
                    if (chekNoise.IsChecked == true)
                    {
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error1" + ex.ToString());
                }
            }
            else
            {
                string connectionString = @"Provider = Microsoft.ACE.OLEDB.12.0; Data Source =" + pathBD;
                var    podg             = new OleDbConnection(connectionString);
                podg.Open();
                int      timenaz  = Convert.ToInt32(textH.Text);
                DateTime dateTime = new DateTime();
                dateTime = DateTime.UtcNow;
                DateTime dateTime1 = new DateTime();
                dateTime1 = DateTime.UtcNow;
                dateTime1 = dateTime1.AddHours(-timenaz);
                string uslovietime = String.Empty;



                var camand = new OleDbCommand
                {
                    Connection  = podg,
                    CommandText = "select TOP 10 from [Событие] order by Код"
                                  // CommandText = "select * from [Событие] Where (ИмяФайла Like '%_" + dateTime.Day.ToString("00") + "."+ dateTime.Month.ToString("00")+".2019 %' ) order by Код desc"
                };


                try
                {
                    var chit = camand.ExecuteReader();

                    while (chit.Read() == true)
                    {
                        if (chekNoise.IsChecked == true)
                        {
                            if (!String.IsNullOrEmpty(chit.GetValue(55).ToString()) && Convert.ToBoolean(chit.GetValue(55)))
                            {
                            }
                            else
                            {
                                int[] masA = new int[12];
                                int[] masN = new int[12];
                                // MessageBox.Show((chit.GetValue(3)).ToString() + "\n" + (chit.GetValue(4)).ToString() + "\n" + (chit.GetValue(5)).ToString());

                                masA[0]  = Convert.ToInt32(chit.GetValue(5));
                                masA[1]  = Convert.ToInt32(chit.GetValue(6));
                                masA[2]  = Convert.ToInt32(chit.GetValue(7));
                                masA[3]  = Convert.ToInt32(chit.GetValue(8));
                                masA[4]  = Convert.ToInt32(chit.GetValue(9));
                                masA[5]  = Convert.ToInt32(chit.GetValue(10));
                                masA[6]  = Convert.ToInt32(chit.GetValue(11));
                                masA[7]  = Convert.ToInt32(chit.GetValue(12));
                                masA[8]  = Convert.ToInt32(chit.GetValue(13));
                                masA[9]  = Convert.ToInt32(chit.GetValue(14));
                                masA[10] = Convert.ToInt32(chit.GetValue(15));
                                masA[11] = Convert.ToInt32(chit.GetValue(16));

                                masN[0]  = Convert.ToInt32(chit.GetValue(18));
                                masN[1]  = Convert.ToInt32(chit.GetValue(19));
                                masN[2]  = Convert.ToInt32(chit.GetValue(20));
                                masN[3]  = Convert.ToInt32(chit.GetValue(21));
                                masN[4]  = Convert.ToInt32(chit.GetValue(22));
                                masN[5]  = Convert.ToInt32(chit.GetValue(23));
                                masN[6]  = Convert.ToInt32(chit.GetValue(24));
                                masN[7]  = Convert.ToInt32(chit.GetValue(25));
                                masN[8]  = Convert.ToInt32(chit.GetValue(26));
                                masN[9]  = Convert.ToInt32(chit.GetValue(27));
                                masN[10] = Convert.ToInt32(chit.GetValue(28));
                                masN[11] = Convert.ToInt32(chit.GetValue(29));

                                // MessageBox.Show((chit.GetValue(3)).ToString()+"\n"+ (chit.GetValue(4)).ToString() + "\n" + (chit.GetValue(5)).ToString());
                                // sobs.Add(new Sob() { namePSB= chit.GetValue(3).ToString(), kl=Convert.ToInt32(chit.GetValue(2)), masA=masA, masN=masN, dataTime=new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[1]), Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[2]), 0, 0) });
                                // x = Convert.ToInt32(chit.GetValue(1));
                                sobs.Add(new Sob()
                                {
                                    namePSB = chit.GetValue(3).ToString(), kl = Convert.ToInt32(chit.GetValue(4)), masA = masA, masN = masN, dataTime = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[1]), Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[2]), 0, 0)
                                });
                            }
                        }
                        else
                        {
                            //Debug.WriteLine("dfgd"+chit.FieldCount.ToString());

                            int[] masA = new int[12];
                            int[] masN = new int[12];
                            // MessageBox.Show((chit.GetValue(3)).ToString() + "\n" + (chit.GetValue(4)).ToString() + "\n" + (chit.GetValue(5)).ToString());

                            masA[0]  = Convert.ToInt32(chit.GetValue(5));
                            masA[1]  = Convert.ToInt32(chit.GetValue(6));
                            masA[2]  = Convert.ToInt32(chit.GetValue(7));
                            masA[3]  = Convert.ToInt32(chit.GetValue(8));
                            masA[4]  = Convert.ToInt32(chit.GetValue(9));
                            masA[5]  = Convert.ToInt32(chit.GetValue(10));
                            masA[6]  = Convert.ToInt32(chit.GetValue(11));
                            masA[7]  = Convert.ToInt32(chit.GetValue(12));
                            masA[8]  = Convert.ToInt32(chit.GetValue(13));
                            masA[9]  = Convert.ToInt32(chit.GetValue(14));
                            masA[10] = Convert.ToInt32(chit.GetValue(15));
                            masA[11] = Convert.ToInt32(chit.GetValue(16));

                            masN[0]  = Convert.ToInt32(chit.GetValue(18));
                            masN[1]  = Convert.ToInt32(chit.GetValue(19));
                            masN[2]  = Convert.ToInt32(chit.GetValue(20));
                            masN[3]  = Convert.ToInt32(chit.GetValue(21));
                            masN[4]  = Convert.ToInt32(chit.GetValue(22));
                            masN[5]  = Convert.ToInt32(chit.GetValue(23));
                            masN[6]  = Convert.ToInt32(chit.GetValue(24));
                            masN[7]  = Convert.ToInt32(chit.GetValue(25));
                            masN[8]  = Convert.ToInt32(chit.GetValue(26));
                            masN[9]  = Convert.ToInt32(chit.GetValue(27));
                            masN[10] = Convert.ToInt32(chit.GetValue(28));
                            masN[11] = Convert.ToInt32(chit.GetValue(29));

                            // MessageBox.Show((chit.GetValue(3)).ToString()+"\n"+ (chit.GetValue(4)).ToString() + "\n" + (chit.GetValue(5)).ToString());
                            // sobs.Add(new Sob() { namePSB= chit.GetValue(3).ToString(), kl=Convert.ToInt32(chit.GetValue(2)), masA=masA, masN=masN, dataTime=new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[1]), Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[2]), 0, 0) });
                            // x = Convert.ToInt32(chit.GetValue(1));
                            // sobs.Add(new Sob() { namePSB = chit.GetValue(3).ToString(), kl = Convert.ToInt32(chit.GetValue(4)), masA = masA, masN = masN, dataTime = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[1]), Convert.ToInt32(chit.GetValue(1).ToString().Split('.')[2]), 0, 0) });
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error1" + ex.ToString());
                }



                podg.Close();
            }
        }