private void BindGrid() { try { EWA_Common objEWA = new EWA_Common(); BL_Common objBL = new BL_Common(); objEWA.OrgId = Session["OrgId"].ToString(); objEWA.BranchId = Session["BranchId"].ToString(); objEWA.CourseId = Session["CourseId"].ToString(); objEWA.ClassId = Session["ClassId"].ToString(); objEWA.SemesterId = Session["SemesterId"].ToString(); DataSet ds = objBL.BindResultFormat_BL(objEWA); ExcelExport(ds); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void btnGo_Click(object sender, EventArgs e) { try { EWA_Common objEWA = new EWA_Common(); BL_Common objBL = new BL_Common(); objEWA.OrgId = Session["OrgId"].ToString(); objEWA.BranchId = ddlBranch.SelectedValue.ToString(); objEWA.CourseId = ddlCourse.SelectedValue.ToString(); objEWA.ClassId = ddlClass.SelectedValue.ToString(); objEWA.SemesterId = ddlSemester.SelectedValue.ToString(); DataSet ds = objBL.BindResultFormat_BL(objEWA); if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { DataTable dt = new DataTable(); dt.Columns.Add("UserCode"); dt.Columns.Add("Student Name"); int i = 0; while (ds.Tables[0].Rows.Count > i) { dt.Columns.Add(ds.Tables[0].Rows[i][1].ToString()); i++; } i = 0; while (ds.Tables[1].Rows.Count > i) { DataRow dr = dt.NewRow(); dr[0] = ds.Tables[1].Rows[i][0].ToString(); dr[1] = ds.Tables[1].Rows[i][1].ToString(); i++; dt.Rows.Add(dr); } grdResultFormat.DataSource = dt; grdResultFormat.DataBind(); grdResultFormat.CellPadding = 10; if (dt.Rows.Count < 0) { grdResultFormat.Rows[0].Cells[0].Text = "Record not found !!!"; } //export(); } else { GeneralErr("Not Found Recoder...!"); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } if (grdResultFormat.Rows.Count > 0) { Session["CourseId"] = ddlCourse.SelectedValue.ToString(); Session["BranchId"] = ddlBranch.SelectedValue.ToString(); Session["ClassId"] = ddlClass.SelectedValue.ToString(); Session["SemesterId"] = ddlSemester.SelectedValue.ToString(); //Response.Redirect("~/ResultFormat.aspx"); BindGrid(); } }
public void BindUploadResult() { try { database db = new database(); EWA_UploadResult objEWA1 = new EWA_UploadResult(); EWA_Common objEWA = new EWA_Common(); BL_Common objBL = new BL_Common(); objEWA.OrgId = Session["OrgId"].ToString(); objEWA.BranchId = ddlBranch.SelectedValue.ToString(); objEWA.CourseId = ddlCourse.SelectedValue.ToString(); objEWA.ClassId = ddlClass.SelectedValue.ToString(); //objEWA.SemesterId = ddlSemester.SelectedValue.ToString(); DataSet ds = objBL.BindResultFormat_BL(objEWA); int row = 0, rs = 0; if (grdResultFormat.Rows.Count > row && ds.Tables[0].Rows.Count > 0) { EWA_UploadResult objEWA2 = new EWA_UploadResult(); objEWA2.Action = "InsertUploadTest"; objEWA2.TestName = txtTestName.Text; objEWA2.TotalMark = txtTotalMarks.Text; objEWA2.OrgId = Session["OrgId"].ToString(); objEWA2.BranchId = ddlBranch.SelectedValue.ToString(); objEWA2.CourseId = ddlCourse.SelectedValue.ToString(); objEWA2.ClassId = ddlClass.SelectedValue.ToString(); objEWA2.SemesterId = null; objEWA2.Status = "1"; rs = InsertUploadTest(objEWA2); } else { GeneralErr("Record Not Found...!"); } while (grdResultFormat.Rows.Count > row && ds.Tables[1].Rows.Count > row) { int countColumn = grdResultFormat.Rows[0].Cells.Count; EWA_UploadResult objEWA3 = new EWA_UploadResult(); objEWA3.Action = "InsertUploadResult"; objEWA3.TestId = db.getDbstatus_Value("SELECT MAX(TestId) FROM tblUploadTest"); objEWA3.UserCode = grdResultFormat.Rows[row].Cells[0].Text; // TextBox txtResult = (TextBox)grdResultFormat.Rows[row].Cells[countColumn - 1].FindControl("txt" + (countColumn - 1)); TextBox txtResult = (TextBox)grdResultFormat.Rows[row].FindControl("Textresult"); if (txtResult.Text == "") { objEWA3.Result = "-"; } else { objEWA3.Result = txtResult.Text; } //TextBox txtResult = (TextBox)grdResultFormat.Rows[row].FindControl("txt3"); //if (txtResult.Text == "") // objEWA3.Result = "-"; //else // objEWA3.Result = txtResult.Text; rs = InsertUploadResult(objEWA3); string id = db.getDbstatus_Value("SELECT MAX(ResultId) FROM tblUploadResult"); int i = 0, j = 2; while (ds.Tables[0].Rows.Count > i && (countColumn - 1) > j) { //if (grdResultFormat.Rows[0].Cells[j].Text == ds.Tables[0].Rows[i][1].ToString()) //{ EWA_UploadResult objEWA4 = new EWA_UploadResult(); objEWA4.Action = "InsertUploadMark"; objEWA4.ResultId = id; objEWA4.SubjectId = ds.Tables[0].Rows[i][0].ToString(); TextBox txtmark = (TextBox)grdResultFormat.Rows[row].Cells[j].FindControl("txt" + j); // TextBox txtmark = (TextBox)grdResultFormat.Rows[row].Cells[j].FindControl("txt" + j); if (txtmark.Text == null) { objEWA4.Mark = "0"; } else { objEWA4.Mark = txtmark.Text; } TextBox txtOutofmark = (TextBox)grdResultFormat.Rows[row].Cells[j + 1].FindControl("txt" + j + 1); if (txtOutofmark.Text == null) { objEWA4.Outofmark = "0"; } else { objEWA4.Outofmark = txtOutofmark.Text; } rs = InsertUploadMark(objEWA4); //} i++; j = j + 2; } row++; } if (rs > 0) { //GeneralErr("Successfully Result Upload"); msgBox.ShowMessage("Successfull Result Upload", "Successfull", CMS.UserControls.MessageBox.MessageStyle.Successfull); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void btnGo_Click(object sender, EventArgs e) { try { grdResultFormat.Columns.Clear(); EWA_Common objEWA = new EWA_Common(); BL_Common objBL = new BL_Common(); objEWA.OrgId = Session["OrgId"].ToString(); objEWA.BranchId = ddlBranch.SelectedValue.ToString(); objEWA.CourseId = ddlCourse.SelectedValue.ToString(); objEWA.ClassId = ddlClass.SelectedValue.ToString(); //objEWA.SemesterId = ddlSemester.SelectedValue.ToString(); DataSet ds = objBL.BindResultFormat_BL(objEWA); if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { BoundField bfield = new BoundField(); bfield.HeaderText = "UserCode"; bfield.DataField = "UserCode"; grdResultFormat.Columns.Add(bfield); bfield = new BoundField(); bfield.HeaderText = "Student Name"; bfield.DataField = "StudentName"; grdResultFormat.Columns.Add(bfield); TemplateField tfield = new TemplateField(); int i = 0; while (ds.Tables[0].Rows.Count > i) { tfield = new TemplateField(); tfield.HeaderText = ds.Tables[0].Rows[i][1].ToString(); tfield.ItemTemplate = new TextColumn(); grdResultFormat.Columns.Add(tfield); tfield = new TemplateField(); tfield.HeaderText = ds.Tables[0].Rows[i][1].ToString().Substring(0, 3) + " Total"; tfield.ItemTemplate = new TextColumn(); grdResultFormat.Columns.Add(tfield); i++; } tfield = new TemplateField(); tfield.HeaderText = "Result"; tfield.ItemTemplate = new TextresultColumn(); grdResultFormat.Columns.Add(tfield); grdResultFormat.AutoGenerateColumns = false; //DataTable dt = new DataTable(); //dt.Columns.Add("UserCode"); //dt.Columns.Add("Student Name"); //int i = 0; //while (ds.Tables[0].Rows.Count > i) //{ // dt.Columns.Add(ds.Tables[0].Rows[i][1].ToString() ); // dt.Columns.Add((ds.Tables[0].Rows[i][1].ToString()).Substring(0, 3) + " Total" ); // i++; //} //dt.Columns.Add("Result"); //i = 0; //while (ds.Tables[1].Rows.Count > i) //{ // DataRow dr = dt.NewRow(); // dr[0] = ds.Tables[1].Rows[i][0].ToString(); // dr[1] = ds.Tables[1].Rows[i][1].ToString(); // i++; // dt.Rows.Add(dr); //} grdResultFormat.DataSource = ds.Tables[1]; grdResultFormat.DataBind(); grdResultFormat.CellPadding = 10; if (grdResultFormat.Rows.Count < 0) { grdResultFormat.Rows[0].Cells[0].Text = "Record not found !!!"; } //else //{ // for(i=0; grdResultFormat.Rows.Count>i;i++) // { // int j; // for (j=2;(grdResultFormat.Rows[i].Cells.Count-1)>j;j++) // { // TextBox txt = new TextBox(); // txt.Width = 30; // txt.MaxLength = 3; // txt.ID = "txt" + j; // grdResultFormat.Rows[i].Cells[j].Controls.Add(txt); // } // TextBox txt1 = new TextBox(); // txt1.Width = 60; // txt1.ID = "txt" + j; // grdResultFormat.Rows[i].Cells[j].Controls.Add(txt1); // } //} //export(); Panel1.Visible = true; btnUpload.Visible = true; } else { Panel1.Visible = false; btnUpload.Visible = false; GeneralErr("Not Found Recoder...!"); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
private void BindGrid() { try { EWA_Common objEWA = new EWA_Common(); BL_Common objBL = new BL_Common(); objEWA.OrgId = Session["OrgID"].ToString(); objEWA.BranchId = Session["BranchId"].ToString(); objEWA.CourseId = Session["CourseId"].ToString(); objEWA.ClassId = Session["ClassId"].ToString(); objEWA.SemesterId = Session["SemesterId"].ToString(); DataSet ds = objBL.BindResultFormat_BL(objEWA); //ExcelExport(ds); if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { DataTable dt = new DataTable(); dt.Columns.Add("UserCode", typeof(string)); dt.Columns.Add("Student Name", typeof(string)); int i = 0; while (ds.Tables[0].Rows.Count > i) { dt.Columns.Add(ds.Tables[0].Rows[i][1].ToString(), typeof(string)); dt.Columns.Add((ds.Tables[0].Rows[i][1].ToString()).Substring(0, 3) + "_Tot", typeof(string)); i++; } dt.Columns.Add("Total Marks", typeof(string)); dt.Columns.Add("Result", typeof(string)); i = 0; while (ds.Tables[1].Rows.Count > i) { DataRow dr = dt.NewRow(); dr[0] = ds.Tables[1].Rows[i][0].ToString(); dr[1] = ds.Tables[1].Rows[i][1].ToString(); i++; dt.Rows.Add(dr); } GridView1.DataSource = dt; GridView1.DataBind(); GridView1.CellPadding = 10; if (dt.Rows.Count < 0) { GridView1.Rows[0].Cells[0].Text = "Record not found !!!"; } export(); } else { GeneralErr("Not Found Recoder...!"); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }