Ejemplo n.º 1
0
 protected void MainStatus_SelectedIndexChanged(object sender, EventArgs e)
 {
     for (int i = 0; i <= YearList.Items.Count - 1; i++)
     {
         if (YearList.Items[i].Selected == true)
         {
             RepYears.DataSource = Obj.GetDataSetByID("ReportOneYearAll", Convert.ToInt32(YearList.Items[i].Value));
             RepYears.DataBind();
         }
     }
 }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["UData"] != null)
            {
                DataSet MyRecDataSet = (DataSet)Session["UData"];
                if (Convert.ToBoolean(MyRecDataSet.Tables[0].Rows[0]["Gov"]) == true || Convert.ToBoolean(MyRecDataSet.Tables[0].Rows[0]["SystemAdmin"]) == true)
                {
                    RepYears.DataSource = YearList.DataSource = Obj.GetDataSet("ReportAllYears");
                    YearList.DataBind();
                    RepYears.DataBind();

                    YearList.DataTextField  = "YearName";
                    YearList.DataValueField = "ID";
                    YearList.DataBind();
                }
                else if (Obj.ExecuteProcedureID("CheckSectionManger", Convert.ToInt32(MyRecDataSet.Tables[0].Rows[0]["EmpID"])) == 1)
                {
                    Sections.Attributes.Remove("style");
                    Sections.Attributes.Add("style", "display:none");

                    RepYears.DataSource = YearList.DataSource = Obj.GetDataSetByID("GetPlansBySection", Convert.ToInt32(MyRecDataSet.Tables[0].Rows[0]["SectionID"]));
                    YearList.DataBind();
                    RepYears.DataBind();

                    YearList.DataTextField  = "YearName";
                    YearList.DataValueField = "ID";
                    YearList.DataBind();
                }

                else
                {
                    Response.Redirect("NoPermissions.aspx");
                }
            }
        }

        else
        {
            if (HiddenYear.Value == "1")
            {
                DataSet MyRecDataSet = (DataSet)Session["UData"];

                if (YearList.SelectedIndex == -1)
                {
                    SectorList.Items.Clear();
                    AdminList.Items.Clear();
                    RepYears.DataSource = null;
                    RepYears.DataBind();

                    RepYears.DataSource = Obj.GetDataSet("ReportAllYears");
                    RepYears.DataBind();
                }
                else
                {
                    for (int i = 0; i <= YearList.Items.Count - 1; i++)
                    {
                        if (YearList.Items[i].Selected == true)
                        {
                            // Fill dropdown Lists For Reports Sections تبعا للسنة


                            RepYears.DataSource = null;
                            RepYears.DataBind();
                            RepYears.DataSource = Obj.GetDataSetByID("ReportOneYearAll", Convert.ToInt32(YearList.Items[i].Value));
                            RepYears.DataBind();

                            if (Convert.ToBoolean(MyRecDataSet.Tables[0].Rows[0]["Gov"]) == true || Convert.ToBoolean(MyRecDataSet.Tables[0].Rows[0]["SystemAdmin"]) == true)
                            {
                                SectorList.DataSource = null;
                                SectorList.DataBind();
                                SectorList.DataSource     = Obj.GetDataSetByID("ReportSectionsAllStatusYear", Convert.ToInt32(YearList.Items[i].Value));
                                SectorList.DataTextField  = "SectionName";
                                SectorList.DataValueField = "SectionID";
                                SectorList.DataBind();
                            }
                            else if (Obj.GetDataSetByID("GetSectionsByManager", Convert.ToInt32(MyRecDataSet.Tables[0].Rows[0]["EmpID"])).Tables[0].Rows.Count > 0)
                            {
                            }
                        }
                    }
                }
                HiddenYear.Value = "0";
            }
            if (HiddenSector.Value == "1")
            {
                for (int i = 0; i <= SectorList.Items.Count - 1; i++)
                {
                    if (SectorList.Items[i].Selected == true)
                    {
                        for (int j = 0; j <= YearList.Items.Count - 1; j++)
                        {
                            if (YearList.Items[j].Selected == true)
                            {
                                RepYears.DataSource = null;
                                RepYears.DataBind();
                                RepYears.DataSource = Obj.GetDataSetByID("ReportOneYearAll", Convert.ToInt32(YearList.Items[j].Value));
                                RepYears.DataBind();
                                AdminList.DataSource = null;
                                AdminList.DataBind();

                                AdminList.DataSource     = Obj.GetDataSetBy2ID("RepAllAdminsByStatIDYear", Convert.ToInt32(YearList.Items[j].Value), Convert.ToInt32(SectorList.Items[i].Value));
                                AdminList.DataTextField  = "AdmName";
                                AdminList.DataValueField = "AdmID";
                                AdminList.DataBind();
                            }
                        }
                    }
                }
                HiddenSector.Value = "0";
            }
        }
    }