private static Companies CreatingCompaniesObjectFromEntryForm(EntryFormCompany entryForm) { Companies newCompany = new Companies(); newCompany.CostOfLiving = double.Parse(entryForm.textBoxCostOfLiving.Text); newCompany.Money = double.Parse(entryForm.textBoxMoney.Text); newCompany.Name = entryForm.textBoxName.Text; newCompany.Respect = int.Parse(entryForm.textBoxRespect.Text); newCompany.TypesOfOfficesTOOfficeID = int.Parse(entryForm.textBoxTypesOfOffices_TOOfficeID.Text); newCompany.UsersUserID = int.Parse(entryForm.textBoxUsersUserID.Text); return newCompany; }
public EntryFormCompany(Companies _companies) { InitializeComponent(); this.DataContext = _companies; this.textBoxCompanyID.Text = _companies.CompanyID.ToString(); }
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; } } }
public void TestAddToCompanies() { using (var context = new BusinessCodingModelContex()) { Companies tmp = new Companies(); tmp.CostOfLiving = 12; tmp.Money = 3242; tmp.Name = "testUnit"; tmp.Respect = 12; var result1 = from x in context.TypesOfOffices where x.Name == "Duże biuro" select x; tmp.TypesOfOfficesTOOfficeID = result1.First().TOOfficeID; var result2 = from x in context.Users where x.Login == "test3" select x; tmp.UsersUserID = result2.First().UserID; context.Companies.Add(tmp); } }