|
@@ -14,12 +14,20 @@ namespace InvestTracker.VM
|
|
|
{
|
|
|
public class EmployeeBrowseVM : BindableBase
|
|
|
{
|
|
|
+ #region Команды
|
|
|
public DelegateCommand UndoCommand { get; set; }
|
|
|
public DelegateCommand SaveCommand { get; set; }
|
|
|
public DelegateCommand NewCommand { get; set; }
|
|
|
public DelegateCommand EditCommand { get; set; }
|
|
|
public DelegateCommand DeleteCommand { get; set; }
|
|
|
public DelegateCommand FindCommand { get; set; }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Определяет можно ли редактировать значения в сетке данных
|
|
|
+ /// </summary>
|
|
|
+ public bool GridBlocked { get; set; }
|
|
|
+
|
|
|
private InvestContext _dbContext;
|
|
|
private bool isDirty = false;
|
|
|
|
|
@@ -42,6 +50,8 @@ namespace InvestTracker.VM
|
|
|
DeleteCommand = new DelegateCommand(Delete_Executed, WhenClean);
|
|
|
FindCommand = new DelegateCommand(Find_Executed, WhenClean);
|
|
|
|
|
|
+ GridBlocked = true;
|
|
|
+
|
|
|
_dbContext = new InvestContext();
|
|
|
Employees = new ObservableCollection<Employee>(_dbContext.Employees.ToList());
|
|
|
AllTitles = new ObservableCollection<Title>(_dbContext.Titles.ToList());
|
|
@@ -55,7 +65,8 @@ namespace InvestTracker.VM
|
|
|
|
|
|
private void Save_Executed()
|
|
|
{
|
|
|
- MessageBox.Show("Saving");
|
|
|
+ _dbContext.SaveChanges();
|
|
|
+ GridBlocked = true;
|
|
|
isDirty = false;
|
|
|
}
|
|
|
|
|
@@ -67,7 +78,7 @@ namespace InvestTracker.VM
|
|
|
|
|
|
private void Edit_Executed()
|
|
|
{
|
|
|
- MessageBox.Show("Editing...");
|
|
|
+ GridBlocked = false;
|
|
|
isDirty = true;
|
|
|
}
|
|
|
|