private void BindFeedbackQuestion() { try { ActivityFeedbackRaing obj_Activity_Feedback_Rating = new ActivityFeedbackRaing(); SYS_Role_BLogic obj_SYS_Role_BLogic = new SYS_Role_BLogic(); int BMSID = obj_SYS_Role_BLogic.BAL_Select_BMS(Convert.ToInt16(ddlBoard.SelectedValue), Convert.ToInt16(ddlMedium.SelectedValue), Convert.ToInt16(ddlStandard.SelectedValue)); Teacher_Dashboard obj_Teacher_Dashboard; Teacher_Dashboard_BLogic obj_BAL_Teacher_Dashboard; obj_Teacher_Dashboard = new Teacher_Dashboard(); obj_BAL_Teacher_Dashboard = new Teacher_Dashboard_BLogic(); obj_Teacher_Dashboard.BMSID = Convert.ToInt64(BMSID); obj_Teacher_Dashboard.SubjectID = Convert.ToInt16(ddlsubject.SelectedValue.ToString()); obj_Teacher_Dashboard.ChapterID = Convert.ToInt64(ddlchapter.SelectedValue.ToString()); obj_Teacher_Dashboard.TopicID = Convert.ToInt64(ddltopic.SelectedValue.ToString()); bmssctid = obj_BAL_Teacher_Dashboard.BAL_Select_BMS_SCTID(obj_Teacher_Dashboard); // ds_ActivityFeedback = obj_Activity_Feedback_Rating.GetActivityFeedback(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid)); double[] totalavg; int[] star; int rowcount = ds_ActivityFeedback.Tables[3].Rows.Count + ds_ActivityFeedback.Tables[4].Rows.Count; int row_count = 0; totalavg = new double[rowcount]; //star = new int[Convert.ToInt32(dt1.Rows[0]["QuestionCount"].ToString()) + 2]; star = new int[6]; if (ds_ActivityFeedback.Tables[3].Rows.Count > 0) { QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[0]["QuestionCount"].ToString()); for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[3].Rows.Count; cnt++) { TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[cnt]["Rating"].ToString()); if (TotalRating1 != 0) { totalavg[row_count] = (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[3].Rows[cnt]["Rating"].ToString())); row_count = row_count + 1; } } } if (ds_ActivityFeedback.Tables[4].Rows.Count > 0) { QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[0]["QuestionCount"].ToString()); for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[4].Rows.Count; cnt++) { TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[cnt]["Rating"].ToString()); if (TotalRating1 != 0) { totalavg[row_count] += (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[4].Rows[cnt]["QuestionCount"].ToString())); row_count = row_count + 1; } } } for (int avgcnt = 0; avgcnt < totalavg.Length; avgcnt++) { int roundavg = Convert.ToInt32(Math.Round(totalavg[avgcnt])); if (roundavg == 1) { OneStar += 1.0; star[roundavg] = Convert.ToInt32(Math.Round((OneStar * 100 / row_count))); lbl1star.Text = star[roundavg].ToString() + "%"; } else if (roundavg == 2) { Twostar += 1; star[roundavg] = Convert.ToInt32(Math.Round((Twostar * 100 / row_count))); lbl2star.Text = star[roundavg].ToString() + "%"; } else if (roundavg == 3) { Threestar += 1; star[roundavg] = Convert.ToInt32(Math.Round((Threestar * 100 / row_count))); lbl3star.Text = star[roundavg].ToString() + "%"; } else if (roundavg == 4) { Fourstar += 1; star[roundavg] = Convert.ToInt32(Math.Round((Fourstar * 100 / row_count))); lbl4star.Text = star[roundavg].ToString() + "%"; } else if (roundavg == 5) { Fivestar += 1; star[roundavg] = Convert.ToInt32(Math.Round((Fivestar * 100 / row_count))); lbl5star.Text = star[roundavg].ToString() + "%"; } } pnlreport.Visible = true; } catch (Exception ex) { } }
private void BindFeedbackQuestion() { try { ActivityFeedbackRaing obj_Activity_Feedback_Rating = new ActivityFeedbackRaing(); SYS_Role_BLogic obj_SYS_Role_BLogic = new SYS_Role_BLogic(); int BMSID = obj_SYS_Role_BLogic.BAL_Select_BMS(Convert.ToInt16(ddlBoard.SelectedValue), Convert.ToInt16(ddlMedium.SelectedValue), Convert.ToInt16(ddlStandard.SelectedValue)); Teacher_Dashboard obj_Teacher_Dashboard; Teacher_Dashboard_BLogic obj_BAL_Teacher_Dashboard; obj_Teacher_Dashboard = new Teacher_Dashboard(); obj_BAL_Teacher_Dashboard = new Teacher_Dashboard_BLogic(); obj_Teacher_Dashboard.BMSID = Convert.ToInt64(BMSID); obj_Teacher_Dashboard.SubjectID = Convert.ToInt16(ddlsubject.SelectedValue.ToString()); obj_Teacher_Dashboard.ChapterID = Convert.ToInt64(ddlchapter.SelectedValue.ToString()); obj_Teacher_Dashboard.TopicID = Convert.ToInt64(ddltopic.SelectedValue.ToString()); bmssctid = obj_BAL_Teacher_Dashboard.BAL_Select_BMS_SCTID(obj_Teacher_Dashboard); ViewState["BMSSCTID"] = bmssctid.ToString(); if (ddlDivision.SelectedIndex != 0) { ds_ActivityFeedback = obj_Activity_Feedback_Rating.GetActivityFeedback(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), Convert.ToInt32(ddlDivision.SelectedValue), 2); ds_QuestionAverage = obj_Activity_Feedback_Rating.GetQuestionRatingAverage(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), Convert.ToInt32(ddlDivision.SelectedValue)); } else { ds_ActivityFeedback = obj_Activity_Feedback_Rating.GetActivityFeedback(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), 0, 1); ds_QuestionAverage = obj_Activity_Feedback_Rating.GetQuestionRatingAverage(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid), Convert.ToInt32(ddlDivision.SelectedValue)); } //DataSet teacher = new DataSet(); //teacher = obj_Activity_Feedback_Rating.GetActivityFeedbackTeacher(Convert.ToInt32(ddlSchool.SelectedValue), Convert.ToInt32(bmssctid),Convert.ToInt32(ddlDivision.SelectedValue)); //ds_ActivityFeedback.Merge(teacher); double[] totalavg; int[] star; star = new int[6]; DataTable dt_teacherRating = new DataTable(); dt_teacherRating = ds_QuestionAverage.Tables[0]; DataTable dt_studentRating = new DataTable(); dt_studentRating = ds_QuestionAverage.Tables[1]; //DataRow dr; //for (int i = 0; i < dt_studentRating.Rows.Count; i++) //{ // dr = dt_teacherRating.NewRow(); // dr["ActivityFeedbackID"] = dt_studentRating.Rows[i]["ActivityFeedbackID"].ToString(); // dr["SchoolID"] = dt_studentRating.Rows[i]["SchoolID"].ToString(); // dr["BMSSCTID"] = dt_studentRating.Rows[i]["BMSSCTID"].ToString(); // dr["ID"] = dt_studentRating.Rows[i]["ID"].ToString(); // dr["DivisionID"] = dt_studentRating.Rows[i]["DivisionID"].ToString(); // dr["Rating"] = dt_studentRating.Rows[i]["Rating"].ToString(); // dt_teacherRating.Rows.Add(dr); //} int total = 0; if (ds_ActivityFeedback.Tables[0].Rows.Count > 0) { for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[0].Rows.Count; cnt++) { if (ds_ActivityFeedback.Tables[0].Rows[cnt]["Rating"].ToString() != "0") { //total += ds_ActivityFeedback.Tables[0].Rows.Count; total += 1; } } } if (ds_ActivityFeedback.Tables[1].Rows.Count > 0) { //total += ds_ActivityFeedback.Tables[1].Rows.Count; for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[1].Rows.Count; cnt++) { if (ds_ActivityFeedback.Tables[1].Rows[cnt]["Rating"].ToString() != "0") { //total += ds_ActivityFeedback.Tables[0].Rows.Count; total += 1; } } } for (int q_avg = 0; q_avg < ds_ActivityFeedback.Tables[0].Rows.Count; q_avg++) { if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "1") { OneStar += 1.0; star[1] = Convert.ToInt32(Math.Round((OneStar * 100) / total)); lbl1star.Text = star[1].ToString() + "%"; } if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "2") { Twostar += 1.0; star[2] = Convert.ToInt32(Math.Round((Twostar * 100) / total)); lbl2star.Text = star[2].ToString() + "%"; } if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "3") { Threestar += 1.0; star[3] = Convert.ToInt32(Math.Round((Threestar * 100) / total)); lbl3star.Text = star[3].ToString() + "%"; } if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "4") { Fourstar += 1.0; star[4] = Convert.ToInt32(Math.Round((Fourstar * 100) / total));; lbl4star.Text = star[4].ToString() + "%"; } if (ds_ActivityFeedback.Tables[0].Rows[q_avg]["Rating"].ToString() == "5") { Fivestar += 1.0; star[5] = Convert.ToInt32(Math.Round((Fivestar * 100) / total)); lbl5star.Text = star[5].ToString() + "%"; } } for (int q_avg = 0; q_avg < ds_ActivityFeedback.Tables[1].Rows.Count; q_avg++) { if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "1") { OneStar += 1.0; star[1] = Convert.ToInt32((OneStar * 100) / total); lbl1star.Text = star[1].ToString() + "%"; } if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "2") { Twostar += 1.0; star[2] = Convert.ToInt32(Math.Round(Twostar * 100) / total); lbl2star.Text = star[2].ToString() + "%"; } if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "3") { Threestar += 1.0; star[3] = Convert.ToInt32((Threestar * 100) / total); lbl3star.Text = star[3].ToString() + "%"; } if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "4") { Fourstar += 1.0; star[4] = Convert.ToInt32((Fourstar * 100) / total); lbl4star.Text = star[4].ToString() + "%"; } if (ds_ActivityFeedback.Tables[1].Rows[q_avg]["Rating"].ToString() == "5") { Fivestar += 1.0; star[5] = Convert.ToInt32((Fivestar * 100) / total); lbl5star.Text = star[5].ToString() + "%"; } } #region commnet //for (int i = 0; i < dt_student.Rows.Count; i++) //{ // dt_teacher.ImportRow(dt_student.Rows[i]); //} //for (int q_avg = 0; q_avg < ds_QuestionAverage.Tables[0].Rows.Count; q_avg++) //{ // if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "1") // { // OneStar += 1.0; // star[1] = Convert.ToInt32(Math.Round((OneStar * 100) / ds_QuestionAverage.Tables[0].Rows.Count)); // lbl1star.Text = star[1].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "2") // { // Twostar += 1.0; // star[2] = Convert.ToInt32(Convert.ToDouble(Math.Round((Twostar * 100) / ds_QuestionAverage.Tables[0].Rows.Count))); // lbl2star.Text = star[2].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "3") // { // Threestar += 1.0; // star[3] = Convert.ToInt32(Math.Round((Threestar * 100) / ds_QuestionAverage.Tables[0].Rows.Count)); // lbl3star.Text = star[3].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "4") // { // Fourstar += 1.0; // star[4] = Convert.ToInt32(Math.Round((Fourstar * 100) / ds_QuestionAverage.Tables[0].Rows.Count)); // lbl4star.Text = star[4].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[0].Rows[q_avg]["Rating"].ToString() == "5") // { // Fivestar += 1.0; // star[5] = Convert.ToInt32(Math.Round((Fivestar * 100) / ds_QuestionAverage.Tables[0].Rows.Count)); // lbl5star.Text = star[5].ToString() + "%"; // } //} //for (int q_avg = 0; q_avg < ds_QuestionAverage.Tables[0].Rows.Count; q_avg++) //{ // if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "1") // { // OneStar += 1.0; // star[1] = Convert.ToInt32(Math.Round((OneStar * 100) / ds_QuestionAverage.Tables[1].Rows.Count)); // lbl1star.Text = star[1].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "2") // { // Twostar += 1.0; // star[2] = Convert.ToInt32(Convert.ToDouble(Math.Round((Twostar * 100) / ds_QuestionAverage.Tables[1].Rows.Count))); // lbl2star.Text = star[2].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "3") // { // Threestar += 1.0; // star[3] = Convert.ToInt32(Math.Round((Threestar * 100) / ds_QuestionAverage.Tables[1].Rows.Count)); // lbl3star.Text = star[3].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "4") // { // Fourstar += 1.0; // star[4] = Convert.ToInt32(Math.Round((Fourstar * 100) / ds_QuestionAverage.Tables[1].Rows.Count)); // lbl4star.Text = star[4].ToString() + "%"; // } // if (ds_QuestionAverage.Tables[1].Rows[q_avg]["Rating"].ToString() == "5") // { // Fivestar += 1.0; // star[5] = Convert.ToInt32(Math.Round((Fivestar * 100) / ds_QuestionAverage.Tables[1].Rows.Count)); // lbl5star.Text = star[5].ToString() + "%"; // } //} //int rowcount = ds_ActivityFeedback.Tables[3].Rows.Count + ds_ActivityFeedback.Tables[4].Rows.Count; //int row_count = 0; // totalavg = new double[rowcount]; ////star = new int[Convert.ToInt32(dt1.Rows[0]["QuestionCount"].ToString()) + 2]; //star = new int[6]; #endregion int rowcount = ds_ActivityFeedback.Tables[0].Rows.Count + ds_ActivityFeedback.Tables[1].Rows.Count; int row_count = 0; totalavg = new double[rowcount]; //star = new int[Convert.ToInt32(dt1.Rows[0]["QuestionCount"].ToString()) + 2]; star = new int[6]; if (ds_ActivityFeedback.Tables[0].Rows.Count > 0) { QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[0].Rows[0]["count"].ToString()); for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[0].Rows.Count; cnt++) { TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[0].Rows[cnt]["Rating"].ToString()); if (TotalRating1 != 0) { totalavg[row_count] = (TotalRating1 / Convert.ToDouble(QuestionCount)); row_count = row_count + 1; } } } if (ds_ActivityFeedback.Tables[1].Rows.Count > 0) { //QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[1].Rows[1]["count"].ToString()); QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[1].Rows[0]["count"].ToString()); for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[1].Rows.Count; cnt++) { TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[1].Rows[cnt]["Rating"].ToString()); if (TotalRating1 != 0) { totalavg[row_count] += (TotalRating1 / Convert.ToDouble(QuestionCount)); row_count = row_count + 1; } } } //if (ds_ActivityFeedback.Tables[3].Rows.Count > 0) //{ // QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[0]["QuestionCount"].ToString()); // for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[3].Rows.Count; cnt++) // { // TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[3].Rows[cnt]["Rating"].ToString()); // if (TotalRating1 != 0) // { // totalavg[row_count] = (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[3].Rows[cnt]["QuestionCount"].ToString())); // row_count = row_count + 1; // } // } //} //if (ds_ActivityFeedback.Tables[4].Rows.Count > 0) //{ // QuestionCount = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[0]["QuestionCount"].ToString()); // for (int cnt = 0; cnt < ds_ActivityFeedback.Tables[4].Rows.Count; cnt++) // { // TotalRating1 = Convert.ToInt32(ds_ActivityFeedback.Tables[4].Rows[cnt]["Rating"].ToString()); // if (TotalRating1 != 0) // { // totalavg[row_count] += (TotalRating1 / Convert.ToDouble(ds_ActivityFeedback.Tables[3].Rows[cnt]["QuestionCount"].ToString())); // row_count = row_count + 1; // } // } //} //for (int avgcnt = 0; avgcnt < totalavg.Length; avgcnt++) //{ // int roundavg = Convert.ToInt32(Math.Round(totalavg[avgcnt])); // if (roundavg == 1) // { // OneStar += 1.0; // star[roundavg] = Convert.ToInt32(Math.Round((OneStar * 100 / row_count))); // // lbl1star.Text = star[roundavg].ToString() + "%"; // } // else if (roundavg == 2) // { // Twostar += 1; // star[roundavg] = Convert.ToInt32(Math.Round((Twostar * 100 / row_count))); // // lbl2star.Text = star[roundavg].ToString() + "%"; // } // else if (roundavg == 3) // { // Threestar += 1; // star[roundavg] = Convert.ToInt32(Math.Round((Threestar * 100 / row_count))); // // lbl3star.Text = star[roundavg].ToString() + "%"; // } // else if (roundavg == 4) // { // Fourstar += 1; // star[roundavg] = Convert.ToInt32(Math.Round((Fourstar * 100 / row_count))); // //lbl4star.Text = star[roundavg].ToString() + "%"; // } // else if (roundavg == 5) // { // Fivestar += 1; // star[roundavg] = Convert.ToInt32(Math.Round((Fivestar * 100 / row_count))); // //lbl5star.Text = star[roundavg].ToString() + "%"; // } //} pnlreport.Visible = true; } catch (Exception ex) { } }