예제 #1
0
        private void BtnEmpVacationType_OnClick(object sender, RoutedEventArgs e)
        {
            //_viewModel.GetEmpVacation();
            //EmployeeVactionTypesPopUp.IsOpen = true;


            var btn = sender as Button;

            if (btn != null)
            {
                //_viewModel.GetEmpVacation();
                AttServiceClient _client = new AttServiceClient();

                if (_viewModel.SelectedMainRow != null)
                {
                    _client.GetEmpVacationAsync(_viewModel.SelectedMainRow.EmpId);
                }
                _client.GetEmpVacationCompleted += (s, sv) =>
                {
                    var vacationsToAdd = _viewModel.CcVacation.Select(x => x.CSPVACATIONID.ToLower());
                    var row            = sv.Result.Where(x => vacationsToAdd.Contains(x.CSPVACATIONID.ToLower()));
                    if (row != null)
                    {
                        if (_viewModel.SelectedMainRow != null)
                        {
                            _viewModel.SelectedMainRow.RemainingVacations = new ObservableCollection <TblVacationDetail>(row);
                        }
                    }

                    var SelectedVacRow = btn.DataContext as TblVacationViewModel;
                    var child          = new EmpVacationDetails(DataContext as EmployeeShiftViewModel, SelectedVacRow);
                    child.Show();
                };
            }
        }