protected void btnSave_Click(object sender, EventArgs e) { try { FpStudent.SaveChanges(); if (FpStudent.Sheets[0].RowCount > 0) { string degreeCode = string.Empty; string Minvalue = string.Empty; string Maxvalue = string.Empty; string batch = ddlBatch.SelectedItem.Text; double Min = 0; double Max = 0; bool result = false; for (int stu = 0; stu < FpStudent.Sheets[0].RowCount; stu++) { degreeCode = Convert.ToString(FpStudent.Sheets[0].Cells[stu, 0].Tag); Minvalue = Convert.ToString(FpStudent.Sheets[0].Cells[stu, 4].Text); Maxvalue = Convert.ToString(FpStudent.Sheets[0].Cells[stu, 3].Text); double.TryParse(Maxvalue, out Max); double.TryParse(Minvalue, out Min); string InstQuery = string.Empty; if (Max >= Min) { if (cbBatchWise.Checked == false) { InstQuery = "if exists (select degree_Code from coe_ovrl_credits_Dts where degree_code ='" + degreeCode + "' and isCommon='0') update coe_ovrl_credits_Dts set minimcredits='" + Min + "',totalcredits='" + Max + "' where degree_code ='" + degreeCode + "' and isCommon='0' else insert into coe_ovrl_credits_Dts (degree_code,isCommon,minimcredits,totalcredits) values ('" + degreeCode + "','0','" + Min + "','" + Max + "')"; } else if (cbBatchWise.Checked == true) { InstQuery = "if exists (select degree_Code from coe_ovrl_credits_Dts where degree_code ='" + degreeCode + "' and isCommon='1' and batchYear ='" + batch + "') update coe_ovrl_credits_Dts set minimcredits='" + Min + "',totalcredits='" + Max + "' where degree_code ='" + degreeCode + "' and isCommon='1' and batchYear ='" + batch + "' else insert into coe_ovrl_credits_Dts (degree_code,isCommon,minimcredits,totalcredits,batchYear) values ('" + degreeCode + "','1','" + Min + "','" + Max + "','" + batch + "')"; } int intst = d2.update_method_wo_parameter(InstQuery, "Text"); if (intst == 1) { result = true; } } } if (result == true) { lbl_popuperr.Text = "Saved Successfully "; errdiv.Visible = true; return; } else { lbl_popuperr.Text = "Not Saved Successfully "; errdiv.Visible = true; return; } } } catch { } }
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 { } }