public MainWindow(UIClient EmployeeClient, String CurrentUserLogin) { _client = EmployeeClient; _currentUserLogin = CurrentUserLogin; _currentUser = _client.GetUserInfo(CurrentUserLogin); _workRecords = new List<WorkRecord>(); _workRecords.AddRange(_client.GetRecords(_currentUser)); /* * Get date range for WorkRecords */ _dates = new List<DateTime>(); DateTime startDate = new DateTime(2012,1,1); //change to _client.GetWorkHistoryRange(_currentUser) when implemented for (int i = 0; i < 13; i++) { _dates.Add(startDate.AddMonths(i)); } /* * Get current users projects list */ IList<Project> _tmpProjects = new List<Project>(); _employeeDescriptions = _client.GetEmployeeDescriptions(_currentUser); foreach (var ed in _employeeDescriptions) { _tmpProjects.Add(ed.Project); } DataContext = this; InitializeComponent(); _contracts = new List<Contract>(); _contracts.AddRange(_client.GetContracts(_currentUser)); monthComboBox.ItemsSource = _dates; monthComboBox.DisplayMemberPath = "Date"; monthComboBox.ItemStringFormat = "MM yyyy"; monthComboBox.SelectedIndex = 0; monthContractsComboBox.ItemsSource = _dates; monthContractsComboBox.DisplayMemberPath = "Date"; monthContractsComboBox.ItemStringFormat = "MM yyyy"; monthContractsComboBox.SelectedIndex = 0; _projects = _tmpProjects.ToArray(); projectInputComboBox.ItemsSource = _projects; projectInputComboBox.DisplayMemberPath = "Name"; projectInputComboBox.SelectedIndex = 0; dateInputDatePicker.SelectedDate = DateTime.Now; hoursWorkedTextBox.Text = "hh:mm"; balance.Text = countBalance(_workRecords, _contracts).ToString("N"); }
public EmployeeWindowViewModel(EmployeeDescription e, UIClient dbs) { _currentEmployee = e; db = dbs; NotifyPropertyChanged("Hoursx"); }
public SetRateWindow(EmployeeDescription Employee, UIClient db) { InitializeComponent(); this.Employee = Employee; SetRateLayout.DataContext = this; _db = db; }
public EmployeeWindow(EmployeeDescription e, UIClient db) { InitializeComponent(); _currentEmployee = e; _db = db; //EmployeeWindowViewModel _viewModel = new EmployeeWindowViewModel(_currentEmployee); //LayoutRoot.DataContext = _viewModel; empUI.DataContext = new EmployeeWindowViewModel(_currentEmployee, _db); }
public RegisterContractWindow(PublicUserInfo Employee, UIClient db) { InitializeComponent(); this.Employee = Employee; RegisterContractLayout.DataContext = this; Contract = new Contract(); Contract.Employee = Employee; Contract.CreationDate = System.DateTime.Now; Contract.Value = 3240; _db = db; }
public SummaryWindowViewModel(UIClient db, EmployeeDescription employee) { _db = db; _summary = new Summary(); _summary.Date = DateTime.Today.AddDays(-DateTime.Today.Day); NotifyPropertyChanged("SummaryDate"); _employee = employee; _summary.EmployeeDescription = employee; _workRecords = db.GetRecordsOfEmployee(employee); _selectedWorkRecords = new List<WorkRecord>(); SummaryDate = DateTime.Now; var lastSum = db.GetLastSummaries(employee, 1); if (lastSum != null) _lastSummaryDate = lastSum.Last().Date; }
public AddBonusWindow(EmployeeDescription Employee, UIClient db) { InitializeComponent(); this.Employee = Employee; AddBonusLayout.DataContext = this; Bonus = new WorkRecord(); Bonus.EmployeeDescription = Employee; Bonus.CreationDate = DateTime.Now; Bonus.HourlyRate = 1000; // Bonus.isBonus = true; Bonus.Description = null; Bonus.MinutesWorked = 60; System.Console.WriteLine(Bonus.CreationDate); _db = db; }
public SummaryWindow(UIClient db, EmployeeDescription employee){ InitializeComponent(); viewModel = new SummaryWindowViewModel(db, employee); viewModel.RequestClose += (s, e) => this.Close(); SummaryLayout.DataContext = viewModel; }