Пример #1
0
        private void backExixtingEventButton_Click(object sender, EventArgs e)
        {
            PictureEvents pictureEvents = new PictureEvents(this);

            this.Hide();
            pictureEvents.Show();
        }
Пример #2
0
 public AddPhotos(PictureEvents pictureEvents)
 {
     InitializeComponent();
     this.pictureEvents = pictureEvents;
     this.username      = pictureEvents.username;
     this.eventName     = pictureEvents.eventName;
 }
Пример #3
0
 public ExistingEvent(PictureEvents pictureEvents)
 {
     InitializeComponent();
     this.pictureEvents = pictureEvents;
     username           = pictureEvents.username;
     fillComboBox();
     //MessageBox.Show("Existing " + username);
 }
Пример #4
0
 public ModifyPictures(PictureEvents pictureEvents)
 {
     InitializeComponent();
     this.pictureEvents = pictureEvents;
     eventName          = pictureEvents.eventName;
     username           = pictureEvents.username;
     pictureId          = pictureEvents.pictureId;
     importance         = pictureEvents.peImportanceLabel.Text;
 }
Пример #5
0
        private void modifyButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (highRadioButton.Checked)
                {
                    importanceLabel.Text = "High";
                }
                else if (moderateRadioButton.Checked)
                {
                    importanceLabel.Text = "Moderate";
                }
                else if (lessImportantRadioButton.Checked)
                {
                    importanceLabel.Text = "Less Important";
                }
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString);
                string        sql        = "UPDATE Pictures SET PictureStory='" + pictureStoryTextBox.Text + "', Importance='" + importanceLabel.Text + "',ModifiedDate='" + modifyDateTimePicker.Value +
                                           "',PictureLocation='" + selectPictureLabel.Text + "'Where PictureId='" + Convert.ToInt32(pictureId) + "'";

                SqlCommand command = new SqlCommand(sql, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    addPhotosPictureBox.ImageLocation = reader["PictureLocation"].ToString();
                    eventNameLabel.Text      = reader["EventName"].ToString();
                    selectPictureLabel.Text  = reader["PictureLocation"].ToString();
                    pictureStoryTextBox.Text = reader["PictureStory"].ToString();
                    importance = reader["Importance"].ToString();
                    if (importance == "High")
                    {
                        highRadioButton.Checked = true;
                    }
                    else if (importance == "Moderate")
                    {
                        moderateRadioButton.Checked = true;
                    }
                    else if (importance == "Less Important")
                    {
                        lessImportantRadioButton.Checked = true;
                    }
                }
                MessageBox.Show("Your picture is modified");
                PictureEvents pictureEvents = new PictureEvents(this);
                this.Hide();
                pictureEvents.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Database can not be accessed");
            }
        }
Пример #6
0
 private void existingEventButton_Click(object sender, EventArgs e)
 {
     eventName = existingEventComboBox.Text;
     if (existingEventComboBox.Text == "")
     {
         MessageBox.Show("Event name is empty");
     }
     else
     {
         eventName = existingEventComboBox.Text;
         PictureEvents pictureEvents = new PictureEvents(this);
         this.Hide();
         pictureEvents.Show();
     }
 }
Пример #7
0
        private void uploadButton_Click(object sender, EventArgs e)
        {
            if (highRadioButton.Checked || lessImportantRadioButton.Checked || moderateRadioButton.Checked)
            {
                if (highRadioButton.Checked)
                {
                    importanceLabel.Text = "High";
                }
                else if (lessImportantRadioButton.Checked)
                {
                    importanceLabel.Text = "Less Important";
                }
                else
                {
                    importanceLabel.Text = "Moderate";
                }


                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString);
                connection.Open();
                string sql = "INSERT INTO Pictures(EventName, Username, PictureLocation, CreatedDate,  PictureStory, Importance) " +
                             "VALUES('" + eventName + "','" + username + "','" + selectPictureLabel.Text + "','" + aPdateTimePicker.Value + "','" + pictureStoryTextBox.Text + "','" + importanceLabel.Text + "')";
                //MessageBox.Show("SQL: " + sql);
                SqlCommand command = new SqlCommand(sql, connection);
                int        result  = command.ExecuteNonQuery();
                if (result > 0)
                {
                    MessageBox.Show("Picture added to Event: " + eventName);
                    PictureEvents pictureEvents = new PictureEvents(this);
                    this.Hide();
                    pictureEvents.Show();
                }
                else
                {
                    MessageBox.Show("Error");
                }
                connection.Close();
            }
            else
            {
                MessageBox.Show("Select Importance Level");
            }
        }