protected void Search_Batch_Test_Btn_Click(object sender, EventArgs e) { string keyword = Search_Batch_Test_Console.Text; DataTable temp_table = new DataTable(); temp_table.Columns.Add(new DataColumn("Batch_Test_ID", typeof(string))); temp_table.Columns.Add(new DataColumn("Batch_ID", typeof(string))); temp_table.Columns.Add(new DataColumn("Test_ID", typeof(string))); temp_table.Columns.Add(new DataColumn("TimeStamp", typeof(string))); for (int i = 0; i < find.Test_NAME(keyword).Rows.Count; i++) { for (int j = 0; j < find.Batch_Test_TestID(find.Test_NAME(keyword).Rows[i]["Test_ID"].ToString()).Rows.Count; j++) { temp_table.ImportRow(find.Batch_Test_TestID(find.Test_NAME(keyword).Rows[i]["Test_ID"].ToString()).Rows[j]); } } for (int i = 0; i < find.Batch_Name(keyword).Rows.Count; i++) { for (int j = 0; j < find.Batch_Test_BATCHID(find.Batch_Name(keyword).Rows[i]["Batch_ID"].ToString()).Rows.Count; j++) { temp_table.ImportRow(find.Batch_Test_BATCHID(find.Batch_Name(keyword).Rows[i]["Batch_ID"].ToString()).Rows[j]); } } All_Test.DataSource = temp_table; All_Test.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string batch_id = find.Students(Student_ID()).Rows.Count != 0 ? find.Students(Student_ID()).Rows[0]["Batch_ID"].ToString() : "0"; All_Test.DataSource = find.Batch_Test_BATCHID(batch_id); All_Test.DataBind(); }
protected void All_Batch_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string Title = DataBinder.Eval(e.Row.DataItem, "Title").ToString(); string Time_Stamp = DataBinder.Eval(e.Row.DataItem, "Created_On").ToString(); string batch_id = DataBinder.Eval(e.Row.DataItem, "Batch_ID").ToString(); Label test_name = (Label)e.Row.FindControl("Batch_Title"); Label Crtd_on = (Label)e.Row.FindControl("Created_on"); Label students = (Label)e.Row.FindControl("Students"); Label tests = (Label)e.Row.FindControl("Tests"); test_name.Text = Title; Crtd_on.Text = Time_Stamp; students.Text = find.Students_Batch(batch_id).Rows.Count.ToString(); tests.Text = find.Batch_Test_BATCHID(batch_id).Rows.Count.ToString(); } }
private string Batches(string batch_name) { string data = ""; DataTable dt = new DataTable(); if (batch_name == "ALL") { dt = search.Batches(); } else { dt = find.Batch_Name(batch_name); } for (int i = 0; i < dt.Rows.Count; i++) { data = data + dt.Rows[i]["Title"].ToString() + "," + find.Students_Batch(dt.Rows[i]["Batch_ID"].ToString()).Rows.Count.ToString() + "," + "Students" + "," + "Created On" + "," + dt.Rows[i]["Created_On"].ToString().Substring(0, 10) + "," + "Total Assignment" + "," + find.Batch_Test_BATCHID(dt.Rows[i]["Batch_ID"].ToString()).Rows.Count.ToString() + "," + ";"; } return(data); }
void assignments_to_print(string keywords) { DataTable temp_table = new DataTable(); temp_table.Columns.Add(new DataColumn("Batch_Test_ID", typeof(string))); temp_table.Columns.Add(new DataColumn("Batch_ID", typeof(string))); temp_table.Columns.Add(new DataColumn("Test_ID", typeof(string))); temp_table.Columns.Add(new DataColumn("TimeStamp", typeof(string))); int d_month = 0, d_day = 0, d_year = 0; string output = ""; int s = 0; string batch_id = find.Students(Student_ID()).Rows.Count != 0 ? find.Students(Student_ID()).Rows[0]["Batch_ID"].ToString() : "0"; for (int i = find.Batch_Test_BATCHID(batch_id).Rows.Count - 1; i >= 0; i--) { if (i == find.Batch_Test_BATCHID(batch_id).Rows.Count - 1) { output = output + "<h3 style='color:white; text-shadow:1px 1px 1px gray;'>Assignments</h3>"; } string dt = find.Batch_Test_BATCHID(batch_id).Rows[i]["TimeStamp"].ToString(); int m = Convert.ToDateTime(dt).Month; int d = Convert.ToDateTime(dt).Day; int y = Convert.ToDateTime(dt).Year; if (m != d_month || y != d_year || d != d_day) { if (s == 1) { output = output + "</div><br/><br/>";//0 s = 0; } output = output + "<div class='dates'>" + d + "-" + m + "-" + y + "</div>"; d_month = m; d_year = y; d_day = d; output = output + "<div class='sugar'>";//0 s = 1; } string test_id = find.Batch_Test_BATCHID(batch_id).Rows[i]["Test_ID"].ToString(); int total_ques = find.Test_Maker(test_id).Rows.Count; string batch_test_id = find.Batch_Test_BATCHID(batch_id).Rows[i]["Batch_Test_ID"].ToString(); string STUDENT_ID = Student_ID(); string giving_id = find.Giving(STUDENT_ID, batch_test_id).Rows.Count != 0 ? find.Giving(STUDENT_ID, batch_test_id).Rows[0]["Giving_ID"].ToString() : "0"; int complete = 0; if (giving_id != "0") { complete = find.Giving_Ans(giving_id).Rows.Count; } float prcnt = (float)((float)complete / (float)total_ques) * 100; string batch_test_Id_val = secure.Encrypt(find.Batch_Test_BATCHID(batch_id).Rows[i]["Batch_Test_ID"].ToString(), "MONE-YMAT-TERSLT"); if (keywords == "") { output = output + "<div class='asgnmnt' onclick=topush('" + batch_test_Id_val + "')>"; //1 output = output + "<div class='hdr'>"; //2 output = output + "Assignmnet " + (i + 1); output = output + "</div>"; //2 output = output + "<div class='cntnt'>"; //3 output = output + (find.Test(find.Batch_Test_BATCHID(batch_id).Rows[i]["Test_ID"].ToString()).Rows.Count != 0 ? find.Test(find.Batch_Test_BATCHID(batch_id).Rows[i]["Test_ID"].ToString()).Rows[0]["Name"].ToString() : "Unknown Name"); output = output + "</div>"; //3 output = output + "<div class='percent'>"; //4 output = output + "<table style='width: 100%;'>"; //4.1 output = output + "<tr style='width: 100%;'>"; //4.2 output = output + "<td style='width:" + prcnt + "%; border-radius:5px; background-image:url(" + "Images/Icons/progress.png" + "); background-position:center; background-size:25px;'>"; //4.3 output = output + "</td>"; //4.3 output = output + "<td style='width:" + (100 - prcnt) + "%; background-color:white; border-radius:5px; font-size:6pt;'>"; //4.4 output = output + prcnt + "% Completed"; output = output + "</td>"; //4.4 output = output + "</tr>"; //4.2 output = output + "</table>"; //4.1 output = output + "</div>"; //4 output = output + "</div>"; //1 } else { if (find.Test(find.Batch_Test_BATCHID(batch_id).Rows[i]["Test_ID"].ToString(), keywords).Rows.Count != 0) { output = output + "<div class='asgnmnt' onclick=" + "topush('" + batch_test_Id_val + "')'>"; //1 output = output + "<div class='hdr'>"; //2 output = output + "Assignmnet " + (i + 1); output = output + "</div>"; //2 output = output + "<div class='cntnt'>"; //3 output = output + (find.Test(find.Batch_Test_BATCHID(batch_id).Rows[i]["Test_ID"].ToString(), keywords).Rows.Count != 0 ? find.Test(find.Batch_Test_BATCHID(batch_id).Rows[i]["Test_ID"].ToString(), keywords).Rows[0]["Name"].ToString() : "Unknown Name"); output = output + "</div>"; //3 output = output + "<div class='percent'>"; //4 output = output + "<table style='width: 100%;'>"; //4.1 output = output + "<tr style='width: 100%;'>"; //4.2 output = output + "<td style='width:" + prcnt + "%; border-radius:5px; background-image:url(" + "Images/Icons/progress.png" + "); background-position:center; background-size:25px;'>"; //4.3 output = output + "</td>"; //4.3 output = output + "<td style='width:" + (100 - prcnt) + "%; background-color:white; border-radius:5px; font-size:6pt;'>"; //4.4 output = output + prcnt + "% Completed"; output = output + "</td>"; //4.4 output = output + "</tr>"; //4.2 output = output + "</table>"; //4.1 output = output + "</div>"; //4 output = output + "</div>"; //1 } } } if (s == 1) { output = output + "</div>";//0 } if (output == "") { output = "<h4 style='color:white; text-shadow:1px 1px gray; text-transform:capitalize;font-family:'Century Gothic';' >You don't have any assignment, please contact with your institute and subscribe with us.</h4>"; } assignments.InnerHtml = output; }