Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SPSecurity.RunWithElevatedPrivileges(delegate()
     {
         if (!IsPostBack)
         {
             DashBoard_Year = EnableYear_DAL.get_Active_Set_Goals_Year();
             if (DashBoard_Year == "NoSetGoalsActiveYear")
             {
                 DashBoard_Year = DateTime.Now.Year.ToString();
             }
             lblActiveYear.Text  = "متابعة وضع الأهداف والتقييم لسنة " + DashBoard_Year;
             tbl_Emps_App_Status = Dashboard_DAL.get_Dashboard_DT(DashBoard_Year);
             Bind_Data_To_Grid();
         }
     });
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                if (!IsPostBack)
                {
                    Active_Set_Goals_Year = EnableYear_DAL.get_Active_Set_Goals_Year();

                    #region Identify to-be-evaluated-user, Get his informatiion , and Bind it

                    strEmpDisplayName = getEmp_from_QueryString_or_currentUser();

                    intended_Emp = Emp_DAL.get_Emp_Info(strEmpDisplayName);
                    bind_Emp_Info();

                    #endregion Identify to-be-evaluated-user, Get his informatiion , and Bind it

                    tblObjectives = SetObjectives_DAL.getPreviouslySavedObjectives(strEmpDisplayName, Active_Set_Goals_Year).GetDataTable();

                    #region Check goals status and make ReadOnly mode

                    if (tblObjectives.Rows.Count > 0)
                    {
                        string currunt_status     = tblObjectives.Rows[0]["Status"].ToString();
                        string currunt_user_email = SPContext.Current.Web.CurrentUser.Email;
                        if (currunt_status == "Objectives_set_by_Emp" && currunt_user_email == intended_Emp.DM_email)
                        {
                            Show_Approve_Reject_Controls();
                        }
                        else if (currunt_status == "Objectives_approved_by_DM" && currunt_user_email == intended_Emp.Dept_Head_email)
                        {
                            Show_Approve_Reject_Controls();
                        }
                        else
                        {
                            Make_Read_Only_Mode();
                        }
                    }

                    #endregion Check goals status and make ReadOnly mode

                    Refresh_Objectives_grid();
                }
            });
        }
        private void getEmps()
        {
            try
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    SPSite oSite                      = new SPSite(SPContext.Current.Web.Url);
                    SPWeb spWeb                       = oSite.OpenWeb();
                    SPPrincipalInfo pinfo             = SPUtility.ResolvePrincipal(spWeb, strEmpDisplayName, SPPrincipalType.User, SPPrincipalSource.All, null, false);
                    SPServiceContext serviceContext   = SPServiceContext.GetContext(oSite);
                    UserProfileManager userProfileMgr = new UserProfileManager(serviceContext);
                    UserProfile cUserProfile          = userProfileMgr.GetUserProfile(pinfo.LoginName);

                    List <UserProfile> directReports = new List <UserProfile>(cUserProfile.GetDirectReports());
                    foreach (UserProfile up in directReports)
                    {
                        DataRow row = tblEmps.NewRow();

                        if (up.GetProfileValueCollection("AboutMe")[0] != null && up.GetProfileValueCollection("AboutMe")[0].ToString() != string.Empty)
                        {
                            row["EmpName"] = up.GetProfileValueCollection("AboutMe")[0].ToString();
                        }
                        else
                        {
                            row["EmpName"] = up.DisplayName;
                        }

                        row["EnglishName"] = up.DisplayName;


                        row["EmpJob"] = up.GetProfileValueCollection("Title")[0].ToString();

                        string Active_Set_Goals_Year = EnableYear_DAL.get_Active_Set_Goals_Year();
                        string empEmail = up.GetProfileValueCollection("WorkEmail")[0].ToString();
                        SPUser sp       = spWeb.SiteUsers.GetByEmail(empEmail);
                        string Emp_Application_Status    = Dashboard_DAL.get_Emp_Application_Status(sp, Active_Set_Goals_Year)[0];
                        string Emp_Application_Status_Ar = string.Empty;

                        if (Emp_Application_Status == "Objectives not set")
                        {
                            Emp_Application_Status_Ar = "لم يتم وضع الأهداف بعد";
                        }
                        else if (Emp_Application_Status == "Objectives_set_by_Emp")
                        {
                            Emp_Application_Status_Ar = "تم وضع الأهداف - بإنتظار اعتماد المدير المباشر";
                        }
                        else if (Emp_Application_Status == "Objectives_approved_by_DM")
                        {
                            Emp_Application_Status_Ar = "اعتمد المدير المباشر الأهداف";
                        }
                        else if (Emp_Application_Status == "Objectives_approved_by_Dept_Head")
                        {
                            Emp_Application_Status_Ar = "اعتمد مدير الإدارة الأهداف";
                        }

                        row["Emp_Application_Status"] = Emp_Application_Status_Ar;

                        tblEmps.Rows.Add(row);
                    }
                });
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                if (!IsPostBack)
                {
                    Active_Set_Goals_Year = EnableYear_DAL.get_Active_Set_Goals_Year();

                    #region Check if setting goals period is closed, and if true, make ReadOnly mode

                    if (Active_Set_Goals_Year == "NoSetGoalsActiveYear")
                    {
                        Active_Set_Goals_Year = SetObjectives_DAL.get_Year_to_display_if_none_active();
                        Make_Read_Only_Mode();
                    }

                    #endregion Check if setting goals period is closed, and if true, make ReadOnly mode

                    #region Bind Objectives Year

                    lblActiveYear.Text = Active_Set_Goals_Year;

                    #endregion Bind Objectives Year

                    #region Identify Current User , get his informatiion , and Bind it

                    strEmpDisplayName = getEmp_from_QueryString_or_currentUser();

                    intended_Emp = Emp_DAL.get_Emp_Info(strEmpDisplayName);

                    bind_Emp_Info();

                    if (intended_Emp.EmpHierLvl == "4")
                    {
                        Set_Blank_Mode_For_High_Managerial_Levels();
                        return;
                    }

                    #endregion Identify Current User , get his informatiion , and Bind it

                    Bind_DDLs();

                    tblObjectives = SetObjectives_DAL.getPreviouslySavedObjectives(strEmpDisplayName, Active_Set_Goals_Year).GetDataTable();

                    #region Check if goals status is not "rejected" , make ReadOnly mode

                    if (tblObjectives.Rows.Count > 0)
                    {
                        string currunt_status = tblObjectives.Rows[0]["Status"].ToString();
                        if (currunt_status != "Objectives_rejected_by_DM" && currunt_status != "Objectives_rejected_by_Dept_Head")
                        {
                            Make_Read_Only_Mode();
                        }
                    }

                    #endregion Check if goals status is not "rejected" , make ReadOnly mode

                    Refresh_Objectives_grid();
                }
            });
        }