コード例 #1
0
        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);
            }
        }
コード例 #2
0
        /// <summary>
        /// Write single GUID to Windows clipboard.
        /// </summary>
        public override void SetSingleGuid()
        {
            var guidText = GuidGenerator.GenerateGuid();

            Clipboard.SetText(guidText);
        }
コード例 #3
0
        public void GenerateGuid_Valid()
        {
            var guidText = GuidGenerator.GenerateGuid();

            Assert.True(Guid.TryParse(guidText, out _));
        }
コード例 #4
0
        /// <summary>
        /// Write single GUID to STDOUT.
        /// </summary>
        public override void SetSingleGuid()
        {
            var guidText = GuidGenerator.GenerateGuid();

            Console.WriteLine(guidText);
        }
コード例 #5
0
        public override void SetSingleGuid()
        {
            var guidText = GuidGenerator.GenerateGuid();

            Commands.PbCopy(guidText);
        }