using System; using System.Collections; using System.Configuration; using System.Data; using System.Data.SqlClient; 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.IO; public partial class Monthly_Report : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CMSConnectionString"].ToString()); protected void Page_Load(object sender, EventArgs e) { } protected void btnreturn_Click(object sender, EventArgs e) { if (txtYear.Text=="") { txtYear.Text = "1435"; } lblerror.Text = "جاري التحميل"; //grdDaily.DataSource = nametaha; grdDaily.DataBind(); grdAuthor.DataBind(); GrdWordReview.DataBind(); GrdWordTranslate.DataBind(); GrdVistival.DataBind(); GrdVisit.DataBind(); GrdReportAll.DataBind(); GrdOpenDay.DataBind(); GrdNonMuslim.DataBind(); GrdNewView.DataBind(); grdFreeCopy.DataBind(); //Get Muslim try { SqlCommand cmd = new SqlCommand("SELECT SUM(Le_No) AS No, SUM(ta) AS NO_Code FROM tbl_Muslim GROUP BY Le_Year, Le_Month HAVING" + " (Le_Year = " + txtYear.Text + ") AND (Le_Month = " + DrpMonthF.SelectedValue + ")", con); if (con.State == ConnectionState.Closed) con.Open(); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows) { lblMusNo.Text = dr["NO_Code"].ToString(); lblMusSum.Text = dr["No"].ToString(); } else { lblMusNo.Text = "لا يوجد نتائج لعرضها"; lblMusSum.Text = "لا يوجد نتائج لعرضها"; } dr.Close(); con.Close(); } catch (Exception ex) { lblMusNo.Text = "لا يوجد نتائج لعرضها"; lblMusSum.Text = "لا يوجد نتائج لعرضها"; //lblerror2.Text = "حدث خطأ كالتالي " + ex.ToString(); throw; } //GrdMuslim.DataBind(); GrdLessons.DataBind(); GrdlessonRoom.DataBind(); GrdTottal.DataBind();//This for Arabic; //GrdActivity.DataBind(); grdtbStateF.DataBind(); grdtbStateM.DataBind(); GrdYoutube.DataBind(); grdtblMeeting.DataBind(); grdtblhaj.DataBind(); grdtblOmra.DataBind(); grdtblagree.DataBind(); grdtblBag.DataBind(); grdpub.DataBind(); grdTitle.DataBind(); grdre.DataBind(); lblerror.Text = ""; btnprint.Visible = true; btnpdf.Visible = true; } protected void btnprint_Click(object sender, EventArgs e) { Response.Redirect("Monthly_Report_Print.aspx?YearF=" + txtYear.Text + "&MonthF=" + DrpMonthF.SelectedValue + "&MonthFN=" + DrpMonthF.SelectedItem.Text + ""); } protected void btnpdf_Click(object sender, EventArgs e) { //Response.ContentType = "application/pdf"; //Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf"); //Response.Cache.SetCacheability(HttpCacheability.NoCache); //StringWriter sw = new StringWriter(); //HtmlTextWriter hw = new HtmlTextWriter(sw); //pnlPerson.RenderControl(hw); //StringReader sr = new StringReader(sw.ToString()); //Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f); //HTMLWorker htmlparser = new HTMLWorker(pdfDoc); //PdfWriter.GetInstance(pdfDoc, Response.OutputStream); //pdfDoc.Open(); //htmlparser.Parse(sr); //pdfDoc.Close(); //Response.Write(pdfDoc); //Response.End(); } }