Example #1
0
 private void tile_update_Click(object sender, EventArgs e)
 {
     try
     {
         Database     d      = new Database();
         DialogResult result = MessageBox.Show("Are you sure you want to edit program details?", "NILS", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             string resourceP2;
             string resourceP3;
             if (metroCheckBox1.Checked == true)
             {
                 resourceP2 = General_methods.get_lec_no_from_lec_name(cmb_rp_2.Text);
             }
             else
             {
                 resourceP2 = "None";
             }
             if (metroCheckBox2.Checked == true)
             {
                 resourceP3 = General_methods.get_lec_no_from_lec_name(cmb_rp_3.Text);
             }
             else
             {
                 resourceP3 = "None";
             }
             if (cmb_type_2.SelectedIndex != 5)
             {
                 con.Open();
                 d.update("UPDATE Session_details SET scheduled_date='" + txt_date.Value.ToString("MM/dd/yyyy") + "',course_type='" + ctype + "',course_no='" + course_no.Text + "',Resource_person_1='" + General_methods.get_lec_no_from_lec_name(cmb_rp_1.Text) + "',Resource_person_2='" + resourceP2 + "',Resource_person_3='" + resourceP3 + "',venue=N'" + txt_venue.Text + "' WHERE (program_no='" + txt_progno.Text + "')");
                 MessageBox.Show("Details edited Succefully", "NILS", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 con.Close();
             }
             else
             {
                 con.Open();
                 d.update("UPDATE Session_details SET scheduled_date='" + txt_date.Value.ToString("MM/dd/yyyy") + "',course_type='Workshop', course_no='None', Resource_person_1='" + General_methods.get_lec_no_from_lec_name(cmb_rp_1.Text) + "',Resource_person_2='" + resourceP2 + "', Resource_person_3='" + resourceP3 + "',venue=N'" + txt_venue.Text + "' WHERE (program_no='" + txt_progno.Text + "')");
                 d.update("UPDATE Short_program_details SET Program_title='" + txt_progtitle.Text + "' WHERE Code='" + txt_progno.Text + "'");
                 MessageBox.Show("Details edited Succefully", "NILS", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 con.Close();
             }
         }
         else
         {
         }
     }
     catch (Exception V)
     {
         MessageBox.Show(V.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void SMS_recipents_Load(object sender, EventArgs e)
 {
     if (type == "student")
     {
         con.Open();
         this.ControlBox = false;
         richTextBox1.AppendText("Lecture Reminder");
         richTextBox1.AppendText(Environment.NewLine + "batch - " + batchname);
         richTextBox1.AppendText(Environment.NewLine + "module - " + module);
         richTextBox1.AppendText(Environment.NewLine + "date - " + date);
         richTextBox1.AppendText(Environment.NewLine + "time - " + time);
         richTextBox1.AppendText(Environment.NewLine + "Conducted by - " + lecturer1 + "," + lecturer2 + "," + lecturer3);
         richTextBox1.AppendText(Environment.NewLine + "Venue - " + venue);
         SqlCommand    cmd = new SqlCommand("SELECT stud_no,name_with_initials,mobile FROM Stud_details WHERE batch_no='" + General_methods.get_batch_no_from_batch_name(batchname) + "'", con);
         SqlDataReader dr  = cmd.ExecuteReader();
         int           c   = 0;
         while (dr.Read())
         {
             checkedListBox1.Items.Add(dr.GetValue(0) + " - " + dr.GetValue(1) + " - " + dr.GetValue(2));
             checkedListBox1.SetItemChecked(c, true);
             c++;
         }
     }
     if (type == "lec")
     {
         con.Open();
         this.ControlBox = false;
         richTextBox1.AppendText("Lecture Reminder");
         richTextBox1.AppendText(Environment.NewLine + "batch - " + batchname);
         richTextBox1.AppendText(Environment.NewLine + "module - " + module);
         richTextBox1.AppendText(Environment.NewLine + "date - " + date);
         richTextBox1.AppendText(Environment.NewLine + "time - " + time);
         richTextBox1.AppendText(Environment.NewLine + "Venue - " + venue);
         SqlCommand    cmd = new SqlCommand("SELECT Lecturer_no,F_name,L_name,mobile_no_1 FROM Lecture_details WHERE Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer1) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer2) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer3) + "'", con);
         SqlDataReader dr  = cmd.ExecuteReader();
         int           c   = 0;
         while (dr.Read())
         {
             checkedListBox1.Items.Add(dr.GetValue(0) + " - " + dr.GetValue(1) + " " + dr.GetValue(2) + " - " + dr.GetValue(3));
             checkedListBox1.SetItemChecked(c, true);
             c++;
         }
     }
     if (type == "short_lec")
     {
         con.Open();
         this.ControlBox = false;
         richTextBox1.AppendText("Reminder for " + prg_type + " at NILS");
         richTextBox1.AppendText(Environment.NewLine + "Title - " + batchname);
         richTextBox1.AppendText(Environment.NewLine + "date - " + date);
         richTextBox1.AppendText(Environment.NewLine + "time - " + time);
         richTextBox1.AppendText(Environment.NewLine + "Conducted by - " + lecturer1 + "," + lecturer2 + "," + lecturer3);
         richTextBox1.AppendText(Environment.NewLine + "Venue - " + venue);
         SqlCommand    cmd = new SqlCommand("SELECT Lecturer_no,F_name,L_name,mobile_no_1 FROM Lecture_details WHERE Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer1) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer2) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer3) + "'", con);
         SqlDataReader dr  = cmd.ExecuteReader();
         int           c   = 0;
         while (dr.Read())
         {
             checkedListBox1.Items.Add(dr.GetValue(0) + " - " + dr.GetValue(1) + " " + dr.GetValue(2) + " - " + dr.GetValue(3));
             checkedListBox1.SetItemChecked(c, true);
             c++;
         }
     }
 }
        private void tile_enter_Click(object sender, EventArgs e)
        {
            if (cmb_type.Text == "")
            {
                MessageBox.Show(this, "Please select course type");
            }
            else if (cmb_type.SelectedIndex == 5 && txt_progtitle.Text == "")
            {
                MessageBox.Show(this, "Please enter title for workshop");
            }
            else if (cmb_name.Enabled == true && cmb_name.Text == "")
            {
                MessageBox.Show(this, "Please select the course name");
            }
            else if (cmb_module.Enabled == true && cmb_module.Text == "")
            {
                MessageBox.Show(this, "Please select the module name");
            }
            else if (cmb_rperson1.Text == "")
            {
                MessageBox.Show(this, "Please select at least one resource person");
            }
            else if (cmb_rperson2.Enabled == true && cmb_rperson2.Text == "")
            {
                MessageBox.Show(this, "Please select second resource person");
            }
            else if (cmb_rperson3.Enabled == true && cmb_rperson3.Text == "")
            {
                MessageBox.Show(this, "Please select third resource person");
            }
            else if (groupBox1.Enabled == true && rbn_in.Checked == false && rbn_out.Checked == false)
            {
                MessageBox.Show(this, "Please select venue");
            }
            else if (groupBox1.Enabled = true && rbn_out.Checked == true && (txt_venue.Text == "" || txt_venue.Text == "NILS"))
            {
                MessageBox.Show(this, "Please enter a valid outstation venue");
            }
            else if (cmb_batch.Enabled == true && cmb_batch.Text == "")
            {
                MessageBox.Show("Please select the batch");
            }
            else
            {
                resourceP1 = General_methods.get_lec_no_from_lec_name(cmb_rperson1.Text);

                if (metroCheckBox1.Checked == true)
                {
                    resourceP2 = General_methods.get_lec_no_from_lec_name(cmb_rperson2.Text);
                }
                else
                {
                    resourceP2 = "None";
                }
                if (metroCheckBox2.Checked == true)
                {
                    resourceP3 = General_methods.get_lec_no_from_lec_name(cmb_rperson3.Text);
                }
                else
                {
                    resourceP3 = "None";
                }
                Database d = new Database();
                string   code;
                code = generate_program_no(ctype);
                if (cmb_type.SelectedIndex == 0)
                {
                    d.insert("INSERT INTO Session_details (program_no,scheduled_date,course_type,course_no,module,Resource_person_1,Resource_person_2,Resource_person_3,venue,overall_morn_rating,overall_noon_rating,Batch_no) VALUES('" + code + "','" + metroDateTime1.Value + "','" + ctype + "','" + txt_no.Text + "', '" + cmb_module.Text + "' ,'" + resourceP1 + "','" + resourceP2 + "','" + resourceP3 + "',N'" + txt_venue.Text + "','0','0','" + General_methods.get_batch_no_from_batch_name(cmb_batch.Text) + "')");
                }
                if (cmb_type.SelectedIndex == 1)
                {
                    d.insert("INSERT INTO Session_details (program_no,scheduled_date,course_type,course_no,module,Resource_person_1,Resource_person_2,Resource_person_3,venue,overall_morn_rating,overall_noon_rating,Batch_no) VALUES('" + code + "','" + metroDateTime1.Value + "','" + ctype + "','" + txt_no.Text + "', '" + cmb_module.Text + "' ,'" + resourceP1 + "','" + resourceP2 + "','" + resourceP3 + "',N'" + txt_venue.Text + "','0','0','" + General_methods.get_batch_no_from_batch_name(cmb_batch.Text) + "')");
                }
                if (cmb_type.SelectedIndex == 2)
                {
                    d.insert("INSERT INTO Session_details (program_no,scheduled_date,course_type,course_no,module,Resource_person_1,Resource_person_2,Resource_person_3,venue,overall_morn_rating,overall_noon_rating) VALUES('" + code + "','" + metroDateTime1.Value + "','" + ctype + "','" + txt_no.Text + "', 'no modules' ,'" + resourceP1 + "','" + resourceP2 + "','" + resourceP3 + "',N'" + txt_venue.Text + "','0','0')");
                    d.insert("INSERT INTO Short_program_details (Code,Program_title) VALUES ('" + code + "','" + txt_progtitle.Text + "')");
                }
                if (cmb_type.SelectedIndex == 3)
                {
                    d.insert("INSERT INTO Session_details (program_no,scheduled_date,course_type,course_no,module,Resource_person_1,Resource_person_2,Resource_person_3,venue,overall_morn_rating,overall_noon_rating) VALUES('" + code + "','" + metroDateTime1.Value + "','" + ctype + "','" + txt_no.Text + "', 'no modules' ,'" + resourceP1 + "','" + resourceP2 + "','" + resourceP3 + "',N'" + txt_venue.Text + "','0','0')");
                    d.insert("INSERT INTO Short_program_details (Code,Program_title) VALUES ('" + code + "','" + txt_progtitle.Text + "')");
                }
                if (cmb_type.SelectedIndex == 4)
                {
                    d.insert("INSERT INTO Session_details (program_no,scheduled_date,course_type,course_no,module,Resource_person_1,Resource_person_2,Resource_person_3,venue,overall_morn_rating,overall_noon_rating) VALUES('" + code + "','" + metroDateTime1.Value + "','" + ctype + "','" + txt_no.Text + "', 'no modules' ,'" + resourceP1 + "','" + resourceP2 + "','" + resourceP3 + "',N'" + txt_venue.Text + "','0','0')");
                    d.insert("INSERT INTO Short_program_details (Code,Program_title) VALUES ('" + code + "','" + txt_progtitle.Text + "')");
                }
                if (cmb_type.SelectedIndex == 5)
                {
                    d.insert("INSERT INTO Session_details (program_no,scheduled_date,course_type,course_no,module,Resource_person_1,Resource_person_2,Resource_person_3,venue,overall_morn_rating,overall_noon_rating) VALUES('" + code + "','" + metroDateTime1.Value + "','" + ctype + "','None', 'no modules' ,'" + resourceP1 + "','" + resourceP2 + "','" + resourceP3 + "',N'" + txt_venue.Text + "','0','0')");
                    d.insert("INSERT INTO Short_program_details (Code,Program_title) VALUES ('" + code + "','" + txt_progtitle.Text + "')");
                }
                MessageBox.Show("Successfully Scheduled New Program", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
 private void Email_recipients_Load(object sender, EventArgs e)
 {
     if (type == "dip_studs")
     {
         metroTextBox1.Text = "Lecturer Reminder- (" + batchname + ")";
         richTextBox1.AppendText("Lecture Reminder");
         richTextBox1.AppendText(Environment.NewLine + "batch - " + batchname);
         richTextBox1.AppendText(Environment.NewLine + "module - " + module);
         richTextBox1.AppendText(Environment.NewLine + "date - " + date);
         richTextBox1.AppendText(Environment.NewLine + "time - " + time);
         richTextBox1.AppendText(Environment.NewLine + "Conducted by - " + lecturer1 + "," + lecturer2 + "," + lecturer3);
         richTextBox1.AppendText(Environment.NewLine + "Venue - " + venue);
         richTextBox1.AppendText(Environment.NewLine + "Please be present");
         con.Open();
         SqlCommand    cmd = new SqlCommand("SELECT stud_no,name_with_initials,email_R FROM Stud_details WHERE batch_no='" + General_methods.get_batch_no_from_batch_name(batchname) + "'", con);
         SqlDataReader dr  = cmd.ExecuteReader();
         int           c   = 0;
         while (dr.Read())
         {
             checkedListBox1.Items.Add(dr.GetValue(0) + " - " + dr.GetValue(1) + " - " + dr.GetValue(2));
             checkedListBox1.SetItemChecked(c, true);
             c++;
         }
         con.Close();
     }
     if (type == "lec")
     {
         con.Open();
         this.ControlBox    = false;
         metroTextBox1.Text = "Lecturer Reminder- (" + batchname + ")";
         richTextBox1.AppendText("Lecture Reminder");
         richTextBox1.AppendText(Environment.NewLine + "batch - " + batchname);
         richTextBox1.AppendText(Environment.NewLine + "module - " + module);
         richTextBox1.AppendText(Environment.NewLine + "date - " + date);
         richTextBox1.AppendText(Environment.NewLine + "time - " + time);
         richTextBox1.AppendText(Environment.NewLine + "Venue - " + venue);
         SqlCommand    cmd = new SqlCommand("SELECT Lecturer_no,F_name,L_name,email FROM Lecture_details WHERE Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer1) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer2) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer3) + "'", con);
         SqlDataReader dr  = cmd.ExecuteReader();
         int           c   = 0;
         while (dr.Read())
         {
             checkedListBox1.Items.Add(dr.GetValue(0) + " - " + dr.GetValue(1) + " " + dr.GetValue(2) + " - " + dr.GetValue(3));
             checkedListBox1.SetItemChecked(c, true);
             c++;
         }
     }
     if (type == "short")
     {
         con.Open();
         this.ControlBox    = false;
         metroTextBox1.Text = "Lecturer Reminder- (" + batchname + ")";
         richTextBox1.AppendText("Lecture Reminder");
         richTextBox1.AppendText(Environment.NewLine + "Topic - " + batchname);
         //richTextBox1.AppendText(Environment.NewLine + "module - " + module);
         richTextBox1.AppendText(Environment.NewLine + "date - " + date);
         richTextBox1.AppendText(Environment.NewLine + "time - " + time);
         richTextBox1.AppendText(Environment.NewLine + "Venue - " + venue);
         SqlCommand    cmd = new SqlCommand("SELECT Lecturer_no,F_name,L_name,email FROM Lecture_details WHERE Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer1) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer2) + "' OR Lecturer_no='" + General_methods.get_lec_no_from_lec_name(lecturer3) + "'", con);
         SqlDataReader dr  = cmd.ExecuteReader();
         int           c   = 0;
         while (dr.Read())
         {
             checkedListBox1.Items.Add(dr.GetValue(0) + " - " + dr.GetValue(1) + " " + dr.GetValue(2) + " - " + dr.GetValue(3));
             checkedListBox1.SetItemChecked(c, true);
             c++;
         }
     }
 }