Exemplo n.º 1
0
 public TableFrame()
 {
     InitializeComponent();
     using (MyBase db = new MyBase())
     {
         var t = db.USERS_LOG.FirstOrDefault();
         db.USERS_LOG.Load();
         TableGrid.ItemsSource = db.USERS_LOG.Local.ToList();
     }
 }
Exemplo n.º 2
0
 public AddFrame()
 {
     InitializeComponent();
     using (MyBase db = new MyBase())
     {
         unitOfWork._UsersInfoUnits.ListOfInfo = db.USERS_INFO.ToList();
         unitOfWork._UsersLogUnits.ListOfLog   = db.USERS_LOG.ToList();
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 private void FindObj_Click(object sender, RoutedEventArgs e)
 {
     using (MyBase db = new MyBase())
     {
         var forDel = db.USERS_LOG.Where(p => p.UserLogID == 5);
         foreach (var f in forDel)
         {
             MessageBox.Show(f.UserLogName);
         }
     }
 }
Exemplo n.º 4
0
 public EditFrame()
 {
     InitializeComponent();
     using (MyBase db = new MyBase())
     {
         unitOfWork._UsersInfoUnits.ListOfInfo = db.USERS_INFO.ToList();
         unitOfWork._UsersLogUnits.ListOfLog   = db.USERS_LOG.ToList();
         var t = db.USERS_LOG.FirstOrDefault();
         db.USERS_LOG.Load();
         TableGrid.ItemsSource = db.USERS_LOG.Local.ToList();
     }
 }
Exemplo n.º 5
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     using (MyBase db = new MyBase())
     {
         var log = unitOfWork._UsersLogUnits._UsersLogContext.USERS_LOG.Where(x => x.UserLogName == DeleteName.Text);
         foreach (var x in log)
         {
             unitOfWork._UsersLogUnits._UsersLogContext.USERS_LOG.Remove(x);
         }
         unitOfWork.Save();
         MessageBox.Show("Объект удалён!");
     }
 }
Exemplo n.º 6
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (MyBase db = new MyBase())
         {
             USERS_LOG lec = new USERS_LOG();
             lec.UserLogName     = PulpitName.Text;
             lec.UserLogPassword = AuditoriumName.Text;
             unitOfWork._UsersLogUnits._UsersLogContext.USERS_LOG.Add(lec);
             unitOfWork.Save();
             MessageBox.Show("Успешно добавлено!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }