예제 #1
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (lstPromotedStudent.Items.Count == 0)
            {
                CommonFunctions.ShowError("Please select Students to Promote !");
            }
            else
            {
                try
                {
                    bool updated = false;
                    for (int i = 0; i <= lstPromotedStudent.Items.Count - 1; i++)
                    {
                        int            AdmissionNo = Convert.ToInt32(lstPromotedStudent.Items[i].ToString().Split('_')[0]);
                        SqlParameter[] m1          = new SqlParameter[2];

                        m1[0] = new SqlParameter("@Addmission_Number", Convert.ToInt32(AdmissionNo));
                        m1[1] = new SqlParameter("@Session", lblPromotedSession.Text);
                        SqlDataReader dr1 = SqlHelper.ExecuteReader(Connection.Connection_string, "StudentInfo_SelectOneBySession", m1);
                        if (!dr1.Read())
                        {
                            m1[1] = new SqlParameter("@Session", lblSession.Text);

                            SqlDataReader dr = SqlHelper.ExecuteReader(Connection.Connection_string, "StudentInfo_SelectOneBySession", m1);

                            PromoteStudent(dr);
                            updated = true;
                        }
                        else
                        {
                            CommonFunctions.ShowWarning(lstPromotedStudent.Items[i].ToString().Split('_')[1] + " is already promoted");
                        }
                    }
                    if (updated)
                    {
                        CommonFunctions.ShowMessage("Student(s) Promoted successfully");
                        this.Close();
                        StudentPromotion sp = new StudentPromotion();
                        sp.Show();
                    }
                }
                catch (Exception ex)
                {
                    CommonFunctions.ShowError(ex.Message);
                }
            }
        }
예제 #2
0
        private void studentPromotionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StudentPromotion sp = new StudentPromotion();

            sp.Show();
        }