/// <summary> /// Реулизация Insert /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InsertButtn_Click(object sender, RoutedEventArgs e) { if (selectedTable == Table.device) { DevicesWin devicesWin = new DevicesWin(db); devicesWin.ShowDialog(); SelectDevices(); } if (selectedTable == Table.department) { DepartmentWindow department = new DepartmentWindow(db); department.ShowDialog(); SelectDeparments(); } if (selectedTable == Table.user) { UsersWindow usersWindow = new UsersWindow(db); usersWindow.ShowDialog(); SelectUsers(); } if (selectedTable == Table.deviceNateworks) { DeviceNetworksWindow deviceNetworks = new DeviceNetworksWindow(db); deviceNetworks.ShowDialog(); SelectDeviceNetworks(); } if (selectedTable == Table.network) { NetworksWindow networks = new NetworksWindow(db); networks.ShowDialog(); SelectNetworks(); } }
/// <summary> /// Реализация Update /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpdateButton_Click(object sender, RoutedEventArgs e) { //Устройства if (shownTable == Table.device) { Devices device = tablesGrid.SelectedItem as Devices; var uDevice = db.Devices.Where(d => d.deviceID == device.deviceID).FirstOrDefault(); DevicesWin window = new DevicesWin(db, uDevice); window.ShowDialog(); SelectDevices(); } //Отделы if (shownTable == Table.department) { Departments department = tablesGrid.SelectedItem as Departments; var udepartment = db.Departments.Where(d => d.departmentID == department.departmentID).FirstOrDefault(); DepartmentWindow window = new DepartmentWindow(db, udepartment); window.ShowDialog(); SelectDeparments(); } //Пользователи if (shownTable == Table.user) { Users user = tablesGrid.SelectedItem as Users; var uUser = db.Users.Where(u => u.userID == user.userID).FirstOrDefault(); UsersWindow window = new UsersWindow(db, uUser); window.ShowDialog(); SelectUsers(); } //Сети устройства if (shownTable == Table.deviceNateworks) { DeviceNetworks network = tablesGrid.SelectedItem as DeviceNetworks; var uNetwork = db.DeviceNetworks.Where(n => n.networkID == network.networkID && n.deviceID == network.deviceID).FirstOrDefault(); DeviceNetworksWindow window = new DeviceNetworksWindow(db, uNetwork); window.ShowDialog(); SelectDeviceNetworks(); } //Сети if (shownTable == Table.network) { Networks network = tablesGrid.SelectedItem as Networks; var uNetwork = db.Networks.Where(n => n.networkID == network.networkID).FirstOrDefault(); NetworksWindow window = new NetworksWindow(db, uNetwork); window.ShowDialog(); SelectNetworks(); } }