Beispiel #1
0
 private void InitializeDataGrid()
 {
     MaintenanceDBContext.IntitalizeDB();
     maintenences = MaintenanceDBContext.GetMaintenances();
     MaintenanceDataGrid.Items.Clear();
     foreach (MaintenanceDBContext maintenence in maintenences)
     {
         MaintenanceDataGrid.Items.Add(maintenence);
     }
 }
Beispiel #2
0
        private void MaintenanceDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MaintenanceDBContext maintenance = ((MaintenanceDBContext)MaintenanceDataGrid.SelectedItem);

            if (maintenance != null)
            {
                maintenenceId        = maintenance.Id;
                MaterialId.Text      = maintenance.MaterialId.ToString();
                MaterialName.Text    = maintenance.MaterialName;
                MaterialType.Text    = maintenance.MaterialType;
                MaintenanceCost.Text = maintenance.MaintenanceCost.ToString();
                MaintenanceDate.Text = maintenance.MaintenanceDate;
            }
        }
Beispiel #3
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateAll())
     {
         MaintenanceDBContext.IntitalizeDB();
         MaintenanceDBContext.Inserst(int.Parse(MaterialId.Text.ToString()), MaterialName.Text.ToString(), MaterialType.Text.ToString(), int.Parse(MaintenanceCost.Text), MaintenanceDate.Text.ToString());
         InitializeDataGrid();
         ClearAll();
         WindowSuccess success = new WindowSuccess();
         success.SetContent("Maintenance Saved Succefully");
         success.Show();
     }
     else
     {
         WindowError error = new WindowError();
         error.SetContent("Empty Filed Or Invalid Input");
         error.Show();
     }
 }
Beispiel #4
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (maintenenceId != 0)
     {
         MaintenanceDBContext.IntitalizeDB();
         MaintenanceDBContext.Delete(maintenenceId);
         InitializeDataGrid();
         ClearAll();
         WindowSuccess success = new WindowSuccess();
         success.SetContent("Maintenance Deleted Succefully");
         success.Show();
     }
     else
     {
         WindowError error = new WindowError();
         error.SetContent("Maintenance Is Not Selected");
         error.Show();
     }
 }
Beispiel #5
0
 private void UpdateButton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateAll() && maintenenceId != 0)
     {
         MaintenanceDBContext.IntitalizeDB();
         MaintenanceDBContext.Update(maintenenceId, int.Parse(MaterialId.Text.ToString()), MaterialName.Text.ToString(), MaterialType.Text.ToString(), int.Parse(MaintenanceCost.Text.ToString()), MaintenanceDate.Text.ToString());
         InitializeDataGrid();
         ClearAll();
         WindowSuccess success = new WindowSuccess();
         success.SetContent("Maintenance Updated Succefully");
         success.Show();
     }
     else
     {
         WindowError error = new WindowError();
         error.SetContent("Maintenance Is Not Selected");
         error.Show();
     }
 }
 public Repository(MaintenanceDBContext maintenanceDBContext)
 {
     this.maintenanceDBContext = maintenanceDBContext;
     // this.dbSet = maintenanceDBContext.Set<T>();
 }
 public UnitOfWork(MaintenanceDBContext maintenenctDBContext)
 {
     this._maintenenceDBContext = maintenenctDBContext;
 }
 public UnitOfWork()
 {
     _maintenenceDBContext = new MaintenanceDBContext();
 }