Пример #1
0
 private static Empolyees CreatingEmployeeObjectFromEntryForm(EntryFormEmpolyee entryForm)
 {
     Empolyees newEmployee = new Empolyees();
     try
     {
         newEmployee.CompaniesCompanyID = int.Parse(entryForm.textBoxCompaniesCompanyID.Text);
     }
     catch
     {
         newEmployee.CompaniesCompanyID = null;
     }
     try
     {
         newEmployee.DateOfHiring = DateTime.Parse(entryForm.textBoxDateOfHiring.Text);
     }
     catch
     {
         newEmployee.DateOfHiring = null;
     }
     newEmployee.TypesOfEmployeesTOEmployeeID = int.Parse(entryForm.textBoxTypesOfEmployees_TOEmployeeID.Text);
     return newEmployee;
 }
 public EntryFormEmpolyee(Empolyees _employees)
 {
     InitializeComponent();
     this.DataContext = _employees;
     this.textBoxEmployeeID.Text = _employees.EmployeeID.ToString();
 }
Пример #3
0
        private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (newSelectedItem > 0)
            {
                if (selectedTable == "Users")
                {
                    selectedUser = ((DataGrid)sender).SelectedItem as Users;
                    buttonModify.IsEnabled = true;
                    buttonDelete.IsEnabled = true;
                }

                else if (selectedTable == "Description")
                {
                    selectedDesciption = ((DataGrid)sender).SelectedItem as Descriptions;
                    buttonModify.IsEnabled = true;
                    buttonDelete.IsEnabled = true;
                }

                else if (selectedTable == "TypesOfEmployees")
                {
                    selectedTypesOfEmployee = ((DataGrid)sender).SelectedItem as TypesOfEmployees;
                    buttonModify.IsEnabled = true;
                    buttonDelete.IsEnabled = true;
                }

                else if (selectedTable == "Projects")
                {
                    selectedProject = ((DataGrid)sender).SelectedItem as Projects;
                    buttonModify.IsEnabled = true;
                    buttonDelete.IsEnabled = true;
                }

                else if (selectedTable == "TypesOfOffices")
                {
                    selectedTypesOfOffice = ((DataGrid)sender).SelectedItem as TypesOfOffices;
                    buttonModify.IsEnabled = true;
                    buttonDelete.IsEnabled = true;
                }

                else if (selectedTable == "Employees")
                {
                    selectedEmpolyee = ((DataGrid)sender).SelectedItem as Empolyees;
                    buttonModify.IsEnabled = true;
                    buttonDelete.IsEnabled = true;
                }

                else if (selectedTable == "Companies")
                {
                    selectedCompany = ((DataGrid)sender).SelectedItem as Companies;
                    buttonModify.IsEnabled = true;
                    buttonDelete.IsEnabled = true;
                }
                if (newSelectedItem == 2)
                {
                    buttonModify.IsEnabled = false;
                    buttonDelete.IsEnabled = false;
                    newSelectedItem = 1;
                }
            }
        }
Пример #4
0
        public void TestAddToEmployee()
        {
            using (var context = new BusinessCodingModelContex())
            {
                Empolyees tmp = new Empolyees();
                tmp.DateOfHiring = DateTime.Parse("2013-11-05 22:12:28.990");

                var result = from x in context.TypesOfEmployees where x.Name == "Senior Developer" select x;
                tmp.TypesOfEmployeesTOEmployeeID = result.First().TOEmployeeID;

                context.Empolyees.Add(tmp);
            }
        }