Ejemplo n.º 1
0
 public SalesmanViewModel(Salesman salesman)
     : base(salesman.Contragent)
 {
     ProfitPercentage = salesman.ProfitPercentage;
     SalaryPerDay = salesman.SalaryPerDay;
     Login = salesman.Login;
 }
Ejemplo n.º 2
0
        private void AddSalesman()
        {
            FirstName = Trim(FirstName);
            LastName = Trim(LastName);

            Contragent contragent = new Contragent{FirstName = FirstName, LastName = LastName};
            Salesman salesman = new Salesman {ProfitPercentage = ProfitPercentage, SalaryPerDay = SalaryPerDay, Login = Login, Contragent = contragent};

            try
            {
                _mainViewModel.Context.Salesmen.Add(salesman);
                _mainViewModel.Context.SaveChanges();
            }
            catch (Exception e)
            {
                MessageBox.Show(("Не удалось добавить нового продавца"), "Error",
                        MessageBoxButton.OK, MessageBoxImage.Error);

                Logging.WriteToLog("Failed add new salesman" + e.Message);
            }

            _mainViewModel.SalesmenViewModel.Update();
            _mainViewModel.SalesmenViewModel.AddSalesmanDialogViewModel = null;
        }