Example #1
0
        private void label1_Click_1(object sender, EventArgs e)
        {
            Form UserQueue = new User_Ticket_View_Screen();

            this.Hide();
            UserQueue.Show();
        }
Example #2
0
        private void Submit_btn_Click(object sender, EventArgs e)//NEEDS MORE CODE NAVIGATIONAL ONLY NOW
        {
            try
            {
                connectionstring = "Data Source = isys4363.walton.uark.edu; Initial Catalog = TicketingSystem; User ID = isys4363a; Password = GohogsUA20";
                connection       = new SqlConnection(connectionstring);
                int    answer;
                string sql2 = null;
                sql = "SELECT CatID from Category where Category = '" + CategoryCB.ToString() + "'";

                sql2 = "INSERT INTO Ticket VALUES (@UserID, @Status, @AssignedTo,  @Priority,  @DateIssued,  @DateR, @CatID, @Category, @Description, @UserName) ";
                connection.Open();
                string UID2   = "";
                string CatID2 = "";

                command = new SqlCommand(sql2, connection);

                command.Parameters.AddWithValue("@UserID", DBNull.Value);
                command.Parameters.AddWithValue("@Status", "Active"); //
                command.Parameters.AddWithValue("@AssignedTo", " ");
                command.Parameters.AddWithValue("@Priority", PriorityCB.SelectedItem.ToString());
                command.Parameters.AddWithValue("@DateIssued", Datetxt.Text);
                command.Parameters.AddWithValue("@DateR", "Ongoing");
                command.Parameters.AddWithValue("@CatID", DBNull.Value);
                command.Parameters.AddWithValue("@Category", CategoryCB.SelectedItem.ToString());
                command.Parameters.AddWithValue("@Description", DescribeTxt.Text);
                command.Parameters.AddWithValue("@UserName", UserIDtxt.Text);


                answer = command.ExecuteNonQuery();
                command.Dispose();
                connection.Close();


                connection = new SqlConnection(connectionstring);
                sql        = "UPDATE Ticket SET CatID = @CATID WHERE TicketID = @TID";
                connection.Open();
                command = new SqlCommand(sql, connection);
                // int UID = int.Parse(UserIDtxt.Text);

                int CATID = int.Parse(CATIDtxt.Text) + 1;

                command.Parameters.AddWithValue("@TID", TicketIDtxt.Text);
                command.Parameters.AddWithValue("@CATID", CATID);

                answer = command.ExecuteNonQuery();
                command.Dispose();
                connection.Close();


                MessageBox.Show("Your Ticket has been Submitted and added to our queue. Your ticket will be resolved shortly.");

                Form UserQueue = new User_Ticket_View_Screen();

                this.Hide();
                UserQueue.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred while inserting data " + ex);
            }


            ////////////////
        }