using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Data.SqlClient; public partial class Taqim : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CMSConnectionString"].ToString()); // int muslim; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // muslim = Convert.ToInt16(Request.QueryString["id"].ToString()); lblMuslim.Text = "تقييم المهارات التي يتقنها المسلم " + Request.QueryString["Name"].ToString(); Page.Title = "تقييم المهارات التي يتقنها المسلم " + Request.QueryString["Name"].ToString(); loadData(); } } protected void BtnAdd0_Click(object sender, EventArgs e) { int muslim = Convert.ToInt16(Request.QueryString["Code"].ToString()); string tahahaha = Request.QueryString["char"].ToString(); Response.Redirect("Daily.aspx?char=" + tahahaha + "&Code=" + muslim); } private void loadData() { SqlCommand cmd = new SqlCommand("Select * From Taqim where Muslim_Code=" + Convert.ToInt16(Request.QueryString["Code"].ToString()) + "", con); if (con.State == ConnectionState.Closed) con.Open(); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows) { string alFataha, AlNas, AlFalaq, AlEslash, Prayer, Prayer_slam, Prayer_roqa, Prayer_Sogud, Prayer_Ibrahim, Prayer_woduaa, aqeda_1, aqeda_2, aqeda_3, aqeda_4; alFataha = dr[2].ToString(); if (alFataha == "False") CHBalFataha.Checked = false; else CHBalFataha.Checked = true; AlNas = dr[3].ToString(); //Response.Write(AlNas); if (AlNas == "false") CHBAlNas.Checked = false; else CHBAlNas.Checked = true; AlFalaq = dr[4].ToString(); if (AlFalaq == "false") CHBAlFalaq.Checked = false; else CHBAlFalaq.Checked = true; AlEslash = dr[5].ToString(); if (AlEslash == "False") CHBAlEslash.Checked = false; else CHBAlEslash.Checked = true; Prayer = dr[6].ToString(); if (Prayer == "1") CHBPrayer1.Checked = true; if (Prayer == "2") CHBPrayer2.Checked = true; if (Prayer == "3") CHBPrayer3.Checked = true; Prayer_woduaa = dr[11].ToString(); //Response.Write(Prayer_woduaa); if (Prayer_woduaa == "1") CHBPrayer_woduaa1.Checked = true; if (Prayer == "2") CHBPrayer_woduaa2.Checked = true; if (Prayer == "3") CHBPrayer_woduaa3.Checked = true; Prayer_slam = dr[7].ToString(); if (Prayer_slam == "False") CHBPrayer_slam.Checked = false; else CHBPrayer_slam.Checked = true; Prayer_roqa = dr[8].ToString(); if (Prayer_roqa == "False") CHBPrayer_roqa.Checked = false; else CHBPrayer_roqa.Checked = true; Prayer_Sogud = dr[9].ToString(); if (Prayer_Sogud == "False") CHBPrayer_Sogud.Checked = false; else CHBPrayer_Sogud.Checked = true; Prayer_Ibrahim = dr[10].ToString(); if (Prayer_Ibrahim == "False") CHBPrayer_Ibrahim.Checked = false; else CHBPrayer_Ibrahim.Checked = true; aqeda_1 = dr[12].ToString(); if (aqeda_1 == "False") CHBaqeda_1.Checked = false; else CHBaqeda_1.Checked = true; aqeda_2 = dr[13].ToString(); if (aqeda_2 == "False") CHBaqeda_2.Checked = false; else CHBaqeda_2.Checked = true; aqeda_3 = dr[14].ToString(); if (aqeda_3 == "False") CHBaqeda_3.Checked = false; else CHBaqeda_3.Checked = true; aqeda_4 = dr[15].ToString(); if (aqeda_4 == "False") CHBaqeda_4.Checked = false; else CHBaqeda_4.Checked = true; dr.Close(); con.Close(); BtnEdit.Visible = true; } else BtnAdd.Visible = true; dr.Close(); con.Close(); } protected void BtnAdd_Click(object sender, EventArgs e) { string xadmin = Session["admin"].ToString(); if (xadmin == "True") { try { int alFataha, AlNas, AlFalaq, AlEslash, Prayer=0, Prayer_slam, Prayer_roqa, Prayer_Sogud, Prayer_Ibrahim, Prayer_woduaa=0, aqeda_1, aqeda_2, aqeda_3, aqeda_4; if (CHBalFataha.Checked) alFataha = 1; else alFataha = 0; if (CHBAlNas.Checked) AlNas = 1; else AlNas = 0; if (CHBAlFalaq.Checked) AlFalaq = 1; else AlFalaq = 0; if (CHBAlEslash.Checked) AlEslash = 1; else AlEslash = 0; if (CHBPrayer1.Checked) { Prayer = 1; } if (CHBPrayer2.Checked) { Prayer = 2; } if (CHBPrayer3.Checked) {Prayer = 3;} if (CHBPrayer_woduaa1.Checked) { Prayer_woduaa = 1; } if (CHBPrayer_woduaa2.Checked) { Prayer_woduaa = 2; } if (CHBPrayer_woduaa3.Checked) { Prayer_woduaa = 3; } if (CHBPrayer_Sogud.Checked) Prayer_Sogud = 1; else Prayer_Sogud = 0; if (CHBPrayer_slam.Checked) Prayer_slam = 1; else Prayer_slam = 0; if (CHBPrayer_roqa.Checked) Prayer_roqa = 1; else Prayer_roqa = 0; if (CHBPrayer_Ibrahim.Checked) Prayer_Ibrahim = 1; else Prayer_Ibrahim = 0; if (CHBaqeda_1.Checked) aqeda_1 = 1; else aqeda_1 = 0; if (CHBaqeda_2.Checked) aqeda_2 = 1; else aqeda_2 = 0; if (CHBaqeda_3.Checked) aqeda_3 = 1; else aqeda_3 = 0; if (CHBaqeda_4.Checked) aqeda_4 = 1; else aqeda_4 = 0; SqlCommand cmdInsert = new SqlCommand("insert into Taqim (Muslim_Code, alFataha, AlNas, AlFalaq, AlEslash, Prayer, Prayer_slam, Prayer_roqa, Prayer_Sogud, Prayer_Ibrahim, Prayer_woduaa, aqeda_1, aqeda_2, "+ " aqeda_3, aqeda_4, Users) " + "Values(" + Convert.ToInt16(Request.QueryString["Code"].ToString()) + " , " + alFataha + " , " + AlNas + " ," + AlFalaq + "," + AlEslash + "," + Prayer + "," + Prayer_slam + "," + Prayer_roqa + "," + Prayer_Sogud + "," + Prayer_Ibrahim + "," + Prayer_woduaa + "," + aqeda_1 + "," + aqeda_2 + "," + " " + aqeda_3 + " ," + aqeda_4 + "," + Session["User"].ToString() + ")", con); if (con.State == ConnectionState.Closed) con.Open(); //Response.Write(cmdInsert.CommandText.ToString()); cmdInsert.ExecuteNonQuery(); con.Close(); lblerror.Text = "تم إضافة التقييم بنجاح"; BtnAdd0.Visible = true; BtnEdit.Visible = true; BtnAdd.Visible = false; } catch (Exception ex) { Response.Write(ex.ToString()); return; } } else Response.Redirect("Home.aspx"); } protected void BtnEdit_Click(object sender, EventArgs e) { string xadmin = Session["admin"].ToString(); if (xadmin == "True") { try { int alFataha, AlNas, AlFalaq, AlEslash, Prayer = 0, Prayer_slam, Prayer_roqa, Prayer_Sogud, Prayer_Ibrahim, Prayer_woduaa=0, aqeda_1, aqeda_2, aqeda_3, aqeda_4; if (CHBalFataha.Checked) alFataha = 1; else alFataha = 0; if (CHBAlNas.Checked) AlNas = 1; else AlNas = 0; if (CHBAlFalaq.Checked) AlFalaq = 1; else AlFalaq = 0; if (CHBAlEslash.Checked) AlEslash = 1; else AlEslash = 0; if (CHBPrayer1.Checked) Prayer = 1; if (CHBPrayer2.Checked) Prayer = 2; if (CHBPrayer3.Checked) Prayer = 3; if (CHBPrayer_woduaa1.Checked) Prayer_woduaa = 1; if (CHBPrayer_woduaa2.Checked) Prayer_woduaa = 2; if (CHBPrayer_woduaa3.Checked) Prayer_woduaa = 3; if (CHBPrayer_Sogud.Checked) Prayer_Sogud = 1; else Prayer_Sogud = 0; if (CHBPrayer_slam.Checked) Prayer_slam = 1; else Prayer_slam = 0; if (CHBPrayer_roqa.Checked) Prayer_roqa = 1; else Prayer_roqa = 0; if (CHBPrayer_Ibrahim.Checked) Prayer_Ibrahim = 1; else Prayer_Ibrahim = 0; if (CHBaqeda_1.Checked) aqeda_1 = 1; else aqeda_1 = 0; if (CHBaqeda_2.Checked) aqeda_2 = 1; else aqeda_2 = 0; if (CHBaqeda_3.Checked) aqeda_3 = 1; else aqeda_3 = 0; if (CHBaqeda_4.Checked) aqeda_4 = 1; else aqeda_4 = 0; // SqlCommand cmdInsert = new SqlCommand("update Taqim set alFataha =" + alFataha + ", AlNas=" + AlNas + ", AlFalaq=" + AlFalaq + ", "+ "AlEslash=" + AlEslash + ", Prayer=" + Prayer + ", Prayer_slam=" + Prayer_slam + ", Prayer_roqa=" + Prayer_roqa + ","+ " Prayer_Sogud=" + Prayer_Sogud + ", Prayer_Ibrahim=" + Prayer_Ibrahim + ", Prayer_woduaa=" + Prayer_woduaa + ", aqeda_1=" + aqeda_1 + " ,"+ " aqeda_2=" + aqeda_2 + ", " + " aqeda_3=" + aqeda_3 + ", aqeda_4=" + aqeda_4 + ", Users=" + Session["User"].ToString() + " " + " where Muslim_Code =" + Convert.ToInt16(Request.QueryString["Code"].ToString()) + "", con); if (con.State == ConnectionState.Closed) con.Open(); //Response.Write(cmdInsert.CommandText.ToString()); // Response.Write(cmdInsert.CommandText.ToString()); cmdInsert.ExecuteNonQuery(); con.Close(); lblerror.Text = "تم تعديل التقييم بنجاح"; BtnAdd0.Visible = true; BtnEdit.Visible = true; BtnAdd.Visible = false; } catch (Exception ex) { Response.Write(ex.ToString()); return; } } else Response.Redirect("Home.aspx"); } }