private void createeveButton_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["My Connection"].ConnectionString);

            connection.Open();

            string     sql     = "INSERT INTO Events (EventName, Date, LastUpdated, Picture, Caption) VALUES ('" + EventTextBox.Text + "','" + eventdateTimePicker.Text + "','" + eventdateTimePicker.Text + "','" + PictureBox.Image + "', '" + CaptionTextBox.Text + "')";
            SqlCommand command = new SqlCommand(sql, connection);

            int result = command.ExecuteNonQuery();

            if (result > 0)
            {
                MessageBox.Show("Event Added");
                //UploadPicture upload = new UploadPicture();
                EventManagment events = new EventManagment();
                this.Hide();
                events.Show();


                //upload.Show();
            }
            else
            {
                MessageBox.Show("Error!!");
            }
            connection.Close();
        }
        private void BackButton_Click(object sender, EventArgs e)
        {
            EventManagment eventmanagment = new EventManagment();

            eventmanagment.Show();
            this.Hide();
        }
Exemple #3
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["My Connection"].ConnectionString);

            connection.Open();
            string        sql         = "SELECT Username, Password FROM USERS";
            SqlCommand    command     = new SqlCommand(sql, connection);
            SqlDataReader reader      = command.ExecuteReader();
            List <User>   users       = new List <User>();
            User          user        = new User();
            bool          ispassmatch = false;

            while (reader.Read())
            {
                user.Username = reader["Username"].ToString();
                user.Password = reader["Password"].ToString();
                if (user.Username == userNameTextBox.Text && user.Password == passwordTextBox.Text)
                {
                    EventManagment eve = new EventManagment();
                    eve.Show();
                    this.Hide();
                    ispassmatch = true;
                    break;
                }

                //users.Add(user);
            }


            if (ispassmatch = false)
            {
                MessageBox.Show("Wrong Credentials given");
            }
        }
Exemple #4
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["My Connection"].ConnectionString);

            connection.Open();

            string     sql     = "DELETE FROM Events WHERE ID= " + Convert.ToInt32(EventIDTextBox.Text);
            SqlCommand command = new SqlCommand(sql, connection);

            int result = command.ExecuteNonQuery();

            if (result > 0)
            {
                MessageBox.Show("Event Deleted");
                //UploadPicture upload = new UploadPicture();
                EventManagment events = new EventManagment();
                this.Hide();
                events.Show();


                //upload.Show();
            }
            else
            {
                MessageBox.Show("ERROR!!");
            }
            connection.Close();
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["My Connection"].ConnectionString);

            connection.Open();

            string     sql     = "UPDATE EVENTS SET EventName='" + EventTextBox.Text + "', LastUpdated= '" + EventDateTimePicker.Text + "', Caption= '" + CaptionTextBox.Text + "' WHERE ID= " + Convert.ToInt32(EventIDTextBox.Text);
            SqlCommand command = new SqlCommand(sql, connection);

            int result = command.ExecuteNonQuery();

            if (result > 0)
            {
                MessageBox.Show("Event Updated");
                //UploadPicture upload = new UploadPicture();
                EventManagment events = new EventManagment();
                this.Hide();
                events.Show();


                //upload.Show();
            }
            else
            {
                MessageBox.Show("You Havent made any change!!");
            }
            connection.Close();
        }