public void LoadDepartmentSpread() { try { FpDeptment.Visible = false; btnSave.Visible = false; string dayorder = ""; string sel_edu_level = ""; if (ddlBatch.Items.Count > 0) { batchyear = Convert.ToString(ddlBatch.SelectedItem.Text); } if (rblCourse.Items.Count == 0) { lbl_popuperr.Text = "No Records Found"; imgdiv2.Visible = true; return; } else if (ddlDays.Items.Count == 0) { lbl_popuperr.Text = "No Days are Found"; imgdiv2.Visible = true; return; } else { if (ddlDays.SelectedValue.ToString() == "0" || ddlDays.SelectedValue.ToString() == "-1") { lbl_popuperr.Text = "Please Select Other Than Sunday and Empty"; imgdiv2.Visible = true; return; } dayorder = Convert.ToString(ddlDays.SelectedValue); sel_edu_level = Convert.ToString(rblCourse.SelectedItem.Text); //and r.degree_code=45 //select distinct (c.Course_Name+'-'+ dpt.dept_acronym) as dept,dg.Degree_Code,c.Course_Name,dpt.Dept_Name,dg.NoofSections,Duration,r.Current_Semester,r.Sections from Degree dg,course c,Department dpt,Registration r where r.college_code=dg.college_code and r.degree_code=dg.Degree_Code and c.college_code=dpt.college_code and dpt.college_code=dg.college_code and dg.Dept_Code=dpt.Dept_Code and r.delflag=0 and r.cc=0 and r.exam_flag<>'debar' and dg.Course_Id=c.Course_Id and c.Edu_Level='" + sel_edu_level + "' and dg.college_code='" + Convert.ToString(Session["collegecode"]) + "' and Batch_Year="'+batchyear+'" order by r.batch_year desc,current_semester asc, dg.degree_code,r.Sections asc; //qry = "select distinct Degree_Code,c.Course_Name,dpt.Dept_Name,dg.NoofSections,Duration from Degree dg,course c,Department dpt where c.college_code=dpt.college_code and dpt.college_code=dg.college_code and dg.Dept_Code=dpt.Dept_Code and dg.Course_Id=c.Course_Id and c.Edu_Level='" + sel_edu_level + "' and dg.college_code='" + Convert.ToString(Session["collegecode"]) + "' order by Course_Name; select * from PeriodAttndScheduleNew where DayOrder='" + dayorder + "'"; qry = "select distinct (c.Course_Name+'-'+ dpt.dept_acronym) as dept,r.batch_year,dg.Degree_Code,c.Course_Name,dpt.Dept_Name,dg.NoofSections,Duration,r.Current_Semester,r.Sections from Degree dg,course c,Department dpt,Registration r where r.college_code=dg.college_code and r.degree_code=dg.Degree_Code and c.college_code=dpt.college_code and dpt.college_code=dg.college_code and dg.Dept_Code=dpt.Dept_Code and r.delflag=0 and r.cc=0 and r.exam_flag<>'debar' and dg.Course_Id=c.Course_Id and c.Edu_Level='" + sel_edu_level + "' and dg.college_code='" + Convert.ToString(Session["collegecode"]) + "' and Batch_Year='" + batchyear + "' order by r.batch_year desc,r.current_semester asc, dg.degree_code,r.Sections asc; select * from PeriodAttndScheduleNew where DayOrder='" + dayorder + "' and batch_year='" + batchyear + "'"; ds = d2.select_method_wo_parameter(qry, sptype); if (ds.Tables[0].Rows.Count > 0) { FarPoint.Web.Spread.StyleInfo style2 = new FarPoint.Web.Spread.StyleInfo(); style2.Font.Size = FontUnit.Medium; style2.Font.Name = "Book Antiqua"; style2.Font.Bold = false; style2.HorizontalAlign = HorizontalAlign.Center; style2.VerticalAlign = VerticalAlign.Middle; style2.ForeColor = System.Drawing.Color.Black; FarPoint.Web.Spread.DoubleCellType dblcell = new FarPoint.Web.Spread.DoubleCellType(); FarPoint.Web.Spread.CheckBoxCellType chkall = new FarPoint.Web.Spread.CheckBoxCellType(); FarPoint.Web.Spread.CheckBoxCellType chkeach = new FarPoint.Web.Spread.CheckBoxCellType(); FarPoint.Web.Spread.IntegerCellType intgrcell = new FarPoint.Web.Spread.IntegerCellType(); intgrcell.ErrorMessage = "Enter Positive Integer Values Only"; intgrcell.MinimumValue = 0; chkall.AutoPostBack = true; FpDeptment.Sheets[0].RowCount = 0; FpDeptment.Sheets[0].AutoPostBack = false; FpDeptment.Sheets[0].RowCount++; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 1].CellType = chkall; FpDeptment.Sheets[0].SpanModel.Add(FpDeptment.Sheets[0].RowCount - 1, 2, 1, 12); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 7].Locked = true; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 8].Locked = true; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 9].Locked = true; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 10].Locked = true; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 11].Locked = true; FpDeptment.Sheets[0].FrozenRowCount = 1; FpDeptment.Sheets[0].FrozenColumnCount = 7; for (int row = 0; row < ds.Tables[0].Rows.Count; row++) { FpDeptment.Sheets[0].RowCount++; //int noofsec = 0; //int.TryParse(Convert.ToString(ds.Tables[0].Rows[row]["NoofSections"]), out noofsec); string degree_code = Convert.ToString(ds.Tables[0].Rows[row]["Degree_Code"]); string sem = Convert.ToString(ds.Tables[0].Rows[row]["Current_Semester"]); string sec = Convert.ToString(ds.Tables[0].Rows[row]["Sections"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 0].Text = Convert.ToString(row + 1); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 1].CellType = chkeach; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 2].Text = batchyear; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 3].Text = Convert.ToString(ds.Tables[0].Rows[row]["Course_Name"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 3].Tag = Convert.ToString(degree_code); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Left; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 4].Text = Convert.ToString(ds.Tables[0].Rows[row]["Dept_Name"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Left; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 5].Text = Convert.ToString(ds.Tables[0].Rows[row]["Current_Semester"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 5].HorizontalAlign = HorizontalAlign.Center; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 6].Text = Convert.ToString(ds.Tables[0].Rows[row]["Sections"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 6].HorizontalAlign = HorizontalAlign.Center; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 7].CellType = intgrcell; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 8].CellType = intgrcell; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 9].CellType = intgrcell; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 10].CellType = intgrcell; FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 11].CellType = intgrcell; if (ds.Tables.Count == 2) { if (ds.Tables[1].Rows.Count > 0) { ds.Tables[1].DefaultView.RowFilter = "Degree_Code='" + degree_code + "' and semester='" + sem + "' and section='" + sec + "'"; DataView dv = new DataView(); dv = ds.Tables[1].DefaultView; if (dv.Count > 0) { FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 7].Text = Convert.ToString(dv[0]["No_of_hrs_per_day"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 8].Text = Convert.ToString(dv[0]["no_of_hrs_I_half_day"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 9].Text = Convert.ToString(dv[0]["no_of_hrs_II_half_day"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 10].Text = Convert.ToString(dv[0]["min_pres_I_half_day"]); FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 11].Text = Convert.ToString(dv[0]["min_pres_II_half_day"]); } } } //if (noofsec == 0) //{ // FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 4].Text = ""; //} //else if (noofsec == 1) //{ // FpDeptment.Sheets[0].Cells[FpDeptment.Sheets[0].RowCount - 1, 4].Text = "A"; //} //else if (noofsec > 1) //{ //} } FpDeptment.Visible = true; btnSave.Visible = true; } else { FpDeptment.Visible = false; btnSave.Visible = false; lbl_popuperr.Text = "No Departments were Found for " + sel_edu_level; imgdiv2.Visible = true; return; } } FpDeptment.Sheets[0].PageSize = FpDeptment.Sheets[0].RowCount; FpDeptment.Height = (FpDeptment.Sheets[0].RowCount * 28) + 120; FpDeptment.SaveChanges(); } catch (Exception ex) { } }
protected void btnGo_Click(object sender, EventArgs e) { try { GridHeader(); FpStudent.SaveChanges(); string degree = string.Empty; string branch = string.Empty; DataView dv = new DataView(); if (ddlDegree.SelectedItem.Text != "All") { degree = ddlDegree.SelectedValue; } if (ddlBranch.SelectedItem.Text != "All") { branch = ddlBranch.SelectedValue; } FarPoint.Web.Spread.IntegerCellType intgrcel = new FarPoint.Web.Spread.IntegerCellType(); string SqlQry = "select Course_Name,dt.dept_Name,d.degree_code from Degree d,Department dt,Course C where d.dept_code=dt.dept_code and c.course_id=d.course_id and d.college_code ='" + ddlCollege.SelectedValue + "'"; if (degree.Trim() != "") { SqlQry += "and c.course_id ='" + degree + "'"; } if (branch.Trim() != "") { SqlQry += "and d.degree_code ='" + branch + "'"; } SqlQry += " order by d.degree_code"; SqlQry += " select degree_code,totalcredits,minimcredits,IsCommon,batchYear from coe_ovrl_credits_Dts where"; if (cbBatchWise.Checked == true) { SqlQry += " IsCommon='1' and batchYear='" + ddlBatch.SelectedItem.Text + "'"; } else { SqlQry += " IsCommon='0'"; } ds.Clear(); ds = d2.select_method_wo_parameter(SqlQry, "Text"); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { FpStudent.Sheets[0].RowCount = 0; for (int stu = 0; stu < ds.Tables[0].Rows.Count; stu++) { FpStudent.Sheets[0].RowCount++; FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 0].Text = Convert.ToString(stu + 1); FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 1].Text = Convert.ToString(ds.Tables[0].Rows[stu]["Course_Name"]); FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 0].Tag = Convert.ToString(ds.Tables[0].Rows[stu]["degree_code"]); FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 2].Text = Convert.ToString(ds.Tables[0].Rows[stu]["dept_Name"]); FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 2].HorizontalAlign = HorizontalAlign.Left; if (ds.Tables[1].Rows.Count > 0) { if (cbBatchWise.Checked == false) { ds.Tables[1].DefaultView.RowFilter = " degree_code ='" + Convert.ToString(ds.Tables[0].Rows[stu]["degree_code"]) + "'"; dv = ds.Tables[1].DefaultView; } else { ds.Tables[1].DefaultView.RowFilter = " degree_code ='" + Convert.ToString(ds.Tables[0].Rows[stu]["degree_code"]) + "' and batchYear='" + ddlBatch.SelectedItem.Text + "'"; dv = ds.Tables[1].DefaultView; } if (dv.Count > 0) { FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 3].CellType = intgrcel; FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 3].Text = Convert.ToString(dv[0]["totalcredits"]); FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 3].HorizontalAlign = HorizontalAlign.Center; FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 4].CellType = intgrcel; FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 4].Text = Convert.ToString(dv[0]["minimcredits"]); FpStudent.Sheets[0].Cells[FpStudent.Sheets[0].RowCount - 1, 4].HorizontalAlign = HorizontalAlign.Center; } } } FpStudent.Visible = true; btnSave.Visible = true; FpStudent.Sheets[0].PageSize = FpStudent.Sheets[0].RowCount; FpStudent.Height = (FpStudent.Sheets[0].RowCount * 23) + 50; FpStudent.SaveChanges(); } else { FpStudent.Visible = false; btnSave.Visible = false; lbl_popuperr.Text = "No Records Found "; errdiv.Visible = true; return; } } catch { } }