Example #1
0
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            SelectableViewModel sv = DG_his.SelectedItem as SelectableViewModel;

            if (sv == null)
            {
                return;
            }
            Sql_Service.DeletIP(sv.ID);
            DG_his.ItemsSource = CreateData();
        }
Example #2
0
        private static ObservableCollection <SelectableViewModel> CreateData()
        {
            DataTable dt = Sql_Service.GetHis_IP();

            ObservableCollection <SelectableViewModel> lsos = new ObservableCollection <SelectableViewModel>();

            foreach (DataRow dr in dt.Rows)
            {
                SelectableViewModel aa = new SelectableViewModel();
                aa.ID     = dr["ID"].ToString();
                aa.IP     = dr["IP"].ToString();
                aa.默认网关   = dr["gateway"].ToString();
                aa.子网掩码   = dr["subnet"].ToString();
                aa.DNS服务器 = dr["dns"].ToString();
                lsos.Add(aa);
            }
            return(lsos);
        }