Пример #1
0
        private void AddIpButton_Click(object sender, RoutedEventArgs e)
        {
            string AllIp = IpListBox.Text;

            AllIp = AllIp.Replace("\r", "");
            string[] IpList = AllIp.Split('\n');
            DatabaseDataSet.ipsDataTable ipsDt = new DatabaseDataSet.ipsDataTable();
            foreach (string ip in IpList)
            {
                Regex rx = new Regex(@"((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))");
                if (rx.IsMatch(ip))
                {
                    DataRow row = ipsDt.NewRow();
                    row["ip"]      = ip;
                    row["country"] = GetstringIpAddress(ip);
                    ipsDt.Rows.Add(row);
                }
            }
            DatabaseDataSetTableAdapters.ipsTableAdapter ipsTa = new DatabaseDataSetTableAdapters.ipsTableAdapter();
            try
            {
                ipsTa.Update(ipsDt);
                ipsTa.Fill(PublicClass.ipsDataTable);
            }
            catch (Exception ex)
            {
            }
            this.Close();
        }
Пример #2
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     while (IplistView.SelectedItems.Count>0)
     {
         DataRowView rowveiw = (DataRowView)IplistView.SelectedItems[0];
         rowveiw.Delete();
     }
     DatabaseDataSetTableAdapters.ipsTableAdapter ipsTa = new DatabaseDataSetTableAdapters.ipsTableAdapter();
     ipsTa.Update(PublicClass.ipsDataTable);
 }
Пример #3
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     while (IplistView.SelectedItems.Count > 0)
     {
         DataRowView rowveiw = (DataRowView)IplistView.SelectedItems[0];
         rowveiw.Delete();
     }
     DatabaseDataSetTableAdapters.ipsTableAdapter ipsTa = new DatabaseDataSetTableAdapters.ipsTableAdapter();
     ipsTa.Update(PublicClass.ipsDataTable);
 }
Пример #4
0
        private void AddIpButton_Click(object sender, RoutedEventArgs e)
        {
            string AllIp = IpListBox.Text;
            AllIp = AllIp.Replace("\r", "");
            string[] IpList = AllIp.Split('\n');
            DatabaseDataSet.ipsDataTable ipsDt = new DatabaseDataSet.ipsDataTable();
            foreach (string ip in IpList)
            {
                Regex rx = new Regex(@"((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))");
                if (rx.IsMatch(ip))
                {
                    DataRow row = ipsDt.NewRow();
                    row["ip"] = ip;
                    row["country"] = GetstringIpAddress(ip);
                    ipsDt.Rows.Add(row);
                }
            }
            DatabaseDataSetTableAdapters.ipsTableAdapter ipsTa = new DatabaseDataSetTableAdapters.ipsTableAdapter();
            try
            {
                ipsTa.Update(ipsDt);
                ipsTa.Fill(PublicClass.ipsDataTable);
            }
            catch (Exception ex)
            {

            }
            this.Close();
        }