Example #1
0
 private void buttonFinish_Click(object sender, EventArgs e)
 {
     if (ContentChecker.CheckGroupBoxedChecked(tabControl1))
     {
         try
         {
             TestCounter.TotalSum = 0;
             TestCounter.CountCheckBoxOkay();
             TestCounter.CountAge(Convert.ToInt32(numericUpDownAge.Value));
             TestCounter.CountChildren(Convert.ToInt32(numericUpDownChildren.Value));
             TestCounter.CountSalary(Convert.ToInt32(numericUpDownSalary.Value));
             TestCounter.CheckIndex();
             TestCounter.CheckPhoneCode();
             TestResultSetter.InitializeSetter(TestCounter.TotalSum, comboBoxCreditType.SelectedItem.ToString(), scoringProject.Logic.Client.getInstance().ID);
             this.Close();
             ClientPage cl = new ClientPage();
             cl.Visible = true;
         }
         catch (Exception ex)
         {
             MessageBox.Show("Проверьте введенные значения!", "Ошибка при выполнени");
         }
     }
     else
     {
         MessageBox.Show("Проверьте, отметили ли вы все значения", "Ошибки при выполнении");
     }
 }
        public static void WriteToXmlFile(object objectToSerialize, string path)
        {
            var contents = SerializeToXml(objectToSerialize);

            if (!ContentChecker.ContentsAreEqual(contents, path))
            {
                File.WriteAllText(path, contents);
            }
        }
Example #3
0
        public void TestButtonContent()
        {
            ContentChecker contentChecker = new ContentChecker();
            Button         button         = new Button();

            button.Text = "!";
            Assert.AreEqual(true, contentChecker.isFieldFlagged(button));
            button.Text = "";
            Assert.AreEqual(false, contentChecker.isFieldFlagged(button));
            Assert.AreEqual(true, contentChecker.IsUncovered(button));
        }
Example #4
0
        /// <summary>
        /// Thread safe file overwriting method
        /// </summary>
        /// <param name="path">Path to the file</param>
        /// <param name="data">Data to insert</param>
        /// <param name="numBytes">Number of bytes to write</param>
        public static void WriteToFile(string path, byte[] data, int numBytes)
        {
            lock (GetLockSemaphore(path))
            {
                if (ContentChecker.ContentsAreEqual(data, numBytes, path))
                {
                    return;
                }

                using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write))
                {
                    fs.Write(data, 0, numBytes);
                }
            }
        }
        async public Task <IActionResult> PostInThread(int id, [FromForm] UserPost userPost)
        {
            _logger.LogWarning(userPost.Text);

            if (ContentChecker.CheckFieldsOk(userPost))
            {
                Post newPost = await _userPostsHandler.BuildFromUserPostAsync(userPost, id);

                await repository.SavePostAsync(newPost);

                _repositoryMonitor.Update(repository);
                _repositoryMonitor.LogState();
                return(Ok());
            }
            return(UnprocessableEntity());
        }
Example #6
0
 private void checkBoxMale_Click(object sender, EventArgs e)
 {
     ContentChecker.CheckBoxChecker((CheckBox)sender);
 }
Example #7
0
 private void textBoxLetter_KeyPress(object sender, KeyPressEventArgs e)
 {
     ContentChecker.CheckTextBox(sender, e);
 }
Example #8
0
 private void textBoxNum_KeyPress(object sender, KeyPressEventArgs e)
 {
     ContentChecker.CheckNumTextBox(sender, e);
 }