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(); } }