private void CheckBatch() { try { using (SqlConnection con = new SqlConnection(cs)) { SqlCommand csm = new SqlCommand("select Batch,DepttId from dbo.Students where Rollno=@rollno", con); csm.Parameters.AddWithValue("@rollno", Session["Rollno"]); con.Open(); SqlDataReader rdr = csm.ExecuteReader(); while (rdr.Read()) { lblBatch.Text = rdr["Batch"].ToString(); lblDepttName.Text = StudentFeeHelper2.ConvertDepttIdToDepartmentName(rdr["DepttId"].ToString()); } } } catch (Exception) { } }
protected void btnSubmit_Click(object sender, EventArgs e) { SqlConnection con; if (ddlFeeType.Text == "Examination Fee") { using (con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("select ExaminationFeeAmount from dbo.MasterFee where YearOfAdmission=@yoa and SessionId=@sessionid and DepttId=@depttid", con); cmd.Parameters.AddWithValue("@yoa", lbltemp1.Text); cmd.Parameters.AddWithValue("@sessionid", FeeHelper.convertsessionnametoid(ddlSessionName.Text)); cmd.Parameters.AddWithValue("@depttid", lbltemp2.Text); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { lbltempfee.Text = rdr["ExaminationFeeAmount"].ToString(); } } } if (ddlFeeType.Text == "Tution Fee") { using (con = new SqlConnection(cs)) { SqlCommand cmd = new SqlCommand("select TutionFeeAmount from dbo.MasterFee where YearOfAdmission=@yoa and SessionId=@sessionid and DepttId=@depttid", con); cmd.Parameters.AddWithValue("@yoa", lbltemp1.Text); cmd.Parameters.AddWithValue("@sessionid", FeeHelper.convertsessionnametoid(ddlSessionName.Text)); cmd.Parameters.AddWithValue("@depttid", lbltemp2.Text); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { lbltempfee.Text = rdr["TutionFeeAmount"].ToString(); } } } using (con = new SqlConnection(cs)) { SqlCommand csm = new SqlCommand("SELECT Students.Rollno, Students.StudentFullName, Students.DepttId,Students.Batch, Session.SessionName, StudentFeeStatus.FeeAmount, StudentFeeStatus.txn_id, StudentFeeStatus.TimeStamp, StudentFeeStatus.Status FROM StudentFeeStatus INNER JOIN Session ON StudentFeeStatus.SessionId = Session.SessionId INNER JOIN Students ON StudentFeeStatus.Rollno = Students.Rollno where Session.SessionName = @sessionname and StudentFeeStatus.[Status] = 'completed' and StudentFeeStatus.Semester =@semester and Students.Rollno = @rollno ", con); csm.Parameters.AddWithValue("@sessionname", ddlSessionName.Text); csm.Parameters.AddWithValue("@rollno", Session["Rollno"]); csm.Parameters.AddWithValue("@semester", ddlSemester.Text); csm.Parameters.AddWithValue("@feeamount", lbltempfee.Text); con.Open(); SqlDataReader rdr = csm.ExecuteReader(); while (rdr.Read()) { lblSttudentName.Text = rdr["StudentFullName"].ToString(); lblRollno.Text = rdr["Rollno"].ToString(); lblDepartmentName.Text = StudentFeeHelper2.ConvertDepttIdToDepartmentName(rdr["DepttId"].ToString()); lblBatch.Text = rdr["Batch"].ToString(); lblAmount.Text = rdr["FeeAmount"].ToString(); lblStatus.Text = rdr["Status"].ToString(); lblDatePaid.Text = rdr["TimeStamp"].ToString(); lbltemp3.Text = rdr["txn_id"].ToString(); } } }