Esempio n. 1
0
        private void metroButton2_Click(object sender, EventArgs e)
        {
            AssignModule            am  = new AssignModule();
            AssignModuleTransaction amt = new AssignModuleTransaction();

            try
            {
                am = amt.fillDataProf(metroComboBoxRMods.Text);
                metroComboBoxRMods.Text  = am.getmid();
                metroTextBoxFacM.Text    = am.getfaculty();
                metroTextBoxP.Text       = am.getprogramme();
                metroTextBoxModFees.Text = am.getmodfee();
                metroTextBoxStd.Text     = am.getstartdate();
                metroTextBoxEnd.Text     = am.getenddate();
            }
            catch
            {
                MetroMessageBox.Show(this, "Course not yet assinged");
            }
        }
        private void metroComboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            //load values to input fields
            AssignModule            am  = new AssignModule();
            AssignModuleTransaction amt = new AssignModuleTransaction();

            try
            {
                am = amt.fillData(metroComboBoxMods.Text);
                metroComboBoxMods.Text   = am.getmid();
                metroTextBoxMFac.Text    = am.getfaculty();
                metroTextBoxProgram.Text = am.getprogramme();
                metroTextBoxMFees.Text   = am.getmodfee();
                metroTextBoxstDate.Text  = am.getstartdate();
                metroTextBoxedDate.Text  = am.getenddate();
            }
            catch
            {
                MetroMessageBox.Show(this, "Course not yet assinged");
            }
        }
Esempio n. 3
0
 //add a module
 public void addModule(AssignModule obj)
 {
     try
     {
         //sql query
         string     sql = "INSERT INTO AssignModule(MId,Programme,Faculty,ModuleFee,Duration,StartDate,EndDate,pId,sId)VALUES('" + obj.getmid() + "','" + obj.getprogramme() + "','" + obj.getfaculty() + "','" + obj.getmodfee() + "','" + obj.getduration() + "','" + obj.getstartdate() + "','" + obj.getenddate() + "','" + obj.getlid() + "','" + obj.getmid() + "')";
         SqlCommand cmd = new SqlCommand(sql, con); // sql command
         con.Open();                                //open connection
         cmd.ExecuteNonQuery();                     //execute query
     }
     finally
     {
         con.Close(); // close connection
     }
 }