Exemplo n.º 1
0
    protected void ReportTo(string rpt)
    {
        string xxRPT = rpt;

        if (xxRPT.ToString() == "Management")
        {
            xStr = "select Code, PlannerName from fp_Planner p where PlannerRole=(Select Code from fp_ComboDetail where Name='Admin')";
        }

        if (xxRPT.ToString() == "Planner")
        {
            xStr = "select Code, PlannerName from fp_Planner p where PlannerRole in (Select Code from fp_ComboDetail where Name<>'Operator')";
        }

        if (xxRPT.ToString() == "Operator")
        {
            xStr = "select Code, PlannerName from fp_Planner p where PlannerRole in (Select Code from fp_ComboDetail where Name<>'Planner')";
        }

        SqlDataAdapter RDA2 = new SqlDataAdapter(xStr, Con);

        DataSet RDS2 = new DataSet();

        Con.Open();
        RDA2.Fill(RDS2);
        Con.Close();

        DropDownReportTo.DataSource     = RDS2;
        DropDownReportTo.DataTextField  = "PlannerName";
        DropDownReportTo.DataValueField = "Code";
        DropDownReportTo.DataBind();
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if ((string)Session["AdminSessionID"] != null)
            {
                ViewState["xCode"]  = Session["AdminSessionID"].ToString();
                ViewState["xPRole"] = Session["LoginRole"].ToString();

                // Code for Planner Role
                SqlDataAdapter RDA = new SqlDataAdapter(" " +

                                                        " select * from fp_ComboDetail where comboCode=15 " +
                                                        "  ", Con);

                DataSet RDS = new DataSet();
                Con.Open();
                RDA.Fill(RDS);
                Con.Close();

                DDPlannerRole.DataSource     = RDS;
                DDPlannerRole.DataTextField  = "Name";
                DDPlannerRole.DataValueField = "Code";
                DDPlannerRole.DataBind();

                DDPlannerRole.Items.Insert(0, new ListItem("Select Role", "0"));

                // Code for Report To
                SqlDataAdapter RDA2 = new SqlDataAdapter(" " +

                                                         " select Code, ReportName=PlannerName from fp_Planner order by PlannerName " +
                                                         //" where PlannerRole=(Select Code from fp_ComboDetail where Name='Management' ) " +
                                                         "  ", Con);

                DataSet RDS2 = new DataSet();
                Con.Open();
                RDA2.Fill(RDS2);
                Con.Close();

                DropDownReportTo.DataSource     = RDS2;
                DropDownReportTo.DataTextField  = "ReportName";
                DropDownReportTo.DataValueField = "Code";
                DropDownReportTo.DataBind();
            }
            else
            {
                Response.Redirect("SessionExpired.aspx");
            }
            FillGrid_User();
        }
    }