Ejemplo n.º 1
0
        protected void grdAddPlanSearch_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            grdAddPlanSearch.PageIndex = e.NewPageIndex;
            Hashtable htAddPlanParams = getAddPlanParamsData();

            string username, catid, operator_id;

            if (Session["username"] != null || Session["operator_id"] != null)
            {
                username    = Session["username"].ToString();
                catid       = Convert.ToString(Session["category"]);
                operator_id = Convert.ToString(Session["operator_id"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }
            Cls_Business_RptAddPlan objTran = new Cls_Business_RptAddPlan();
            Hashtable htResponse            = objTran.GetTransations(htAddPlanParams, username, catid, operator_id);

            DataTable dt = null; //check for exception

            if (htResponse["htResponse"] != null)
            {
                dt = (DataTable)htResponse["htResponse"];
            }

            if (dt == null)
            {
                Response.Redirect("~/ErrorPage.aspx");
                return;
            }
            if (dt.Rows.Count == 0)
            {
                grdAddPlanSearch.Visible = false;
                btnAll.Visible           = false;
                lblSearchMsg.Text        = "No data found";
                btn_genExl.Visible       = false;
            }
            else
            {
                btn_genExl.Visible       = true;
                grdAddPlanSearch.Visible = true;
                btnAll.Visible           = true;
                lblSearchMsg.Text        = "";
                // ViewState["searched_trans"] = dt;
                grdAddPlanSearch.DataSource = dt;
                grdAddPlanSearch.DataBind();
                htResponse["htResponse"] = null;
                dt.Dispose();
            }
        }
Ejemplo n.º 2
0
        public void binddata()
        {
            Hashtable htAddPlanParams = getAddPlanParamsData();

            string username;

            if (Session["username"] != null)
            {
                username = Session["username"].ToString();
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }

            Cls_Business_RptAddPlan objTran = new Cls_Business_RptAddPlan();
            Hashtable htResponse            = objTran.GetTransationsDet(htAddPlanParams, username);

            DataTable dt = null; //check for exception

            if (htResponse["htResponse"] != null)
            {
                dt = (DataTable)htResponse["htResponse"];
            }

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

            //showing parameters
            string strParams = htResponse["ParamStr"].ToString();

            if (!String.IsNullOrEmpty(strParams))
            {
                lblSearchParams.Text = Server.HtmlDecode("<b style='color:#094791;'>Transaction Parameters : </b>" + strParams);
            }

            if (dt.Rows.Count == 0)
            {
                grdTransDet.Visible  = false;
                lblSearchMsg.Text    = "No data found";
                btn_genExl.Visible   = false;
                btn_genExcel.Visible = false;
            }
            else
            {
                grdTransDet.Visible         = true;
                btn_genExl.Visible          = true;
                btn_genExcel.Visible        = true;
                lblSearchMsg.Text           = "";
                ViewState["searched_trans"] = dt;
                grdTransDet.DataSource      = dt;
                grdTransDet.DataBind();
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "Key", "<script>MakeStaticHeader('" + grdTransDet.ClientID + "', 400, 1200 , 46 ,false); </script>", false);
                DivRoot.Style.Add("display", "block");

                htResponse["htResponse"] = null;
                dt.Dispose();

                //showing result count
                // lblResultCount.Text = Server.HtmlDecode("<b>Showing Top " + dt.Rows.Count.ToString() + " Matching Results</b>");

                //to get transaction type on frmSerTransDetails.aspx
            }
        }
Ejemplo n.º 3
0
        public void binddata()
        {
            Hashtable htAddPlanParams = getAddPlanParamsData();

            string username, catid, operator_id;

            if (Session["username"] != null || Session["operator_id"] != null)
            {
                username    = Session["username"].ToString();
                catid       = Convert.ToString(Session["category"]);
                operator_id = Convert.ToString(Session["operator_id"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }

            Cls_Business_RptAddPlan objTran = new Cls_Business_RptAddPlan();
            Hashtable htResponse            = objTran.GetTransationsU(htAddPlanParams, username, catid, operator_id);

            DataTable dt = null; //check for exception

            if (htResponse["htResponse"] != null)
            {
                dt = (DataTable)htResponse["htResponse"];
            }

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

            //showing parameters
            string strParams = htResponse["ParamStr"].ToString();

            if (!String.IsNullOrEmpty(strParams))
            {
                // lblSearchParams.Text = Server.HtmlDecode("<b style='color:#094791;'>Transaction Parameters : </b>" + strParams);
                lblSearchParams.Text = Server.HtmlDecode("<b style='color:#094791;'></b>" + strParams);
            }

            if (dt.Rows.Count == 0)
            {
                btn_genExl.Visible      = false;
                grdTransUserDet.Visible = false;
                lblSearchMsg.Text       = "No data found";
                btnAll.Visible          = false;
            }
            else
            {
                btn_genExl.Visible          = true;
                grdTransUserDet.Visible     = true;
                lblSearchMsg.Text           = "";
                btnAll.Visible              = true;
                ViewState["searched_trans"] = dt;
                grdTransUserDet.DataSource  = dt;
                grdTransUserDet.DataBind();
                htResponse["htResponse"] = null;
                dt.Dispose();

                //showing result count
                // lblResultCount.Text = Server.HtmlDecode("<b>Showing Top " + dt.Rows.Count.ToString() + " Matching Results</b>");

                //to get transaction type on frmSerTransDetails.aspx
            }
        }
Ejemplo n.º 4
0
        protected void btn_genExl_Click(object sender, EventArgs e)
        {
            Hashtable htAddPlanParams = getAddPlanParamsData();

            string username, catid, operator_id;

            if (Session["username"] != null || Session["operator_id"] != null)
            {
                username    = Session["username"].ToString();
                catid       = Convert.ToString(Session["category"]);
                operator_id = Convert.ToString(Session["operator_id"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }

            Cls_Business_RptAddPlan objTran = new Cls_Business_RptAddPlan();
            Hashtable htResponse            = objTran.GetTransationsU(htAddPlanParams, username, catid, operator_id);

            DataTable dt = null; //check for exception

            if (htResponse["htResponse"] != null)
            {
                dt = (DataTable)htResponse["htResponse"];
                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/") + "PlanAddUser_" + datetime + ".xls");
                try
                {
                    int    j         = 0;
                    String strheader = "SrNo" + Convert.ToChar(9)
                                       + "LCO Name" + Convert.ToChar(9)
                                       + "User Id" + Convert.ToChar(9)
                                       + "User Name" + Convert.ToChar(9)
                                       //    + "Balance" + Convert.ToChar(9)
                                       + "Amount Deducted" + Convert.ToChar(9)
                                       + "Count" + Convert.ToChar(9);



                    while (j < dt.Rows.Count)
                    {
                        sw.WriteLine(strheader);
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            j = j + 1;
                            string strrow = j.ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["lconame"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["uname"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["userowner"].ToString() + Convert.ToChar(9)
                                            //+ dt.Rows[i]["amt"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["amtdd"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["cnt"].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;
                }
                htResponse["htResponse"] = null;
                dt.Dispose();
                Response.Redirect("../MyExcelFile/" + "PlanAddUser_" + datetime + ".xls");
            }

            if (dt == null)
            {
                Response.Redirect("~/ErrorPage.aspx");
                return;
            }
        }
Ejemplo n.º 5
0
        public void Binddata()
        {
            lblSearchMsg.Text        = "";
            grdAddPlanSearch.Visible = true;
            btnAll.Visible           = true;

            Hashtable htAddPlanParams = getAddPlanParamsData();

            string username, catid, operator_id;

            if (Session["username"] != null || Session["operator_id"] != null)
            {
                username    = Session["username"].ToString();
                catid       = Convert.ToString(Session["category"]);
                operator_id = Convert.ToString(Session["operator_id"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }

            //if (catid == "3")
            //{
            //    Session["lcoid"] = operator_id.ToString();
            //    Session["lconame"] = "All";
            //    Session["showall"] = "1";
            //    Response.Redirect("../Reports/rptAddPlanTransUSER.aspx");//?lcoid=" + operator_id.ToString());// + "'" + "lcoid=" + operator_id.ToString());
            //}


            Cls_Business_RptAddPlan objTran = new Cls_Business_RptAddPlan();
            Hashtable htResponse            = objTran.GetTransations(htAddPlanParams, username, catid, operator_id);

            DataTable dt = null; //check for exception

            if (htResponse["htResponse"] != null)
            {
                dt = (DataTable)htResponse["htResponse"];
            }

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

            string strParams = htResponse["ParamStr"].ToString();

            if (!String.IsNullOrEmpty(strParams))
            {
                lblSearchParams.Text = Server.HtmlDecode("<b style='color:#094791;'></b>" + strParams);
            }


            if (dt.Rows.Count == 0)
            {
                grdAddPlanSearch.Visible = false;
                btnAll.Visible           = false;
                lblSearchMsg.Text        = "No data found";
                btn_genExl.Visible       = false;
            }
            else
            {
                btn_genExl.Visible          = true;
                grdAddPlanSearch.Visible    = true;
                btnAll.Visible              = true;
                lblSearchMsg.Text           = "";
                ViewState["searched_trans"] = dt;
                grdAddPlanSearch.DataSource = dt;
                grdAddPlanSearch.DataBind();
                htResponse["htResponse"] = null;
                dt.Dispose();
            }
        }
Ejemplo n.º 6
0
        protected void btnAll_Click(object sender, EventArgs e)
        {
            //Response.Redirect("../Reports/rptAddPlanTransDET.aspx?showall=1");
            string    username;
            Hashtable ht = getExcelParamsData();

            if (Session["username"] != null)
            {
                username = Session["username"].ToString();
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }
            Cls_Business_RptAddPlan objTran = new Cls_Business_RptAddPlan();
            Hashtable htResponse            = objTran.GetTransationsDet(ht, username);

            DataTable dt = null; //check for exception

            dt = (DataTable)htResponse["htResponse"];
            if (dt == null)
            {
                Response.Redirect("~/ErrorPage.aspx");
                return;
            }
            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/") + "PlanAdd_" + datetime + ".xls");
                try
                {
                    int    j         = 0;
                    String strheader = "Sr. No." + Convert.ToChar(9)
                                       + "Trans ID" + Convert.ToChar(9)
                                       + "Customer ID" + Convert.ToChar(9)
                                       + "Customer Name" + Convert.ToChar(9)
                                       + "Customer Address" + Convert.ToChar(9)
                                       + "VC ID" + Convert.ToChar(9)
                                       + "Plan Name" + Convert.ToChar(9)
                                       + "Plan Type" + Convert.ToChar(9)
                                       + "Transaction Type" + Convert.ToChar(9)
                                       + "Reason" + Convert.ToChar(9)
                                       + "User ID" + Convert.ToChar(9)
                                       + "User Name" + Convert.ToChar(9)
                                       + "'" + "Transaction Date & Time" + Convert.ToChar(9)
                                       + "MRP" + Convert.ToChar(9)
                                       + "Amount deducted" + Convert.ToChar(9)
                                       + "'" + "Expiry date" + Convert.ToChar(9)
                                       + "Pay Term" + Convert.ToChar(9)
                                       + "Balance" + Convert.ToChar(9)
                                       + "LCO Code" + Convert.ToChar(9)
                                       + "LCO Name" + Convert.ToChar(9)
                                       + "JV Name" + Convert.ToChar(9)
                                       + "ERP LCO A/C" + Convert.ToChar(9)
                                       + "Distributor" + Convert.ToChar(9)
                                       + "Sub distributor" + Convert.ToChar(9)
                                       + "City" + Convert.ToChar(9)
                                       + "State" + Convert.ToChar(9);

                    while (j < dt.Rows.Count)
                    {
                        sw.WriteLine(strheader);
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            j = j + 1;
                            string strrow = j.ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["transid"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["custid"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["custname"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["custaddr"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["vc"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["plnname"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["plntyp"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["flag"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["reason"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["uname"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["userowner"].ToString() + Convert.ToChar(9)
                                            + "'" + dt.Rows[i]["tdt"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["custprice"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["amtdd"].ToString() + Convert.ToChar(9)
                                            + "'" + dt.Rows[i]["expdt"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["payterm"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["bal"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["lcocode"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["lconame"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["jvname"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["erplco_ac"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["distname"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["subdist"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["city"].ToString() + Convert.ToChar(9)
                                            + dt.Rows[i]["state"].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;
                }
                htResponse["htResponse"] = null;
                dt.Dispose();
                Response.Redirect("../MyExcelFile/" + "PlanAdd_" + datetime + ".xls");
            }
        }
Ejemplo n.º 7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string   from = txtFrom.Text;
            string   to   = txtTo.Text;
            DateTime fromDt;
            DateTime toDt;
            DateTime NonNTODate;

            //if (RadSearchby.Items[1].Selected == true ||(txtsearchpara.Text == ""))
            //{
            //    Response.Write("<script type=\"text/javascript\">alert('Please Enter VC No.');</script>");
            //    return;

            //}
            if (!String.IsNullOrEmpty(from) && !String.IsNullOrEmpty(to))
            {
                fromDt     = new DateTime();
                toDt       = new DateTime();
                NonNTODate = new DateTime();
                fromDt     = DateTime.ParseExact(from, "dd-MMM-yyyy", null);
                toDt       = DateTime.ParseExact(to, "dd-MMM-yyyy", null);
                NonNTODate = DateTime.ParseExact("31-Jan-2019", "dd-MMM-yyyy", null);

                if (toDt.CompareTo(fromDt) < 0)
                {
                    lblSearchMsg.Text        = "To date must be later than From date !";
                    grdAddPlanSearch.Visible = false;
                    btnAll.Visible           = false;
                    lblSearchMsg.ForeColor   = System.Drawing.Color.Red;
                    return;
                }
                else if (fromDt <= NonNTODate)
                {
                    lblSearchMsg.Text = "Kindly use Non NTO Transaction Report for selected Period";
                    return;
                }
                else if (Convert.ToString(fromDt.Month) != Convert.ToString(toDt.Month))
                {
                    lblSearchMsg.Text = "From date To date should be same Month !";
                    return;
                }

                else if (Convert.ToDateTime(txtFrom.Text.ToString()) > DateTime.Now.Date)
                {
                    lblSearchMsg.Text = "You can not select date greater than current date!";
                    return;
                }
                else if (Convert.ToDateTime(txtTo.Text.ToString()) > DateTime.Now.Date)
                {
                    lblSearchMsg.Text = "You can not select date greater than current date!";
                    return;
                }
                else
                {
                    lblSearchMsg.Text        = "";
                    grdAddPlanSearch.Visible = true;
                    btnAll.Visible           = true;
                }
            }

            Hashtable htAddPlanParams = getAddPlanParamsData();

            string username, catid, operator_id;

            if (Session["username"] != null || Session["operator_id"] != null)
            {
                username    = Session["username"].ToString();
                catid       = Convert.ToString(Session["category"]);
                operator_id = Convert.ToString(Session["operator_id"]);
            }
            else
            {
                Session.Abandon();
                Response.Redirect("~/Login.aspx");
                return;
            }
            string search_type = RadSearchby.SelectedValue.ToString();

            Session["search"] = search_type.ToString().Trim();

            string txtsearch = "";

            if (txtsearchpara.Text.Length > 0)
            {
                string valid = SecurityValidation.chkData("T", txtsearchpara.Text);

                if (valid == "")
                {
                    txtsearch = txtsearchpara.Text.ToString().Trim();
                }
                else
                {
                    lblSearchMsg.Text = valid.ToString();
                    btnAll.Visible    = false;
                    return;
                }
            }
            Session["txtsearch"] = txtsearch.ToString().Trim();
            if (catid == "3")
            {
                Session["lcoid"]   = operator_id.ToString();
                Session["lconame"] = "All";
                Session["showall"] = "1";
                Response.Redirect("../Reports/rptAddPlanTransUSER.aspx");//?lcoid=" + operator_id.ToString());// + "'" + "lcoid=" + operator_id.ToString());
            }
            if (catid == "11")
            {
                Session["msoid"]   = operator_id.ToString();
                Session["msoname"] = "All";
                Session["showall"] = "1";
                Response.Redirect("../Reports/rptAddPlanTransLCO.aspx");
            }
            if (catid == "2")
            {
                Session["msoid"]   = operator_id.ToString();
                Session["msoname"] = "All";
                Session["showall"] = "1";
                Response.Redirect("../Reports/rptAddPlanTransLCO.aspx");
            }
            if (catid != "0" && catid != "10")
            {
                Cls_Business_RptAddPlan objTran = new Cls_Business_RptAddPlan();
                Hashtable htResponse            = objTran.GetTransationsMSO(htAddPlanParams, username, catid, operator_id);

                DataTable dt = null;
                if (htResponse["htResponse"] != null)
                {
                    dt = (DataTable)htResponse["htResponse"];
                }

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

                //showing parameters
                string strParams = htResponse["ParamStr"].ToString();
                if (!String.IsNullOrEmpty(strParams))
                {
                    // lblSearchParams.Text = Server.HtmlDecode("<b style='color:#094791;'>Transaction Parameters : </b>" + strParams);
                    lblSearchParams.Text = Server.HtmlDecode("<b style='color:#094791;'> </b>" + strParams);
                }

                if (dt.Rows.Count == 0)
                {
                    grdAddPlanSearch.Visible = false;
                    btnAll.Visible           = false;
                    lblSearchMsg.Text        = "No data found";
                    btn_genExl.Visible       = false;
                }
                else
                {
                    btn_genExl.Visible          = true;
                    grdAddPlanSearch.Visible    = true;
                    btnAll.Visible              = true;
                    lblSearchMsg.Text           = "";
                    ViewState["searched_trans"] = dt;
                    grdAddPlanSearch.DataSource = dt;
                    grdAddPlanSearch.DataBind();
                    htResponse["htResponse"] = null;
                    dt.Dispose();
                }
            }
            else if (catid == "0" || catid == "10")
            {
                ExportExcel(from, to);
            }
        }