private void SaveButton_Click(object sender, EventArgs e) { try { bool result = false; var repository = new CompaniesDal(); var company = new Company(); company.Id = GuidGenerator.GenerateGuid(); company.CompanyName = companyName.Text; company.City = city.Text; company.Address = address.Text; company.Status = EnumConverter.ConvertToStatusEnum(StatusComboBox.SelectedItem); company.Date = DateTime.Parse(dateTimePicker1.Text); company.Details = DetailsTextBox.Text; company.PhoneNumber = phoneNumber.Text; if (ButtonOperation == Operation.Create) { result = repository.InsertNewCompany(company); if (result) { Parent.InitializeDataGrid(company); } } else { company.Id = ID; result = repository.UpdateCompany(company); if (result) { Parent.InitializeUpdatedDataGrid(company); } } MessageBox.Show("Sve je proslo u redu"); Close(); } catch (Exception exeption) { MessageBox.Show(exeption.Message); } }
/// <summary> /// Write single GUID to Windows clipboard. /// </summary> public override void SetSingleGuid() { var guidText = GuidGenerator.GenerateGuid(); Clipboard.SetText(guidText); }
public void GenerateGuid_Valid() { var guidText = GuidGenerator.GenerateGuid(); Assert.True(Guid.TryParse(guidText, out _)); }
/// <summary> /// Write single GUID to STDOUT. /// </summary> public override void SetSingleGuid() { var guidText = GuidGenerator.GenerateGuid(); Console.WriteLine(guidText); }
public override void SetSingleGuid() { var guidText = GuidGenerator.GenerateGuid(); Commands.PbCopy(guidText); }