private void populatebatchs() { if (!isalloweddatedate() && Session["RoleId"].ToString() != "9") { Response.Write("<script LANGUAGE='JavaScript' >alert('This facility is blocked by administration, Contact Admin!!.')</script>"); return; } if (Session["RoleId"] != null) { DataTable dt = new DataTable(); if (Session["RoleId"].ToString() == "1" || Session["RoleId"].ToString() == "9") { dt = CGeneralFunction.filldataattendance("select ClassSectionId as class_id,c.Code as ClassName,Sc.code as DivisionName,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'') as ClassRoom,COUNT(*) as TotalStudent, case [dbo].[CheckAttendanceStatuswithdate](s.ClassSectionId,'" + txtDate.Text.Trim() + "') when 0 then '../Icons/Red.png' else '../Icons/Green.png' end as AttStatus from tblStudent as s inner join tblClassSection as cs on cs.Id=s.ClassSectionId inner join tblClassMaster as c on c.Id=cs.ClassId inner join tblSection as sc on sc.Id=cs.SectionId inner join tblFaculty as f on f.Id=cs.TeacherId where S.Attr2 ='A' and S.Status=1 and CS.Status =1 group by c.Code,Sc.code,ClassSectionId,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'') order by AttStatus"); } else if (Session["RoleId"].ToString() == "7") { dt = CGeneralFunction.filldataattendance("select ClassSectionId as class_id,c.Code as ClassName,Sc.code as DivisionName,CD.Cdd_Description as ClassRoom,COUNT(*) as TotalStudent, case [dbo].[CheckAttendanceStatuswithdate](s.ClassSectionId,'" + txtDate.Text.Trim() + "') when 0 then '../Icons/Red.png' else '../Icons/Green.png' end as AttStatus from tblStudent as s inner join tblClassSection as cs on cs.Id=s.ClassSectionId inner join tblClassMaster as c on c.Id=cs.ClassId inner join tblSection as sc on sc.Id=cs.SectionId inner join tblFaculty as f on f.Id=cs.TeacherId inner join AdminExam ..tbl_Batch B on B.Batch_Id =C.Attr1 inner join AdminExam ..Course_def_Master CD on CD.Cdd_ID =B.Cdd_id where S.Attr2 ='A' and S.Status=1 and TeacherId='" + Session["EMPID"].ToString() + "' and CS.Status =1 group by c.Code,Sc.code,ClassSectionId,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,''),CD.Cdd_Description order by AttStatus"); } else if (Session["RoleId"].ToString() == "3" || Session["RoleId"].ToString() == "4" || Session["RoleId"].ToString() == "5" || Session["RoleId"].ToString() == "6") { dt = CGeneralFunction.filldataattendance("select ClassSectionId as class_id,c.Code as ClassName,Sc.code as DivisionName,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'') as ClassRoom,COUNT(*) as TotalStudent, case [dbo].[CheckAttendanceStatuswithdate](s.ClassSectionId,'" + txtDate.Text.Trim() + "') when 0 then '../Icons/Red.png' else '../Icons/Green.png' end as AttStatus from tblStudent as s inner join tblClassSection as cs on cs.Id=s.ClassSectionId inner join tblClassMaster as c on c.Id=cs.ClassId inner join tblSection as sc on sc.Id=cs.SectionId inner join tblFaculty as f on f.Id=cs.TeacherId where cs.Id in (select ClassSectionId from tblDesignationAllocation where S.Attr2 ='A' and S.Status=1 and FacultyId='" + Session["EMPID"].ToString() + "') and CS.Status =1 group by c.Code,Sc.code,ClassSectionId,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'') order by AttStatus"); } if (dt.Rows.Count != 0) { gvStayBackReason.DataSource = dt; } else { gvStayBackReason.DataSource = null; } gvStayBackReason.DataBind(); pnlMyClass.Visible = true; } }
protected void ddlFaculty_SelectedIndexChanged(object sender, EventArgs e) { ddlClass.DataSource = CGeneralFunction.filldataattendance("select 0 as SN,0 as Id,'<Select>' as Description union all select Distinct 1 as SN,CS.Id ,CM.Description from tblStudent S inner join tblClassSection CS on S.ClasssectionId = CS.Id inner join tblClassMaster CM on CS.ClassId =CM.Id where CS.Status =1 and S.Status = 1 and CS.TeacherId =" + ddlFaculty.SelectedValue + " and CS.AcademicYearId = " + ddlSem.SelectedValue); ddlClass.DataTextField = "Description"; ddlClass.DataValueField = "Id"; ddlClass.DataBind(); }
protected void gvStayBackReason_RowCommand(object sender, GridViewCommandEventArgs e) { if (!isalloweddatedate() && Session["RoleId"].ToString() != "9") { Response.Write("<script LANGUAGE='JavaScript' >alert('This facility is blocked by administration, Contact Admin!!.')</script>"); return; } try { if (e.CommandName == "View") { DataTable dt; string csId = Convert.ToString(e.CommandArgument); dt = CGeneralFunction.filldata("Usp_BatchwiseStatus " + csId); if (dt.Rows.Count != 0) { gridView.DataSource = dt; } else { gridView.DataSource = null; } gridView.DataBind(); ME1.Show(); } else { int ClassSectionId = Convert.ToInt32(e.CommandArgument.ToString()); DataTable dt = CGeneralFunction.filldataattendance("select ClassId,SectionId from tblClassSection where Id='" + ClassSectionId + "'"); Session["Class_Id"] = dt.Rows[0]["ClassId"].ToString(); Session["Div_Id"] = dt.Rows[0]["SectionId"].ToString(); Session["ClassSectionId"] = ClassSectionId; Response.Redirect("Attendance.aspx?CId=" + ClassSectionId + "&&DDate=" + txtDate.Text.Trim(), false); } } catch { } }