Beispiel #1
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]["SystemAdmin"]) == true)
                {
                    BindEmployeesData();

                    SectorU.DataSource     = Admins.DataSource = Obj.GetDataSet("GetSections");
                    SectorU.DataTextField  = Admins.DataTextField = "SectionName";
                    SectorU.DataValueField = Admins.DataValueField = "SectionID";
                    Admins.DataBind();
                    Admins.Items.Insert(0, "");
                    SectorU.DataBind();
                    SectorU.Items.Insert(0, "");
                }
                else
                {
                    Response.Redirect("NoPermissions.aspx");
                }
            }
        }
    }
Beispiel #2
0
    private void FillSectorU()
    {
        SectorU.Items.Clear();
        SectorU.DataSource     = Obj.GetDataSetByID("GetPlansSection", Convert.ToInt32(DropYearU.SelectedValue));
        SectorU.DataTextField  = "SectionName";
        SectorU.DataValueField = "SectionID";
        SectorU.DataBind();
        ListItem aa = new ListItem();

        aa.Text  = "اختر الإدارة العليا";
        aa.Value = "0";
        SectorU.Items.Insert(0, aa);
        SectorU.SelectedValue = "0";
    }
Beispiel #3
0
    protected void Edit_Command(object sender, CommandEventArgs e) // Edit Button in Reapeater (Employees Data Grid)
    {
        CloseAll();
        LblCase.Text = "> تسجيل بيانات المستخدم  ";
        Updat.Attributes.Remove("style");
        Updat.Style.Add("display", "block");

        SectorU.DataSource     = Obj.GetDataSet("GetSections"); // fill the AdminsU (Administrations Dropdownlist in Editing Window)
        SectorU.DataTextField  = "SectionName";
        SectorU.DataValueField = "SectionID";
        SectorU.DataBind();
        SectorU.Items.Insert(0, "");
        LblEdit.Text = "";
        Suc.Visible  = false;

        DataSet Ds = new DataSet();

        Ds = Obj.GetDataSetByID("GetEmployeeByID", Convert.ToInt32(e.CommandArgument)); // Get the data for the selected Employee
        if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
        {
            LblEdit.Text = "A"; // Have to set the Label with "A" to check in Javascript if ==A will open the editing window

            foreach (DataRow Row in Ds.Tables[0].Rows)
            {
                // Fill the Editig Feilds

                Img1U.Src = Convert.ToString(Row["EmpImg"]);



                AdminsU.DataSource     = Obj.GetDataSetByID("GetAdministrations", Convert.ToInt32(Row["SectionID"])); // Bind the Admins (Administrations) DropdownList
                AdminsU.DataTextField  = "AdmName";                                                                   // Set the text in the dropdown list
                AdminsU.DataValueField = "AdmID";                                                                     // Set the value in the dropdown list
                AdminsU.DataBind();
                AdminsU.Items.Insert(0, "");

                AdminsU.SelectedValue = Convert.ToString(Row["AdmID"]);


                EmpNameU.Value = Convert.ToString(Row["EmpName"]);
                PassordU.Attributes.Add("value", Convert.ToString(Row["EmpPassword"]));
                Passord2U.Attributes.Add("value", Convert.ToString(Row["EmpPassword"]));
                SaveUpdates.CommandArgument = Convert.ToString(Row["EmpID"]);
                //EmpJobCodeU.Value = Convert.ToString(Row["EmpJobCode"]);
                JobNameU.Value      = Convert.ToString(Row["EmpJobTitle"]);
                EmailU.Value        = Convert.ToString(Row["EmpEmail"]);
                AddReportsU.Checked = Convert.ToBoolean(Row["ApprovPermission"]);
                var a = Convert.ToString(Row["SectionID"]);
                SectorU.SelectedValue = Convert.ToString(Row["SectionID"]);

                AdminsU.SelectedValue = Convert.ToString(Row["AdmID"]);


                CheckRecivU.Checked = Convert.ToBoolean(Row["Reciv"]);
                CheckAdminU.Checked = Convert.ToBoolean(Row["SystemAdmin"]);
            }
        }
        else
        {
            LblEdit.Text = "";
        }
    }