protected void Click(object sender, EventArgs e) { try { string degree = ""; if (txt_department.Enabled == true) { for (int i = 0; i < cbldepartment.Items.Count; i++) { if (cbldepartment.Items[i].Selected == true) { if (degree == "") { degree = cbldepartment.Items[i].Value; } else { degree = degree + "'" + "," + "'" + cbldepartment.Items[i].Value; } } } } string[] Fromdate = txt_fromdate.Text.ToString().Split('/'); string Fdate = Fromdate[1] + "/" + Fromdate[0] + "/" + Fromdate[2]; string[] Todate = txt_todate.Text.ToString().Split('/'); string Tdate = Todate[1] + "/" + Todate[0] + "/" + Todate[2]; string type = ddltype.SelectedItem.Text; string eduleve = ddledulevel.SelectedItem.Text; if (cbapply.Checked == true) { string query = ""; if (degree == "") { if (ddledulevel.SelectedItem.Text == "Both") { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='1' and c.type='" + type + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc "; } else { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='1' and c.type='" + type + "' and c.Edu_Level ='" + eduleve + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc "; } } else { if (ddledulevel.SelectedItem.Text == "Both") { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='1' and a.degree_code=r.degree_code and r.degree_code in ('" + degree + "') and c.type='" + type + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc "; } else { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='1' and a.degree_code=r.degree_code and r.degree_code in ('" + degree + "') and c.type='" + type + "' and c.Edu_Level ='" + eduleve + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc "; } } ds.Clear(); ds = d2.select_method_wo_parameter(query, "Text"); if (ds.Tables[0].Rows.Count > 0) { data.Columns.Add("S.No", typeof(string)); data.Columns.Add("Reg.No", typeof(string)); data.Columns.Add("Student Name", typeof(string)); data.Columns.Add("Class & Group", typeof(string)); data.Columns.Add("Remarks", typeof(string)); int sno = 0; for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { sno++; data.Rows.Add(sno, ds.Tables[0].Rows[j]["Reg_No"], ds.Tables[0].Rows[j]["stud_name"], ds.Tables[0].Rows[j]["dept"], ""); } if (data.Rows.Count > 0) { Showgrid.DataSource = data; Showgrid.DataBind(); Showgrid.Visible = true; btn_pdf.Visible = true; btnexcel.Visible = true; if (Showgrid.Rows.Count > 0) { for (int row = 0; row < Showgrid.Rows.Count; row++) { Showgrid.Rows[row].Cells[0].HorizontalAlign = HorizontalAlign.Center; } } } else { Showgrid.Visible = false; btn_pdf.Visible = false; btnexcel.Visible = false; } } else { Showgrid.Visible = false; btn_pdf.Visible = false; btnexcel.Visible = false; } } else if (cbnotapply.Checked == true) { string query = ""; if (degree == "") { if (ddledulevel.SelectedItem.Text == "Both") { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='0' and c.type='" + ddltype.SelectedItem.Text + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc"; } else { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='0' and c.type='" + ddltype.SelectedItem.Text + "' and c.Edu_Level='" + ddledulevel.SelectedItem.Text + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc"; } } else { if (ddledulevel.SelectedItem.Text == "Both") { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='0' and a.degree_code=r.degree_code and r.degree_code in ('" + degree + "') and c.type='" + ddltype.SelectedItem.Text + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc"; } else { query = "select a.stud_name,r.Reg_No,(c.Course_Name+'-'+dt.Dept_Name)as dept,CONVERT(varchar(10),a.dob,103) as dob,r.Batch_Year ,StuPer_Id,Student_Mobile from applyn a,Registration r,Degree d,Department dt,course c where a.app_no =r.App_No and a.degree_code=d.Degree_Code and d.Degree_Code=r.degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id=d.Course_Id and a.college_code=r.college_code and CC=1 and Exam_Flag ='OK' and DelFlag=0 and isalumni='0' and a.degree_code=r.degree_code and r.degree_code in ('" + degree + "') and c.type='" + ddltype.SelectedItem.Text + "' and c.Edu_Level='" + ddledulevel.SelectedItem.Text + "' and AlumnregisterDate between '" + Fdate.ToString() + "' and '" + Tdate.ToString() + "' order by case sex when 2 then -1 else sex end desc"; } } ds.Clear(); ds = d2.select_method_wo_parameter(query, "Text"); if (ds.Tables[0].Rows.Count > 0) { data.Columns.Add("S.No", typeof(string)); data.Columns.Add("Reg.No", typeof(string)); data.Columns.Add("Student Name", typeof(string)); data.Columns.Add("Class & Group", typeof(string)); data.Columns.Add("Remarks", typeof(string)); int sno = 0; for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { sno++; data.Rows.Add(sno, ds.Tables[0].Rows[j]["Reg_No"], ds.Tables[0].Rows[j]["stud_name"], ds.Tables[0].Rows[j]["dept"], ""); } if (data.Rows.Count > 0) { Showgrid.DataSource = data; Showgrid.DataBind(); Showgrid.Visible = true; btn_pdf.Visible = true; btnexcel.Visible = true; if (Showgrid.Rows.Count > 0) { for (int row = 0; row < Showgrid.Rows.Count; row++) { Showgrid.Rows[row].Cells[0].HorizontalAlign = HorizontalAlign.Center; } } } else { Showgrid.Visible = false; btn_pdf.Visible = false; btnexcel.Visible = false; } } else { Showgrid.Visible = false; btn_pdf.Visible = false; btnexcel.Visible = false; } } } catch { } }
protected void btngo_Click(object sender, EventArgs e) { if (txttodate.Text != "" && txtfromdate.Text != "") { btnPrint11(); string query = ""; string fromdate = string.Empty; fromdate = txtfromdate.Text.ToString(); string[] splitfrom = fromdate.Split(new Char[] { '/' }); string splitdatefrom = Convert.ToString(splitfrom[0]); string splitmonthfrom = Convert.ToString(splitfrom[1]); string splityearfrom = Convert.ToString(splitfrom[2]); fromdate = splitmonthfrom + '/' + splitdatefrom + '/' + splityearfrom; string todate = string.Empty; todate = txttodate.Text.ToString(); string[] splitto = todate.Split(new Char[] { '/' }); string splitdateto = Convert.ToString(splitto[0]); string splitmonthto = Convert.ToString(splitto[1]); string splityearto = Convert.ToString(splitto[2]); todate = splitmonthto + '/' + splitdateto + '/' + splityearto; string subject = ""; if (txtsubject.Text != "--Select--" || ddlsubject.Items.Count != null) { int itemcount = 0; for (itemcount = 0; itemcount < ddlsubject.Items.Count; itemcount++) { if (ddlsubject.Items[itemcount].Selected == true) { if (subject == "") { subject = "'" + ddlsubject.Items[itemcount].Value.ToString() + "'"; } else { subject = subject + "," + "'" + ddlsubject.Items[itemcount].Value.ToString() + "'"; } } } } if (subject != "") { subject = " in(" + subject + ")"; subject = " and shd.subject_no " + subject + ""; } else { subject = " "; } Showgrid.Visible = true; divMainContents.Visible = true; btnexcel.Visible = true; txtexcelname.Visible = true; lblrptname.Visible = true; btnprintmaster.Visible = true; btnPrint.Visible = true; Dictionary <int, string> dicsubjspan = new Dictionary <int, string>(); int span = 0; ArrayList arrColHdrNames1 = new ArrayList(); if (rbcount.Checked == true) { arrColHdrNames1.Add("S.No"); data.Columns.Add("col0"); arrColHdrNames1.Add("Subject"); data.Columns.Add("col1"); arrColHdrNames1.Add("Date"); data.Columns.Add("col2"); arrColHdrNames1.Add("No.of Periods"); data.Columns.Add("col3"); arrColHdrNames1.Add("Topics"); data.Columns.Add("col4"); DataRow drHdr1 = data.NewRow(); for (int grCol = 0; grCol < data.Columns.Count; grCol++) { drHdr1["col" + grCol] = arrColHdrNames1[grCol]; } data.Rows.Add(drHdr1); //query = "select s.subject_name,shm.date,datediff (hour,shd.start_time ,shd.end_time ) as nohour,shd.topic_no from specialhr_details shd,specialhr_master shm,subject s where shd.hrentry_no=shm.hrentry_no and shd.subject_no=s.subject_no and shm.degree_code=" + ddlbranch.SelectedValue.ToString() + " and shm.semester=" + ddlsemester.SelectedValue.ToString() + " and shm.batch_year=" + ddlbatch.SelectedValue.ToString() + " " + subject + " and shm.date between '" + fromdate + "' and '" + todate + "' order by shm.date"; query = " select COUNT(s.subject_name) as periods, s.subject_name,shm.date,s.subject_no from specialhr_details shd,specialhr_master shm,subject s where shd.hrentry_no=shm.hrentry_no and shd.subject_no=s.subject_no and shm.degree_code=" + ddlbranch.SelectedValue.ToString() + " and shm.semester=" + ddlsemester.SelectedValue.ToString() + " and shm.batch_year=" + ddlbatch.SelectedValue.ToString() + " " + subject + " and shm.date between '" + fromdate + "' and '" + todate + "' group by shm.date,s.subject_no,s.subject_name order by shm.date"; ds2 = d2.select_method(query, hat, "Text"); int sno = 0; if (ds2.Tables[0].Rows.Count > 0) { for (int rolcount = 0; rolcount < ds2.Tables[0].Rows.Count; rolcount++) { string date = ds2.Tables[0].Rows[rolcount]["date"].ToString(); string[] spiltdate = date.Split(new Char[] { ' ' }); string splitdate = Convert.ToString(spiltdate[0]); string[] spiltexact = splitdate.Split(new Char[] { '/' }); string splitexactdate = spiltexact[1].ToString() + '/' + spiltexact[0].ToString() + '/' + spiltexact[2].ToString(); string subjectno = ds2.Tables[0].Rows[rolcount]["subject_no"].ToString(); sno++; norecordlbl.Visible = false; drow = data.NewRow(); data.Rows.Add(drow); data.Rows[data.Rows.Count - 1][0] = Convert.ToString(sno); data.Rows[data.Rows.Count - 1][1] = ds2.Tables[0].Rows[rolcount]["subject_name"].ToString(); data.Rows[data.Rows.Count - 1][2] = Convert.ToString(splitexactdate); data.Rows[data.Rows.Count - 1][3] = ds2.Tables[0].Rows[rolcount]["periods"].ToString(); string topicname = ""; string topicquery = " select sd.topic_no from specialhr_master sm,specialhr_details sd where sm.hrentry_no=sd.hrentry_no and sm.date='" + splitdate + "' and sd.subject_no='" + subjectno + "'"; DataSet dstopic = d2.select_method_wo_parameter(topicquery, "Text"); for (int tpn = 0; tpn < dstopic.Tables[0].Rows.Count; tpn++) { // string unitname = Convert.ToString(ds2.Tables[0].Rows[rolcount]["topic_no"]); string unitname = Convert.ToString(dstopic.Tables[0].Rows[tpn]["topic_no"].ToString()); string[] unitname1; string unitnamespilt; unitname1 = unitname.Split('/'); for (int i = 0; i <= unitname1.GetUpperBound(0); i++) { unitnamespilt = unitname1[i]; if (unitnamespilt != "" && unitnamespilt != null && unitnamespilt != " ")//condition Added by Manikandan 24/07/2013 { string gettopicname = d2.GetFunction("select unit_name from sub_unit_details where topic_no='" + unitnamespilt + "'"); if (topicname == "") { topicname = gettopicname; } else { topicname = topicname + '/' + gettopicname; } //con1.Open(); //SqlCommand cmdunit = new SqlCommand("select unit_name from sub_unit_details where topic_no='" + unitnamespilt + "'", con1); //SqlDataReader drunit = cmdunit.ExecuteReader(); //if (drunit.Read()) //{ // if (topicname == "") // { // topicname = drunit["unit_name"].ToString(); // } // else // { // topicname = topicname + '/' + drunit["unit_name"].ToString(); // } //} //drunit.Close(); //con1.Close(); } } } data.Rows[data.Rows.Count - 1][4] = topicname; } } else { divMainContents.Visible = false; norecordlbl.Visible = true; Showgrid.Visible = false; btnprintmaster.Visible = false; btnPrint.Visible = false; norecordlbl.Text = "No Records Found"; btnexcel.Visible = false; lblrptname.Visible = false; txtexcelname.Visible = false; } } else if (rbdetail.Checked == true) { dicsubjspan.Clear(); norecordlbl.Visible = false; arrColHdrNames1.Add("S.No"); data.Columns.Add("col0"); arrColHdrNames1.Add("Date"); data.Columns.Add("col1"); arrColHdrNames1.Add("No.of Periods"); data.Columns.Add("col2"); arrColHdrNames1.Add("Topics"); data.Columns.Add("col3"); DataRow drHdr1 = data.NewRow(); for (int grCol = 0; grCol < data.Columns.Count; grCol++) { drHdr1["col" + grCol] = arrColHdrNames1[grCol]; } data.Rows.Add(drHdr1); int intcrow = 0; string detailsubject = ""; int sno = 0; //query = "select s.subject_name,shm.date,datediff (hour,shd.start_time ,shd.end_time ) as nohour,shd.topic_no from specialhr_details shd,specialhr_master shm,subject s where shd.hrentry_no=shm.hrentry_no and shd.subject_no=s.subject_no and shm.degree_code=" + ddlbranch.SelectedValue.ToString() + " and shm.semester=" + ddlsemester.SelectedValue.ToString() + " and shm.batch_year=" + ddlbatch.SelectedValue.ToString() + " " + subject + " and shm.date between '" + fromdate + "' and '" + todate + "' order by shd.subject_no"; query = "select COUNT(s.subject_name) as periods,s.subject_no,s.subject_name,shm.date from specialhr_details shd,specialhr_master shm,subject s where shd.hrentry_no=shm.hrentry_no and shd.subject_no=s.subject_no and shm.degree_code=" + ddlbranch.SelectedValue.ToString() + " and shm.semester=" + ddlsemester.SelectedValue.ToString() + " and shm.batch_year=" + ddlbatch.SelectedValue.ToString() + " " + subject + " and shm.date between '" + fromdate + "' and '" + todate + "' group by s.subject_no,s.subject_name,shm.date order by shm.date,s.subject_no,s.subject_name"; ds2 = d2.select_method(query, hat, "Text"); con.Open(); if (ds2.Tables[0].Rows.Count > 0) { for (int rolcount = 0; rolcount < ds2.Tables[0].Rows.Count; rolcount++) { string topicname = ""; string date = ds2.Tables[0].Rows[rolcount]["date"].ToString(); string[] spiltdate = date.Split(new Char[] { ' ' }); string splitdate = Convert.ToString(spiltdate[0]); string[] spiltexact = splitdate.Split(new Char[] { '/' }); string splitexactdate = spiltexact[1].ToString() + '/' + spiltexact[0].ToString() + '/' + spiltexact[2].ToString(); string subjectno = ds2.Tables[0].Rows[rolcount]["subject_no"].ToString(); string topicquery = " select sd.topic_no from specialhr_master sm,specialhr_details sd where sm.hrentry_no=sd.hrentry_no and sm.date='" + splitdate + "' and sd.subject_no='" + subjectno + "'"; DataSet dstopic = d2.select_method_wo_parameter(topicquery, "Text"); for (int tpn = 0; tpn < dstopic.Tables[0].Rows.Count; tpn++) { //string unitname = ds2.Tables[0].Rows[rolcount]["topic_no"].ToString(); string unitname = dstopic.Tables[0].Rows[tpn]["topic_no"].ToString(); string[] unitname1; string unitnamespilt; if (unitname.ToString().Trim() != "") { unitname1 = unitname.Split('/'); for (int i = 0; i <= unitname1.GetUpperBound(0); i++) { unitnamespilt = unitname1[i]; string gettopicname = d2.GetFunction("select unit_name from sub_unit_details where topic_no='" + unitnamespilt + "'"); if (topicname == "") { topicname = gettopicname; } else { topicname = topicname + '/' + gettopicname; } //con1.Open(); //SqlCommand cmdunit = new SqlCommand("select unit_name from sub_unit_details where topic_no='" + unitnamespilt + "'", con1); //SqlDataReader drunit = cmdunit.ExecuteReader(); //if (drunit.Read()) //{ // if (topicname == "") // { // topicname = drunit["unit_name"].ToString(); // } // else // { // topicname = topicname + '/' + drunit["unit_name"].ToString(); // } //} //drunit.Close(); //con1.Close(); } } } if (detailsubject != Convert.ToString(ds2.Tables[0].Rows[rolcount]["subject_name"])) { drow = data.NewRow(); data.Rows.Add(drow); data.Rows[data.Rows.Count - 1][0] = ds2.Tables[0].Rows[rolcount]["subject_name"].ToString(); dicsubjspan.Add(data.Rows.Count - 1, ds2.Tables[0].Rows[rolcount]["subject_name"].ToString()); } sno++; drow = data.NewRow(); data.Rows.Add(drow); data.Rows[data.Rows.Count - 1][0] = Convert.ToString(sno); data.Rows[data.Rows.Count - 1][1] = Convert.ToString(splitexactdate); data.Rows[data.Rows.Count - 1][2] = ds2.Tables[0].Rows[rolcount]["periods"].ToString(); data.Rows[data.Rows.Count - 1][3] = topicname; detailsubject = ds2.Tables[0].Rows[rolcount]["subject_name"].ToString(); } } else { norecordlbl.Visible = true; Showgrid.Visible = false; btnprintmaster.Visible = false; btnPrint.Visible = false; norecordlbl.Text = "No Records Found"; btnexcel.Visible = false; lblrptname.Visible = false; txtexcelname.Visible = false; divMainContents.Visible = false; } } if (data.Columns.Count > 0 && data.Rows.Count > 1)//===========on 9/4/12 { divMainContents.Visible = true; Showgrid.DataSource = data; Showgrid.DataBind(); Showgrid.Visible = true; Showgrid.Width = 500; if (Showgrid.Rows.Count > 0) { Showgrid.Rows[0].BackColor = ColorTranslator.FromHtml("#0CA6CA"); Showgrid.Rows[0].Font.Bold = true; if (dicsubjspan.Count > 0) { foreach (KeyValuePair <int, string> dr in dicsubjspan) { int rowcnt = dr.Key; int d = Convert.ToInt32(data.Columns.Count); Showgrid.Rows[rowcnt].Cells[0].HorizontalAlign = HorizontalAlign.Center; Showgrid.Rows[rowcnt].Cells[0].Font.Bold = true; Showgrid.Rows[rowcnt].Cells[0].ColumnSpan = d; for (int a = 1; a < d; a++) { Showgrid.Rows[rowcnt].Cells[a].Visible = false; } } } } } else { divMainContents.Visible = false; norecordlbl.Visible = true; Showgrid.Visible = false; btnprintmaster.Visible = false; btnPrint.Visible = false; norecordlbl.Text = "No Records Found"; btnexcel.Visible = false; lblrptname.Visible = false; txtexcelname.Visible = false; } } else { divMainContents.Visible = false; norecordlbl.Visible = true; Showgrid.Visible = false; btnprintmaster.Visible = false; btnPrint.Visible = false; btnexcel.Visible = false; lblrptname.Visible = false; txtexcelname.Visible = false; norecordlbl.Text = "Please Enter From and To Date"; } }
protected void btngo_Click(object sender, EventArgs e) { try { DataSet getstudet = new DataSet(); string couseid = ""; string subcode = ""; string tstcode = ""; string per = ""; double pert = 0; string subno = string.Empty; string pervalue = string.Empty; dtab.Columns.Add("Details"); for (int i = 0; i < cblco.Items.Count; i++) { if (cblco.Items[i].Selected == true) { dtab.Columns.Add(cblco.Items[i].Text); } } if (ddlsymbol.Items.Count > 0) { per = Convert.ToString(ddlsymbol.SelectedValue).Trim(); } if (txtpercent.Text != "") { pervalue = txtpercent.Text; } else { ScriptManager.RegisterClientScriptBlock(this, typeof(Page), UniqueID, "alert('Please Enter the %')", true); return; } if (cblco.Items.Count > 0) { couseid = Convert.ToString(rs.getCblSelectedValue(cblco)); } if (ddl_subject.Items.Count > 0) { subcode = Convert.ToString(ddl_subject.SelectedValue); } if (cbltest.Items.Count > 0) { tstcode = Convert.ToString(rs.getCblSelectedValue(cbltest)); } drow = dtab.NewRow(); drow["Details"] = "Class Averag Marks %"; dtab.Rows.Add(drow); drow = dtab.NewRow(); drow["Details"] = "Median"; dtab.Rows.Add(drow); drow = dtab.NewRow(); drow["Details"] = per + pervalue + "%"; dtab.Rows.Add(drow); drow = dtab.NewRow(); drow["Details"] = "Co Achieved : Yes/No"; dtab.Rows.Add(drow); string batchyear = ""; string degreecode = ""; string semester = ""; string section = ""; string sect = ""; int col = 0; if (ddlcollege.Items.Count > 0) { collegecode = Convert.ToString(ddlcollege.SelectedValue).Trim(); } if (ddlbatch.Items.Count > 0) { batchyear = Convert.ToString(ddlbatch.SelectedValue).Trim(); } if (ddlbranch.Items.Count > 0) { degreecode = Convert.ToString(ddlbranch.SelectedValue).Trim(); } if (ddlsemester.Items.Count > 0) { semester = Convert.ToString(ddlsemester.SelectedValue).Trim(); } if (ddlsection.Enabled == true) { if (ddlsection.Items.Count > 0) { if (Convert.ToString(ddlsection.SelectedItem.Text).Trim().ToLower() != "all" && Convert.ToString(ddlsection.SelectedItem.Text).Trim().ToLower() != "" && Convert.ToString(ddlsection.SelectedItem.Text).Trim().ToLower() != "-1") { section = Convert.ToString(ddlsection.SelectedItem.Text).Trim(); sect = " and r.Sections='" + section + "'"; } else { section = ""; } } } else { section = ""; } if (!string.IsNullOrEmpty(collegecode) && !string.IsNullOrEmpty(batchyear) && !string.IsNullOrEmpty(degreecode) && !string.IsNullOrEmpty(semester) && !string.IsNullOrEmpty(couseid)) { string sqlqry = "select distinct r.App_No,q.CourseOutComeNo from NewInternalMarkEntry m,CAQuesSettingsParent q,registration r,SubjectChooser s,Exam_type e where r.App_No=m.app_no and LTRIM(rtrim(ISNULL(r.sections,'')))=LTRIM(rtrim(ISNULL(e.sections,''))) and s.subject_no=q.subjectNo and e.exam_code=m.ExamCode and e.subject_no=q.subjectNo and e.criteria_no=q.CriteriaNo and r.Roll_No=s.roll_no and q.MasterID=m.MasterID and RollNo_Flag<>'0' and cc='0' and delflag='0' and exam_flag <> 'DEBAR' and r.degree_code='" + degreecode + "' and r.college_code='" + collegecode + "' and r.Batch_Year='" + batchyear + "' and r.Current_Semester='" + semester + "' " + sect + " and q.subjectNo in('" + subcode + "') and q.CriteriaNo in('" + tstcode + "')"; //sqlqry += " select Sum(Mark),CourseOutComeNo,subjectno,CriteriaNo from CAQuesSettingsParent"; //sqlqry += " select SUM(im.marks) mark,ca.CourseOutComeNo,ca.subjectno,ca.CriteriaNo from CAQuesSettingsParent ca,InternalMarkEntry im where ca.MasterID=im.MasterID "; getstudet.Clear(); getstudet = d2.select_method_wo_parameter(sqlqry, "text"); if (getstudet.Tables.Count > 0 && getstudet.Tables[0].Rows.Count > 0) { for (int cou = 0; cou < cblco.Items.Count; cou++) { if (cblco.Items[cou].Selected == true) { col++; couseid = cblco.Items[cou].Value; getstudet.Tables[0].DefaultView.RowFilter = "CourseOutComeNo ='" + couseid + "'"; DataView dvstd = getstudet.Tables[0].DefaultView; int totstd = dvstd.Count; string toalcousermark = d2.GetFunction(" select Sum(Mark) from CAQuesSettingsParent where CourseOutComeNo='" + couseid + "' and subjectno='" + subcode + "' and CriteriaNo in('" + tstcode + "')"); // Calculate Class Averag Marks % string value = d2.GetFunction("select SUM(im.marks) mark from CAQuesSettingsParent ca,NewInternalMarkEntry im where ca.MasterID=im.MasterID and ca.CourseOutComeNo='" + couseid + "' and ca.subjectno in('" + subcode + "') and ca.CriteriaNo in('" + tstcode + "') "); if (value != "" && Convert.ToDouble(value) > 0) { double toalstdmark = Convert.ToDouble(totstd) * Convert.ToDouble(toalcousermark); pert = Convert.ToDouble(value) / Convert.ToDouble(toalstdmark); double pertge = pert * 100; // double pets = (pertge * txtpert) / 100; string perts = Convert.ToString(Math.Round(Convert.ToDouble(pertge), 2)); dtab.Rows[dtab.Rows.Count - 4][col] = perts; } else { dtab.Rows[dtab.Rows.Count - 4][col] = "0"; } //End double mediamstadmark = 0; double userentrystdmark = 0; int mediamstdcnt = 0; int userentryperstdcnt = 0; string classavgper = dtab.Rows[dtab.Rows.Count - 4][col].ToString(); double txtperta = Convert.ToDouble(pervalue); if (dvstd.Count > 0) { for (int std = 0; std < dvstd.Count; std++) { double stdcomark = 0; string appno = Convert.ToString(dvstd[std]["app_no"]); string stdmark = d2.GetFunction("select SUM(im.marks) mark from CAQuesSettingsParent ca,NewInternalMarkEntry im where ca.MasterID=im.MasterID and app_no='" + appno + "' and ca.CourseOutComeNo ='" + couseid + "' and subjectno='" + subcode + "' and CriteriaNo in('" + tstcode + "') "); if (stdmark == "") { stdcomark = 0; } else { stdcomark = Convert.ToDouble(stdmark); } if (Convert.ToDouble(stdcomark) > 0) { double stdpert = Convert.ToDouble(stdcomark) / Convert.ToDouble(toalcousermark); double pertge = stdpert * 100; string stdpersentage = Convert.ToString(Math.Round(Convert.ToDouble(pertge), 2)); // Calculate Mediam if (classavgper != "") { if (Convert.ToDouble(classavgper) < Convert.ToDouble(stdpersentage)) { mediamstadmark = mediamstadmark + Convert.ToDouble(stdcomark); mediamstdcnt++; } } //End //Calculate user entry Per if (per == ">") { if (Convert.ToDouble(stdpersentage) > txtperta) { string stdpertge = stdpersentage; userentrystdmark = userentrystdmark + Convert.ToDouble(stdcomark); userentryperstdcnt++; } } else if (per == "<") { if (Convert.ToDouble(stdpersentage) < txtperta) { string stdpertge = stdpersentage; userentrystdmark = userentrystdmark + Convert.ToDouble(stdcomark); userentryperstdcnt++; } } else if (per == ">=") { if (Convert.ToDouble(stdpersentage) >= txtperta) { string stdpertge = stdpersentage; userentrystdmark = userentrystdmark + Convert.ToDouble(stdcomark); userentryperstdcnt++; } } else if (per == "<=") { if (Convert.ToDouble(stdpersentage) <= txtperta) { string stdpertge = stdpersentage; userentrystdmark = userentrystdmark + Convert.ToDouble(stdcomark); userentryperstdcnt++; } } else { if (Convert.ToDouble(stdpersentage) == txtperta) { string stdpertge = stdpersentage; userentrystdmark = userentrystdmark + Convert.ToDouble(stdcomark); userentryperstdcnt++; } } //End } } } //medium if (Convert.ToInt32(mediamstadmark) != 0) { double totalmedian = Convert.ToDouble(mediamstdcnt) * Convert.ToDouble(toalcousermark); pert = Convert.ToDouble(mediamstadmark) / Convert.ToDouble(totalmedian); double pertge = pert * 100; // double pertge = pert; string perts = Convert.ToString(Math.Round(Convert.ToDouble(pertge), 2)); dtab.Rows[dtab.Rows.Count - 3][col] = perts; } else { dtab.Rows[dtab.Rows.Count - 3][col] = "0"; } //User entry if (Convert.ToInt32(userentrystdmark) != 0) { double totalusermark = Convert.ToDouble(userentryperstdcnt) * Convert.ToDouble(toalcousermark); pert = Convert.ToDouble(userentrystdmark) / Convert.ToDouble(totalusermark); double pertge = pert * 100; string perts = Convert.ToString(Math.Round(Convert.ToDouble(pertge), 2)); dtab.Rows[dtab.Rows.Count - 2][col] = perts; } else { dtab.Rows[dtab.Rows.Count - 2][col] = "0"; } } } if (dtab.Columns.Count > 0) { Showgrid.DataSource = dtab; Showgrid.DataBind(); Showgrid.Visible = true; divMainContents.Visible = true; printtable.Visible = true; } } else { Showgrid.Visible = false; divMainContents.Visible = false; printtable.Visible = false; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), UniqueID, "alert('No Record Found!')", true); } } else { ScriptManager.RegisterClientScriptBlock(this, typeof(Page), UniqueID, "alert('Please Select All The Feild')", true); return; } } catch { } }
protected void btn_go_Click(object sender, EventArgs e) { try { string college_cd = string.Empty; string Batch_Year = string.Empty; string degree_code = string.Empty; string semester = string.Empty; string section = string.Empty; DataSet newds = new DataSet(); divMainContents.Visible = false; lbl_reportname.Visible = false; txt_excelname.Visible = false; btn_Excel.Visible = false; btn_printmaster.Visible = false; btnPrint.Visible = false; div_report.Visible = false; newds.Clear(); if (ddl_Feedbackname.SelectedItem.Text.Trim() != "Select" && ddl_Feedbackname.SelectedItem.Text != "") { college_cd = rs.GetSelectedItemsValueAsString(Cbl_college); Batch_Year = rs.GetSelectedItemsValueAsString(cbl_batch); degree_code = rs.GetSelectedItemsValueAsString(cbl_branch); semester = rs.GetSelectedItemsValueAsString(cbl_sem); section = rs.GetSelectedItemsValueAsString(cbl_sec); ArrayList arrColHdrNames1 = new ArrayList(); arrColHdrNames1.Add("S.No"); data.Columns.Add("col0"); arrColHdrNames1.Add("Branch Name"); data.Columns.Add("col1"); arrColHdrNames1.Add("Register No"); data.Columns.Add("col2"); arrColHdrNames1.Add("Roll No"); data.Columns.Add("col3"); arrColHdrNames1.Add("Admission No"); data.Columns.Add("col4"); int col = 4; string query = string.Empty; query = "select qm.HeaderCode, (select TextVal from TextValTable where TextCode= HeaderCode) as HeaderName,qm.Question,qm.QuestionMasterPK,FeedBackMasterPK from CO_FeedBackMaster m,CO_FeedBackQuestions q ,CO_QuestionMaster qm where m.FeedBackMasterPK =q.FeedBackMasterFK and qm.QuestionMasterPK=q.QuestionMasterFK and FeedBackType ='2' and q.objdes='2' and FeedBackMasterPK in (select top 1 FeedBackMasterPK from CO_FeedBackMaster where FeedBackType ='2'and FeedBackMasterPK='" + ddl_Feedbackname.SelectedItem.Value + "' order by StartDate desc) "; ds = d2.select_method_wo_parameter(query, "text"); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { col++; string quest = Convert.ToString(ds.Tables[0].Rows[i]["Question"]); string questionpk = Convert.ToString(ds.Tables[0].Rows[i]["QuestionMasterPK"]); arrColHdrNames1.Add(quest); data.Columns.Add("col" + col); col++; arrColHdrNames1.Add(questionpk); data.Columns.Add("col" + col); } DataRow drHdr1 = data.NewRow(); for (int grCol = 0; grCol < data.Columns.Count; grCol++) { drHdr1["col" + grCol] = arrColHdrNames1[grCol]; } data.Rows.Add(drHdr1); string selqry = ""; selqry = " SELECT Course_Name+'-'+Dept_Name Degree, f.app_no,Roll_No,Roll_Admit,Reg_No FROM CO_StudFeedBack F,CO_FeedBackMaster M,Registration R,Degree G,Course C,Department D WHERE F.App_No = R.App_No AND R.degree_code = G.Degree_Code AND G.Course_Id = C.Course_Id AND G.college_code = C.college_code AND g.Dept_Code = d.Dept_Code and g.college_code = d.college_code and f.FeedBackMasterFK = m.FeedBackMasterPK and m.FeedBackName='" + ddl_Feedbackname.SelectedItem.Text + "' and m.FeedBackType = '2' AND CC = 0 AND DelFlag = 0 AND Exam_Flag = 'OK' and R.degree_code in ('" + degree_code + "') and R.college_code in ('" + college_cd + "') and R.Batch_Year in ('" + Batch_Year + "') and R.Current_Semester in ('" + semester + "')"; // selqry = selqry + " SELECT Course_Name+'-'+Dept_Name Degree,f.app_no,Roll_No,Roll_Admit,Reg_No FROM Registration R,Degree G,Course C,Department D WHERE R.degree_code = G.Degree_Code AND G.Course_Id = C.Course_Id AND G.college_code = C.college_code AND g.Dept_Code = d.Dept_Code and g.college_code = d.college_code AND CC = 0 AND DelFlag = 0 AND Exam_Flag = 'OK' and R.college_code in ('" + college_cd + "') and R.degree_code in ('" + degree_code + "') and R.Batch_Year in ('" + Batch_Year + "') and R.Current_Semester in ('" + semester + "')"; if (section != "") { selqry = selqry + " and R.Sections in ('" + section + "') GROUP BY Course_Name,Dept_Name,Current_semester,Sections,R.Batch_Year,R.degree_code, R.college_code, f.app_no,Roll_No,Roll_Admit,Reg_No ORDER BY R.degree_code "; //Batch_Year,Course_Name,Dept_Name,Current_Semester,Sections"; } else { selqry = selqry + " GROUP BY Course_Name,Dept_Name,Current_semester,Sections,R.Batch_Year,R.degree_code,R.college_code, f.app_no,Roll_No,Roll_Admit,Reg_No ORDER BY Batch_Year,Course_Name,Dept_Name,Current_Semester,Sections"; } newds = d2.select_method_wo_parameter(selqry, "Text"); if (newds.Tables[0].Rows.Count > 0) { int sno = 0; for (int val = 0; val < newds.Tables[0].Rows.Count; val++) { drow = data.NewRow(); data.Rows.Add(drow); sno++; data.Rows[data.Rows.Count - 1][0] = Convert.ToString(sno); data.Rows[data.Rows.Count - 1][1] = newds.Tables[0].Rows[val]["Degree"].ToString(); data.Rows[data.Rows.Count - 1][2] = newds.Tables[0].Rows[val]["Reg_No"].ToString(); data.Rows[data.Rows.Count - 1][3] = newds.Tables[0].Rows[val]["Roll_No"].ToString(); data.Rows[data.Rows.Count - 1][4] = newds.Tables[0].Rows[val]["Roll_Admit"].ToString(); string appno = Convert.ToString(newds.Tables[0].Rows[val]["app_no"]); for (int j = 5; j < data.Columns.Count; j++) { string question = Convert.ToString(data.Rows[0][j]); string questionpk = Convert.ToString(data.Rows[0][j + 1]); string answer = d2.GetFunction("select answerdesc from CO_StudFeedBack where app_no='" + appno + "' and QuestionMasterFK='" + questionpk + "' and FeedBackMasterFk='" + ddl_Feedbackname.SelectedItem.Value + "'"); data.Rows[data.Rows.Count - 1][j] = Convert.ToString(answer); j++; } } if (data.Columns.Count > 0 && data.Rows.Count > 0) { Showgrid.DataSource = data; Showgrid.DataBind(); Showgrid.Visible = true; Showgrid.Width = 500; if (Showgrid.Rows.Count > 0) { Showgrid.Rows[0].BackColor = ColorTranslator.FromHtml("#0CA6CA"); Showgrid.Rows[0].HorizontalAlign = HorizontalAlign.Center; Showgrid.Rows[0].Font.Bold = true; } } divMainContents.Visible = true; lbl_reportname.Visible = true; txt_excelname.Visible = true; btn_Excel.Visible = true; btn_printmaster.Visible = true; btnPrint.Visible = true; div_report.Visible = true; } else { divMainContents.Visible = false; lbl_reportname.Visible = false; txt_excelname.Visible = false; btn_Excel.Visible = false; btn_printmaster.Visible = false; btnPrint.Visible = false; div_report.Visible = false; ScriptManager.RegisterStartupScript(base.Page, this.GetType(), ("dialogJavascript" + this.ID), "alert(\"No Records Found\");", true); Showgrid.Visible = false; } } else { divMainContents.Visible = false; lbl_reportname.Visible = false; txt_excelname.Visible = false; btn_Excel.Visible = false; btn_printmaster.Visible = false; btnPrint.Visible = false; div_report.Visible = false; ScriptManager.RegisterStartupScript(base.Page, this.GetType(), ("dialogJavascript" + this.ID), "alert(\"No Records Found\");", true); Showgrid.Visible = false; } } else { divMainContents.Visible = false; lbl_reportname.Visible = false; txt_excelname.Visible = false; btn_Excel.Visible = false; btn_printmaster.Visible = false; btnPrint.Visible = false; div_report.Visible = false; ScriptManager.RegisterStartupScript(base.Page, this.GetType(), ("dialogJavascript" + this.ID), "alert(\"Please Select Feedback\");", true); Showgrid.Visible = false; } } catch (Exception ex) { } }