Example #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (IsValidateAdd())
            {
                _qt.AddDirectoryTypeOfCompany(textBoxTypeOfCompany.Text);
                _qt.Save();

                ClearForm();
                FormFill();
            }
        }
Example #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (IsValidateAdd())
            {
                string typeOfCompany = comboBoxTypeOfCompanies.SelectedItem.ToString();

                var directoryTypeOfCompany = _qt.GetDirectoryTypeOfCompany(typeOfCompany);
                _qt.AddDirectoryCompany(textBoxNameOfCompany.Text, directoryTypeOfCompany);
                _qt.Save();

                ClearForm();
                FormFill();
            }
        }
Example #3
0
        private void AddPost()
        {
            if (IsValidateAdd())
            {
                string nameOfCompany = comboBoxNameOfCompany.SelectedItem.ToString();
                string typeOfPost    = comboBoxTypeOfPost.SelectedItem.ToString();
                var    post          = _qt.GetDirectoryPostEqualDates(dateTimePickerDate.Value, textBoxNameOfPost.Text, nameOfCompany);

                if (post == null)
                {
                    post = new DirectoryPost
                    {
                        Name                 = textBoxNameOfPost.Text,
                        DirectoryCompany     = _qt.GetDirectoryCompany(nameOfCompany),
                        DirectoryTypeOfPost  = _qt.GetDirectoryTypeOfPost(typeOfPost),
                        Date                 = dateTimePickerDate.Value,
                        UserWorkerSalary     = double.Parse(textBoxWorkerSalary.Text.Replace(".", ",")),
                        UserHalfWorkerSalary = double.Parse(textBoxHalfWorkerSalary.Text.Replace(".", ","))
                    };
                    _qt.AddDirectoryPost(post);
                }
                else
                {
                    post.Name                 = textBoxNameOfPost.Text;
                    post.DirectoryCompany     = _qt.GetDirectoryCompany(nameOfCompany);
                    post.DirectoryTypeOfPost  = _qt.GetDirectoryTypeOfPost(typeOfPost);
                    post.Date                 = dateTimePickerDate.Value;
                    post.UserWorkerSalary     = double.Parse(textBoxWorkerSalary.Text.Replace(".", ","));
                    post.UserHalfWorkerSalary = double.Parse(textBoxHalfWorkerSalary.Text.Replace(".", ","));
                }

                _qt.Save();

                FormFill();
            }
        }
Example #4
0
        private void AddWorker()
        {
            if (IsValidateAdd())
            {
                DirectoryWorker worker = new DirectoryWorker();
                worker.LastName  = textBoxLastName.Text;
                worker.FirstName = textBoxFirstName.Text;

                if (!string.IsNullOrWhiteSpace(textBoxMidName.Text))
                {
                    worker.MidName = textBoxMidName.Text;
                }

                worker.Gender = radioButtonMale.Checked ? Gender.Male : Gender.Female;

                worker.BirthDay  = dateTimePickerBirthDay.Value;
                worker.Address   = textBoxAddress.Text;
                worker.CellPhone = textBoxCellPhone.Text;

                if (!string.IsNullOrWhiteSpace(textBoxHomePhone.Text))
                {
                    worker.HomePhone = textBoxHomePhone.Text;
                }

                worker.StartDate = dateTimePickerDateOfStart.Value;


                for (int i = 0; i < dataGridViewCompanyAndPost.RowCount; i++)
                {
                    var currentPost = new CurrentPost
                    {
                        ChangeDate      = DateTime.Parse(dataGridViewCompanyAndPost[5, i].Value.ToString()),
                        DirectoryPostId = int.Parse(dataGridViewCompanyAndPost[0, i].Value.ToString())
                    };

                    worker.Posts.Add(currentPost);
                }

                _qt.AddDirectoryWorker(worker);
                _qt.Save();
                ClearForm();
            }
        }