Beispiel #1
0
    protected void btnShowReport_Click(object sender, EventArgs e)
    {
        try
        {
            if (radByAllinters122.Checked)
            {
                //if (radlOldSurveys.SelectedIndex == -1)
                //    throw new Exception(Feedback.NoSurveyDateNum());


                //int surveyNum = int.Parse(radlOldSurveys.SelectedValue);
                DataTable dt = new RuttingReport().GetAllIntersectionsRuttingReport(); //(surveyNum);

                Session.Add("option", "radByIntersects");
                Session.Add("ReportData", dt);
                string url = "ViewRuttingReport.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else
            {
                lblFeedback.Text = "";

                if (!radByAllLanes.Checked && (ddlMainStreets.SelectedValue == "0" || string.IsNullOrEmpty(ddlMainStreets.SelectedValue)))
                {
                    throw new Exception(Feedback.NoMainStreetSelected());
                }
                //else
                //    if (radlOldSurveys.SelectedIndex == -1)
                //        throw new Exception(Feedback.NoSurveyDateNum());

                //int surveyNum = int.Parse(radlOldSurveys.SelectedValue);  surveyNum,
                DataTable dt = new RuttingReport().GetRuttingReportForMainStreet(ddlMainStreets.SelectedValue, radByAllLanes.Checked, radByIntersects.Checked);
                if (radByMainLanes.Checked)
                {
                    Session.Add("option", "radByMainLanes");
                    Session.Add("ReportData", dt);
                    string url = "ViewRuttingReport.aspx";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
                }
                else if (radByAllLanes.Checked)
                {
                    Session.Add("option", "radByAllLanes");
                    Session.Add("ReportData", dt);
                    string url = "ViewRuttingReport.aspx";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
                }
                else if (radByIntersects.Checked)
                {
                    Session.Add("option", "radByIntersects");
                    Session.Add("ReportData", dt);
                    string url = "ViewRuttingReport.aspx";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
                }
            }
        }
        catch (Exception ex)
        {
            lblFeedback.Text = ex.Message;
        }
    }
    protected void btnShowReport_Click(object sender, EventArgs e)
    {
        try
        {
            if (radByAllinters122.Checked)
            {
                string    sql = string.Format("SELECT * FROM RUTTING_INTERSECTIONS where SURVEY_NO={0}  ORDER BY INTERSECTION_ORDER, INTER_NO, LANE ", int.Parse(radlOldSurveys.SelectedValue));
                DataTable dt1 = new DataTable();
                dt1 = db.ExecuteQuery(sql);
                Session.Add("option", "radByIntersects");
                Session.Add("ReportData", dt1);
                string url = "ViewRuttingReport.aspx";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
            }
            else
            {
                lblFeedback.Text = "";
                //string lang = Session["lang"].ToString();

                if (!radByAllLanes.Checked && ddlMainStreets.SelectedValue == "0")
                {
                    throw new Exception(Feedback.NoMainStreetSelected());
                }
                else
                if (radlOldSurveys.SelectedIndex == -1)
                {
                    throw new Exception(Feedback.NoSurveyDateNum());
                }


                DataTable dt = new RuttingReport().GetRuttingReportForMainStreet(ddlMainStreets.SelectedValue, int.Parse(radlOldSurveys.SelectedValue), radByAllLanes.Checked, radByIntersects.Checked);
                if (radByMainLanes.Checked)
                {
                    Session.Add("option", "radByMainLanes");
                    Session.Add("ReportData", dt);
                    string url = "ViewRuttingReport.aspx";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
                }
                else if (radByAllLanes.Checked)
                {
                    Session.Add("option", "radByAllLanes");
                    Session.Add("ReportData", dt);
                    string url = "ViewRuttingReport.aspx";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
                }
                else if (radByIntersects.Checked)
                {
                    Session.Add("option", "radByIntersects");
                    Session.Add("ReportData", dt);
                    string url = "ViewRuttingReport.aspx";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "RedirectScriptCoupon", "window.open('" + url + "', '_blank')", true);
                }
            }
        }
        catch (Exception ex)
        {
            lblFeedback.Text = ex.Message;
        }
    }