Пример #1
0
        private void InsertButton_Click(object sender, EventArgs e)
        {
            InsertButton.Text = "Running";
            InsertButton.Refresh();

            this.errorHasOccurred = false;
            this.errorDetails     = "";

            if (ConnectionStringTextBox.Text.Length == 0)
            {
                ConnectionStringTextBox.Text = "Server=.;Database=WideWorldImporters;Integrated Security=true;Column Encryption Setting=disabled;Max Pool Size=250;";
            }

            if (!ConnectionStringTextBox.Text.ToUpper().Contains("MAX POOL SIZE"))
            {
                ConnectionStringTextBox.Text = (ConnectionStringTextBox.Text + ";Max Pool Size=250;").Replace(";;", ";");
            }

            var startingTime = DateTime.Now;

            try
            {
                int numberOfThreads = (int)NumberOfThreadsNumericUpDown.Value;

                var sqlTasks = new Thread[numberOfThreads];

                for (int threadCounter = 0; threadCounter < numberOfThreads; threadCounter++)
                {
                    sqlTasks[threadCounter] = new System.Threading.Thread(() => PerformSqlTask(threadCounter, this));
                    sqlTasks[threadCounter].Start();
                }

                if (sqlTasks != null)
                {
                    foreach (Thread thread in sqlTasks)
                    {
                        thread.Join();
                    }
                }
            }
            catch (Exception ex)
            {
                this.errorHasOccurred = true;
                this.errorDetails     = ex.ToString();
            }

            InsertButton.Text             = "&Insert";
            LastExecutionTimeTextBox.Text = ((int)DateTime.Now.Subtract(startingTime).TotalMilliseconds).ToString();

            if (this.errorHasOccurred)
            {
                var errorForm = new ErrorDetailsForm();
                errorForm.ErrorMessage = this.errorDetails;
                errorForm.ShowDialog();
            }
        }
        public void Do_order_and_confirm(string _remark)
        {
            OrderDetailButton.TouchNoScroll();
            InsertButton.TouchNoScroll();

            ProductListTable.Input_to_cell_of_first_row_by_index(COL_CASE, "1");
            SubmitButton.TouchNoScroll();
            DoneButton.TouchNoScroll();

            DeliveryNote = _remark;
            SubmitButton.TouchNoScroll();
        }
Пример #3
0
        private void AddSectionForm_Load(object sender, EventArgs e)
        {
            InsertButton.Select();

            //EXCEPTION 1
            try
            {
                variables           = new Variables();
                opacityform         = new OpacityForm();
                cryptography        = new Cryptography();
                sqlconnectionconfig = new SQLConnectionConfig();

                RegistryKey registrykey = Registry.CurrentUser.OpenSubKey(@variables.pathname);
                string      tempdata    = registrykey.GetValue("SQLServerConnectionString").ToString();

                //USER SQLSERVER CONNECTION SETTINGS
                sqlconnectionconfig.SqlConnectionString = cryptography.Decrypt(tempdata);
                sqlconnection = new SqlConnection(sqlconnectionconfig.SqlConnectionString);
                sqlconnection.Open();

                //INNER EXCEPTION 1
                try
                {
                    Init_NewSectionID();
                    RetriveSectionData();
                    RetrieveSchoolYearList();
                }

                catch (Exception exception)
                {
                    opacityform.Show();
                    MessageBox.Show(exception.ToString(), "@Add Section Form Inner Exception 1",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    opacityform.Hide();
                }
            }

            catch (Exception exception)
            {
                opacityform.Show();
                MessageBox.Show(exception.ToString(), "@Add Section Form Exception 1",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                opacityform.Hide();
            }
        }
Пример #4
0
        public IEnumerator <ITask> OnInsertButton(InsertButton insert)
        {
            if (_state.Buttons.Exists(insert.Body.CompareId) ||
                _state.Controls.Exists(insert.Body.CompareId))
            {
                insert.ResponsePort.Post(
                    Fault.FromCodeSubcodeReason(
                        FaultCodes.Receiver,
                        DsspFaultCodes.DuplicateEntry,
                        "A button with the same ID already exists: " + insert.Body.Id
                        )
                    );
            }
            else
            {
                Fault      fault  = null;
                FormInvoke invoke = new FormInvoke(
                    delegate
                {
                    _form.InsertButton(insert.Body);
                }
                    );

                WinFormsServicePort.Post(invoke);
                yield return(Arbiter.Choice(
                                 invoke.ResultPort,
                                 EmptyHandler,
                                 delegate(Exception e)
                {
                    fault = Fault.FromException(e);
                }
                                 ));

                if (fault != null)
                {
                    insert.ResponsePort.Post(fault);
                }
                else
                {
                    _state.Buttons.Add(insert.Body);
                    insert.ResponsePort.Post(DefaultUpdateResponseType.Instance);
                    DoSendNotification(insert);
                }
            }
        }
        public void FeeList_Submission_SPP()
        {
            AJAXCall.WaitForAjax();
            Thread.Sleep(900);

            CommonUtils cookiesScreen = new CommonUtils(driver);

            cookiesScreen.RejectAll_Cookies();

            Thread.Sleep(900);
            SignIn_Page.Click();


            Excel_Suite userEmail = new Excel_Suite(Env.EXCEL_TEST_URL);

            userEmail.getCellData("SPP_TestData", true);
            UserEmail.SendKeys(Env.Email_Id);
            Password.SendKeys("Test@123");



            WebDriverWait wait = new WebDriverWait(driver, System.TimeSpan.FromSeconds(800));

            Thread.Sleep(800);
            SubmitButton.Click();

            MyAccount_Toggle.Click();

            AJAXCall.WaitForAjax();
            FeesList_Link.Click();

            AJAXCall.WaitForAjax();
            Thread.Sleep(1000);
            EditLink.Click();
            EditButton.Click();

            createBox.Click();
            Thread.Sleep(800);

            driver.SwitchTo().Frame(1);

            Eyp_name.SendKeys("TestAutomation");

            Eyp_agerange.SendKeys("5-10");

            SelectElement option = new SelectElement(Eyp_ecceavailable);

            option.SelectByText("Yes");

            Eyp_fullpriceperweek_Text.SendKeys("100.00");

            Thread.Sleep(800);
            Eyp_daysperweek.SendKeys("5");
            Eyp_hoursperweek.SendKeys("40");


            Effective_Date.SendKeys("01/11/2020");

            InsertButton.Click();
            AJAXCall.WaitForAjax();
            driver.SwitchTo().DefaultContent();
        }
Пример #6
0
        private void InsertButton_Click(object sender, EventArgs e)
        {
            //EXCEPTION 2
            try
            {
                opacityform        = new OpacityForm();
                darkeropacityform  = new DarkerOpacityForm();
                notificationwindow = new NotificationWindow();

                if (SchoolYearTextbox.Text.Trim().Length < 1)
                {
                    notificationwindow.CaptionText    = "MESSAGE CONTENT";
                    notificationwindow.MsgImage.Image = Properties.Resources.warning;
                    notificationwindow.MessageText    = "PLEASE PROVIDE A SCHOOL YEAR !";

                    darkeropacityform.Show();
                    notificationwindow.ShowDialog();
                    darkeropacityform.Hide();
                }

                else if (!SchoolYearTextbox.Text.Trim().ToUpper().Contains("S.Y."))
                {
                    notificationwindow.CaptionText    = "MESSAGE CONTENT";
                    notificationwindow.MsgImage.Image = Properties.Resources.warning;
                    notificationwindow.MessageText    = "PLEASE FOLLOW AND PROVIDE\nTHE SPECIFIED SCHOOL YEAR FORMAT !";

                    darkeropacityform.Show();
                    notificationwindow.ShowDialog();
                    darkeropacityform.Hide();
                }

                else
                {
                    //INNER EXCEPTION 2
                    try
                    {
                        string TempQuery = "SELECT COUNT(*) FROM [Tbl.SchoolYear] WHERE [SCHOOL YEAR] = '" +
                                           SchoolYearTextbox.Text.Trim().ToUpper() + "'";
                        sqldataadapter = new SqlDataAdapter(TempQuery, sqlconnection);
                        DataTable datatable0 = new DataTable();
                        sqldataadapter.Fill(datatable0);


                        if (datatable0.Rows[0][0].ToString() == "1")
                        {
                            notificationwindow.CaptionText    = "MESSAGE CONTENT";
                            notificationwindow.MsgImage.Image = Properties.Resources.warning;
                            notificationwindow.MessageText    = "THAT SCHOOL YEAR ALREADY EXIST !";

                            darkeropacityform.Show();
                            notificationwindow.ShowDialog();
                            darkeropacityform.Hide();
                        }

                        else if (datatable0.Rows[0][0].ToString() == "0")
                        {
                            string InsertQuery = "INSERT INTO [Tbl.SchoolYear]([ENTRY ID], [SCHOOL YEAR], [WAS SET]) VALUES(@EntryID, @schoolyear, @ws)";
                            sqlcommand = new SqlCommand(InsertQuery, sqlconnection);
                            sqlcommand.Parameters.AddWithValue("@EntryID", Prefix_ID + NewEntryID.ToString());
                            sqlcommand.Parameters.AddWithValue("@schoolyear", SchoolYearTextbox.Text.Trim().ToUpper());
                            sqlcommand.Parameters.AddWithValue("@ws", "0");
                            sqlcommand.ExecuteNonQuery();

                            RetrieveSchoolYearData();
                            SchoolYearTextbox.ResetText();
                            InsertButton.Select();
                            Init_NewEntryID();
                        }
                    }

                    catch (Exception exception)
                    {
                        opacityform.Show();
                        MessageBox.Show(exception.StackTrace.ToString(), "@Add School Year Form Inner Exception 2",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                        opacityform.Hide();
                    }
                }
            }

            catch (Exception exception)
            {
                opacityform.Show();
                MessageBox.Show(exception.StackTrace.ToString(), "@Add School Year Form Exception 2",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                opacityform.Hide();
            }
        }
Пример #7
0
        private void InsertButton_Click(object sender, EventArgs e)
        {
            //EXCEPTION 3
            try
            {
                variables          = new Variables();
                opacityform        = new OpacityForm();
                darkeropacityform  = new DarkerOpacityForm();
                notificationwindow = new NotificationWindow();

                if (SectionNameTextbox.Text.Trim().Length < 1 || MaxStudentTextbox.Text.Trim().Length < 1)
                {
                    notificationwindow.CaptionText    = "MESSAGE CONTENT";
                    notificationwindow.MsgImage.Image = Properties.Resources.warning;
                    notificationwindow.MessageText    = "PLEASE PROVIDE SECTION NAME,\nMAXIMUM STUDENTS AND SCHOOL YEAR !";

                    darkeropacityform.Show();
                    notificationwindow.ShowDialog();
                    darkeropacityform.Hide();
                }

                else if (isNumber(MaxStudentTextbox.Text.Trim()) == false)
                {
                    notificationwindow.CaptionText    = "MESSAGE CONTENT";
                    notificationwindow.MsgImage.Image = Properties.Resources.warning;
                    notificationwindow.MessageText    = "INVALID DATA ON MAXIMUM STUDENTS !";

                    darkeropacityform.Show();
                    notificationwindow.ShowDialog();
                    darkeropacityform.Hide();
                }

                else
                {
                    //INNER EXCEPTION 3
                    try
                    {
                        string TempQuery = "SELECT COUNT(*) FROM [Tbl.Sections] WHERE [SECTION NAME] = '" +
                                           SectionNameTextbox.Text.Trim().ToUpper() + "' AND [SCHOOL YEAR] = '" + CurrentSchoolYearDropdown.selectedValue.ToString() + "'";

                        sqldataadapter = new SqlDataAdapter(TempQuery, sqlconnection);
                        DataTable datatable = new DataTable();
                        sqldataadapter.Fill(datatable);

                        if (datatable.Rows[0][0].ToString() == "1")
                        {
                            notificationwindow.CaptionText    = "MESSAGE CONTENT";
                            notificationwindow.MsgImage.Image = Properties.Resources.warning;
                            notificationwindow.MessageText    = "THAT SECTION ALREADY EXIST FOR \nSCHOOL YEAR " + CurrentSchoolYearDropdown.selectedValue.ToString();

                            darkeropacityform.Show();
                            notificationwindow.ShowDialog();
                            darkeropacityform.Hide();
                        }

                        else if (datatable.Rows[0][0].ToString() == "0")
                        {
                            RegistryKey registrykey = Registry.CurrentUser.OpenSubKey(@variables.pathname);
                            CurrentSectionCount = registrykey.GetValue("NofMaxSections").ToString();

                            if (int.Parse(CurrentSectionCount) < 10)
                            {
                                sqlquery5 = "INSERT INTO [Tbl.Sections]([SECTION ID], [SECTION NAME], [MAXIMUM STUDENTS], ENROLLED, [SCHOOL YEAR])" +
                                            " VALUES(@sectionid, @section_name, @maximumstudents, @enrolled, @schoolyear)";
                                sqlcommand = new SqlCommand(sqlquery5, sqlconnection);
                                sqlcommand.Parameters.AddWithValue("@sectionid", Prefix + NewSectionID.ToString());
                                sqlcommand.Parameters.AddWithValue("@section_name", SectionNameTextbox.Text.Trim().ToUpper());
                                sqlcommand.Parameters.AddWithValue("@maximumstudents", MaxStudentTextbox.Text.Trim());
                                sqlcommand.Parameters.AddWithValue("@enrolled", "0");
                                sqlcommand.Parameters.AddWithValue("@schoolyear", CurrentSchoolYearDropdown.selectedValue.ToString().ToUpper());
                                sqlcommand.ExecuteNonQuery();

                                //UPDATE SECTION COUNT
                                RegistryKey updateregistrykey = Registry.CurrentUser.CreateSubKey(@variables.pathname);
                                updateregistrykey.SetValue("NofMaxSections", (int.Parse(CurrentSectionCount) + 1).ToString());

                                Init_NewSectionID();
                                RetriveSectionData();

                                SectionNameTextbox.ResetText();
                                MaxStudentTextbox.ResetText();

                                CurrentSchoolYearDropdown.selectedIndex = 0;
                                InsertButton.Select();
                            }

                            else if (int.Parse(CurrentSectionCount) == 10)
                            {
                                notificationwindow.CaptionText    = "MESSAGE CONTENT";
                                notificationwindow.MsgImage.Image = Properties.Resources.error;
                                notificationwindow.MessageText    = "YOU CAN ONLY CREATE 10 SECTIONS\nEVERY SCHOOL YEAR !";

                                darkeropacityform.Show();
                                notificationwindow.ShowDialog();
                                darkeropacityform.Hide();
                            }
                        }
                    }

                    catch (Exception exception)
                    {
                        opacityform.Show();
                        MessageBox.Show(exception.Message.ToString(), "@Add Section Form Inner Exception 3",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                        opacityform.Hide();
                    }
                }
            }

            catch (Exception exception)
            {
                opacityform.Show();
                MessageBox.Show(exception.Message.ToString(), "@Add Section Form Exception 2",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                opacityform.Hide();
            }
        }
Пример #8
0
        private void InsertButton_Click(object sender, EventArgs e)
        {
            if (InsertButton.Text == "&Insert")
            {
                InsertButton.Text = "&Stop Now";
                InsertButton.Refresh();
                this.Refresh();

                DisplayUpdateTimer.Enabled = true;

                this.errorHasOccurred = false;
                this.errorDetails     = "";

                this.totalOrders       = 0;
                this.totalMilliseconds = 0;

                if (ConnectionStringTextBox.Text.Length == 0)
                {
                    ConnectionStringTextBox.Text = "Server=.;Userid=user;Password=password;Port=5432;Database=wide_world_importers_pg;Pooling=true;MinPoolSize=0;MaxPoolSize=250;SslMode=Require;Trust Server Certificate=true";
                }

                if (!ConnectionStringTextBox.Text.ToUpper().Contains("MAXPOOLSIZE"))
                {
                    ConnectionStringTextBox.Text = (ConnectionStringTextBox.Text + ";MaxPoolSize=250;").Replace(";;", ";");
                }

                try
                {
                    int numberOfThreads = (int)NumberOfThreadsNumericUpDown.Value;

                    sqlTasks = new Thread[numberOfThreads];

                    for (int threadCounter = 0; threadCounter < numberOfThreads; threadCounter++)
                    {
                        PerformSqlTask(threadCounter, this);
                    }
                }
                catch (Exception ex)
                {
                    this.errorHasOccurred = true;
                    this.errorDetails     = ex.ToString();
                }

                if (this.errorHasOccurred)
                {
                    var errorForm = new ErrorDetailsForm();
                    errorForm.ErrorMessage = this.errorDetails;
                    errorForm.ShowDialog();
                }
            }
            else
            {
                InsertButton.Text = "Stopping";
                InsertButton.Refresh();
                this.Refresh();

                DisplayUpdateTimer.Enabled = false;

                if (sqlTasks != null)
                {
                    foreach (Thread thread in sqlTasks)
                    {
                        thread.Abort();
                    }
                }

                InsertButton.Text = "&Insert";
            }
        }