Browse Source

Добавлены комментарии, удалено лишнее представление

Вадим Королёв 1 year ago
parent
commit
820897692c

+ 7 - 2
InvestTracker/Entities/InvestContext.cs

@@ -20,8 +20,13 @@ public partial class InvestContext : DbContext
     public virtual DbSet<Title> Titles { get; set; }
 
     protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
-#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
-        => optionsBuilder.UseSqlServer("Data Source=srv-wsr\\is3;Initial Catalog=invest;User ID=user12;Password=user12;Encrypt=False");
+    {
+        try {
+            return optionsBuilder.UseSqlServer("Data Source=srv-wsr\\is3;Initial Catalog=invest;User ID=user12;Password=user12;Encrypt=False");
+        } catch (Exception ex) {
+            return optionsBuilder.UseSqlServer("Data Source=vpmt.ru\\is3;Initial Catalog=invest;User ID=user12;Password=user12;Encrypt=False");
+        }
+    }
 
     protected override void OnModelCreating(ModelBuilder modelBuilder)
     {

+ 22 - 5
InvestTracker/VM/EmployeeBrowseVM.cs

@@ -57,39 +57,56 @@ namespace InvestTracker.VM
             AllTitles = new ObservableCollection<Title>(_dbContext.Titles.ToList());
         }
 
+        /// <summary>
+        /// Выполняет отмену
+        /// </summary>
         private void Undo_Executed()
         {
             MessageBox.Show("Undoing");
             isDirty = true;
         }
 
+        /// <summary>
+        /// Сохраняет все изменения
+        /// </summary>
         private void Save_Executed()
         {
             _dbContext.SaveChanges();
             GridBlocked = true;
             isDirty = false;
         }
-
+        
+        /// <summary>
+        /// Добавляет нового пользователя
+        /// </summary>
         private void New_Executed()
         {
             Employee newEmployee = _dbContext.Employee.Create();
-            
             GridBlocked = false;
             isDirty = true;
         }
-
+        
+        /// <summary>
+        /// Переводит DataGrid в режим редактирования
+        /// </summary>
         private void Edit_Executed()
         {
             GridBlocked = false;
             isDirty = true;
         }
-
+        
+        /// <summary>
+        /// Удаляет сотрудника
+        /// </summary>
         private void Delete_Executed()
         {
             MessageBox.Show("Deleting...");
             isDirty = true;
         }
-
+        
+        /// <summary>
+        /// Выполняет поиск
+        /// </summary>
         private void Find_Executed()
         {
             MessageBox.Show("Searching...");

+ 0 - 14
InvestTracker/Views/LoadingView.xaml

@@ -1,14 +0,0 @@
-<Page x:Class="InvestTracker.Views.LoadingView"
-      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-      xmlns:local="clr-namespace:InvestTracker.Views"
-      mc:Ignorable="d" 
-      d:DesignHeight="450" d:DesignWidth="800"
-      Title="LoadingView">
-
-    <Grid>
-        <Label FontSize="18" Content="Загрузка..." HorizontalAlignment="Center" VerticalAlignment="Center"/>
-    </Grid>
-</Page>

+ 0 - 28
InvestTracker/Views/LoadingView.xaml.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace InvestTracker.Views
-{
-    /// <summary>
-    /// Логика взаимодействия для LoadingView.xaml
-    /// </summary>
-    public partial class LoadingView : Page
-    {
-        public LoadingView()
-        {
-            InitializeComponent();
-        }
-    }
-}