Ejemplo n.º 1
0
        protected void binddata()
        {
            Hashtable htAddPlanParams           = getLedgerParamsData();
            Cls_Business_rptpartyledopenbal obj = new Cls_Business_rptpartyledopenbal();
            DataTable dtPlanDet = obj.getpartyledDet(htAddPlanParams);

            if (dtPlanDet == null)
            {
                Response.Redirect("~/ErrorPage.aspx");
                return;
            }

            if (dtPlanDet.Rows.Count == 0)
            {
                grdExpiry.Visible = false;
                lblMessage.Text   = "No data found";
            }
            else
            {
                grdExpiry.Visible           = true;
                lblMessage.Text             = "";
                ViewState["searched_trans"] = dtPlanDet;
                grdExpiry.DataSource        = dtPlanDet;
                grdExpiry.DataBind();

                ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", "<script>MakeStaticHeader('" + grdExpiry.ClientID + "', 400, 1200 , 37 ,false); </script>", false);
                DivRoot.Style.Add("display", "block");
            }
        }
Ejemplo n.º 2
0
        protected void bindexcel()
        {
            Hashtable htAddPlanParams           = getLedgerParamsData();
            Cls_Business_rptpartyledopenbal obj = new Cls_Business_rptpartyledopenbal();
            DataTable dtPlanDet = obj.getpartyledDet(htAddPlanParams);

            if (dtPlanDet == null)
            {
                lblMessage.Text = "Something went wrong...";
            }
            else
            {
                DateTime     dd       = DateTime.Now;
                string       datetime = dd.Day + "" + dd.Month + "" + dd.Year + "" + dd.Hour + "" + dd.Minute + "" + dd.Second;
                StreamWriter sw       = new StreamWriter(Server.MapPath("../MyExcelFile/") + "Lcobalancemigrat_" + datetime + ".xls");
                try
                {
                    int    j         = 0;
                    String strheader = "Sr. No." + Convert.ToChar(9)
                                       + "LCO Code" + Convert.ToChar(9)
                                       + "LCO Name" + Convert.ToChar(9)
                                       + "Opening Balance" + Convert.ToChar(9)
                                       + "Date" + Convert.ToChar(9);

                    while (j < dtPlanDet.Rows.Count)
                    {
                        sw.WriteLine(strheader);
                        for (int i = 0; i < dtPlanDet.Rows.Count; i++)
                        {
                            j = j + 1;
                            string strrow = j.ToString() + Convert.ToChar(9)
                                            + dtPlanDet.Rows[i]["var_partled_lcocode"].ToString() + Convert.ToChar(9)
                                            + dtPlanDet.Rows[i]["var_partled_lconame"].ToString() + Convert.ToChar(9)
                                            + dtPlanDet.Rows[i]["num_partled_openinbal"].ToString() + Convert.ToChar(9)
                                            + dtPlanDet.Rows[i]["partyleddate"].ToString() + Convert.ToChar(9);
                            sw.WriteLine(strrow);
                        }
                    }
                    sw.Flush();
                    sw.Close();
                }
                catch (Exception ex)
                {
                    sw.Flush();
                    sw.Close();
                    Response.Write("Error : " + ex.Message.Trim());
                    return;
                }
                //dtPlanDet = null;
                dtPlanDet.Dispose();
                Response.Redirect("../MyExcelFile/" + "Lcobalancemigrat_" + datetime + ".xls");
            }
        }