Exemplo n.º 1
0
 protected void ibtnExportPDFAppTableDoc_Click(object sender, ImageClickEventArgs e)
 {
     if (GridAC.Rows.Count > 0)
     {
         Response.ContentType = "application/pdf";
         Response.AddHeader("content-disposition",
                            "attachment;filename=MembershipAccount.pdf");
         Response.Cache.SetCacheability(HttpCacheability.NoCache);
         StringWriter   sw = new StringWriter();
         HtmlTextWriter hw = new HtmlTextWriter(sw);
         GridAC.AllowPaging = false;
         GridAC.DataSource  = GetDataSource();
         GridAC.DataBind();
         GridAC.RenderControl(hw);
         StringReader sr         = new StringReader(sw.ToString());
         Document     pdfDoc     = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
         HTMLWorker   htmlparser = new HTMLWorker(pdfDoc);
         PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
         pdfDoc.Open();
         htmlparser.Parse(sr);
         pdfDoc.Close();
         Response.Write(pdfDoc);
         Response.End();
     }
 }
Exemplo n.º 2
0
 protected void ibtnExportExcelAppTableDoc_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         GridAC.AllowPaging = false;
         GridAC.DataSource  = GetDataSource();
         GridAC.DataBind();
         if (GridAC.Rows.Count > 0)
         {
             Response.Clear();
             Response.Buffer = true;
             Response.AddHeader("content-disposition",
                                "attachment;filename=AccountDDReport.xls");
             Response.Charset     = "";
             Response.ContentType = "application/vnd.ms-excel";
             StringWriter   sw = new StringWriter();
             HtmlTextWriter hw = new HtmlTextWriter(sw);
             GridAC.RenderControl(hw);
             string style = @"<style> .textmode { mso-number-format:\@; } </style>";
             Response.Write(style);
             Response.Output.Write(sw.ToString());
             Response.Flush();
             Response.End();
         }
     }
     catch (FormatException ex)
     {
     }
 }
Exemplo n.º 3
0
 protected void btnVeiw_OnClick(object sender, EventArgs e)
 {
     try
     {
         string qry = "";
         dtinfo.ShortDatePattern = "dd/MM/yyyy";
         dtinfo.DateSeparator    = "/";
         if (rbtnICE.Checked == true)
         {
             lblGridTitle.Text = "Date: " + txtDateFrom.Text + " To: " + txtDateto.Text.ToString();
             qry = "select IMID,DiaryNo,Session,SubDate as Date,AmtFor,DDDate,DDNO,Bank,Narration,Amt as Amount from FeeAC where SubDate Between '" + Convert.ToDateTime(txtDateFrom.Text, dtinfo) + "' and '" + Convert.ToDateTime(txtDateto.Text, dtinfo) + "' order by SubDate Desc";
         }
         else if (rbtnIM.Checked == true)
         {
             lblGridTitle.Text = "IMID: " + txtIMID.Text.ToString() + " and Session: " + lblSessionHidden.Text.ToString();
             qry = "select IMID,DiaryNo,Session,SubDate as Date,AmtFor,DDDate,DDNO,Bank,Narration,Amt as Amount from FeeAC where Session='" + lblSessionHidden.Text.ToString() + "' and IMID='" + txtIMID.Text.ToString() + "' order by SubDate Desc";
         }
         else if (rbtnDiary.Checked == true)
         {
             lblGridTitle.Text = "Diary No. " + txtDiary.Text.ToString();
             qry = "select IMID,DiaryNo,Session,SubDate as Date,AmtFor,DDDate,DDNO,Bank,Narration,Amt as Amount from FeeAC where DiaryNo='" + txtDiary.Text.ToString() + "'  order by SubDate Desc";
         }
         else if (rbtnDDNO.Checked == true)
         {
             lblGridTitle.Text = "DD No. " + txtDiary.Text.ToString();
             qry = "select IMID,DiaryNo,Session,SubDate as Date,AmtFor,DDDate,DDNO,Bank,Narration,Amt as Amount from FeeAC where DDNO='" + txtDiary.Text.ToString() + "' and Session='" + lblSessionHidden.Text.ToString() + "'  order by SubDate Desc";
         }
         SqlDataAdapter ad = new SqlDataAdapter(qry, con);
         DataTable      dt = new DataTable();
         ad.Fill(dt);
         GridAC.DataSource = dt;
         GridAC.DataBind();
         if (GridAC.Rows.Count > 0)
         {
             GridAC.Focus();
         }
         else
         {
             btnView.Focus();
         }
     }
     catch (FormatException ex)
     {
         GridAC.DataBind();
         if (GridAC.Rows.Count > 0)
         {
             GridAC.Focus();
         }
         else
         {
             btnView.Focus();
         }
     }
     finally
     {
         con.Close();
         con.Dispose();
     }
 }
Exemplo n.º 4
0
 protected void ibtnExportDocAppTableDoc_click(object sender, ImageClickEventArgs e)
 {
     if (GridAC.Rows.Count > 0)
     {
         Response.Clear();
         Response.Buffer = true;
         Response.AddHeader("content-disposition",
                            "attachment;filename=MembershipAccount.doc");
         Response.Charset     = "";
         Response.ContentType = "application/vnd.ms-word ";
         StringWriter   sw = new StringWriter();
         HtmlTextWriter hw = new HtmlTextWriter(sw);
         GridAC.AllowPaging = false;
         GridAC.DataSource  = GetDataSource();
         GridAC.DataBind();
         GridAC.RenderControl(hw);
         Response.Output.Write(sw.ToString());
         Response.Flush();
         Response.End();
     }
 }
Exemplo n.º 5
0
    protected void btnVeiw_OnClick(object sender, EventArgs e)
    {
        string qry = "";

        dtinfo.ShortDatePattern = "dd/MM/yyyy";
        dtinfo.DateSeparator    = "/";
        lblGridTitle.Text       = "IMID " + txtIMID.Text.ToString();
        if (ddlType.SelectedValue == "All")
        {
            qry = "select FeeType,Amt as Amount,SubDate,SubType,YearFrom,YearTo,Bank,AcountNo,DD,Balance,TransType from MemberFee where ID='" + txtIMID.Text + "' and YearFrom='" + lblSessionHidden.Text + "' ORDER BY TransID DESC ";
        }
        else
        {
            qry = "select FeeType,Amt as Amount,SubDate,SubType,YearFrom,YearTo,Bank,AcountNo,DD,Balance,TransType from MemberFee where ID='" + txtIMID.Text + "' and YearFrom='" + lblSessionHidden.Text + "' and SubType='" + ddlType.SelectedValue + "' ORDER BY TransID DESC ";
        }
        SqlDataAdapter ad = new SqlDataAdapter(qry, con);
        DataTable      dt = new DataTable();

        ad.Fill(dt);
        GridAC.DataSource = dt;
        GridAC.DataBind();
    }
Exemplo n.º 6
0
 protected void btnVeiw_OnClick(object sender, EventArgs e)
 {
     try
     {
         SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Conn"]);
         string        qry = "";
         dtinfo.ShortDatePattern = "dd/MM/yyyy";
         dtinfo.DateSeparator    = "/";
         con.Close(); con.Open();
         if (rbtnICE.Checked == true)
         {
             lblGridTitle.Text = "Date: " + txtDateFrom.Text + " To: " + txtDateto.Text.ToString();
             qry = "select IMID,DiaryNo,Session,Date,Amount,Type,Balance,Details from Account where Date Between '" + Convert.ToDateTime(txtDateFrom.Text, dtinfo) + "' and '" + Convert.ToDateTime(txtDateto.Text, dtinfo) + "' ORDER BY SN DESC";
         }
         else if (rbtnIM.Checked == true)
         {
             lblGridTitle.Text = "IMID: " + txtIMID.Text.ToString() + " and Session: " + lblSessionHidden.Text.ToString();
             qry = "select IMID,DiaryNo,Session,Date,Amount,Type,Balance,Details from Account where Session='" + lblSessionHidden.Text.ToString() + "' and IMID='" + txtIMID.Text.ToString() + "' ORDER BY SN DESC";
         }
         else if (rbtnDiary.Checked == true)
         {
             lblGridTitle.Text = "Diary No. " + txtDiary.Text.ToString();
             qry = "select IMID,DiaryNo,Session,Date,Amount,Type,Balance,Details from Account where DiaryNo='" + txtDiary.Text.ToString() + "' ORDER BY SN DESC";
         }
         SqlDataAdapter ad = new SqlDataAdapter(qry, con);
         DataTable      dt = new DataTable();
         ad.Fill(dt);
         GridAC.DataSource = dt;
         GridAC.DataBind();
         GridAC.Focus();
     }
     catch (SqlException ex)
     {
     }
     catch (FormatException ex)
     {
     }
 }
Exemplo n.º 7
0
 protected void GridAC_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridAC.PageIndex  = e.NewPageIndex;
     GridAC.DataSource = GetDataSource();
     GridAC.DataBind();
 }