Ejemplo n.º 1
0
        private void DataGridEmployeesRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow dgr  = (DataGridRow)sender;
            Employee    empl = (Employee)dgr.Item;
            var         user = companyEntities.Employee.FirstOrDefault(e => e.id == Properties.Settings.Default.IdUser);

            if (empl.idPosition == (int)EnumPosition.Admin && user.idPosition != (int)EnumPosition.Admin)
            {
                return;
            }
            if (empl.idPosition == (int)EnumPosition.OfficeWorker && user.idPosition != (int)EnumPosition.Admin && empl.id != user.id)
            {
                return;
            }
            EmployeeSalary.IsEnabled    = !(Properties.Settings.Default.IdUser == empl.id && empl.idPosition != (int)EnumPosition.Admin);
            EmployeePosition.IsEnabled  = !(Properties.Settings.Default.IdUser == empl.id && empl.idPosition != (int)EnumPosition.Admin);
            BtnDeleteEmployee.IsEnabled = !(Properties.Settings.Default.IdUser == empl.id && empl.idPosition != (int)EnumPosition.Admin);
            if (empl.Address != null && empl.Address.Localization != null)
            {
                EmployeeMap.CheckingPushpin(e, new Location()
                {
                    Latitude = double.Parse(empl.Address.Localization.latitude), Longitude = double.Parse(empl.Address.Localization.longitude)
                });
            }
            DataContext = new EmployeeEditViewModel(empl, this);
            TurnOnOffEmployeePanel(false);
            BtnSaveEmployee.Content      = "Edytuj";
            BtnDeleteEmployee.Visibility = Visibility.Visible;
        }
Ejemplo n.º 2
0
 private void EmployeeMap_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     e.Handled = true;
     EmployeeMap.ClearAllMap();
     EmployeeMap.CheckingPushpin(e);
 }