private void FillDepartment(string role)
    {
        //Declaring COllection class object
        BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection();
        DataSet dsDepartment = null;

        Rave.HR.BusinessLayer.FourC.FourC fourCBAL = new Rave.HR.BusinessLayer.FourC.FourC();

        if (role == MasterEnum.FourCRole.RMS_FUNCTIONALMANAGER.ToString())
        {
            dsDepartment = fourCBAL.GetFunctionalManagerDeptName(int.Parse(ViewState["LoginEmpId"].ToString()));
        }
        else
        {
            ////Declaring Master Class Object
            //Rave.HR.BusinessLayer.Common.Master master = new Rave.HR.BusinessLayer.Common.Master();

            ////Calling Fill dropdown Business layer method to fill
            ////the dropdown from Master class.
            //raveHRCollection = master.FillDepartmentDropDownBL();

            dsDepartment = fourCBAL.GetDepartmentName("");
        }

        if (dsDepartment != null)
        {
            ddlDepartment.Items.Clear();

            ddlDepartment.DataSource     = dsDepartment;
            ddlDepartment.DataTextField  = dsDepartment.Tables[0].Columns[1].ToString();
            ddlDepartment.DataValueField = dsDepartment.Tables[0].Columns[0].ToString();

            ddlDepartment.DataBind();
            //ddlDepartment.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT);
            ddlDepartment.Items.Insert(0, new ListItem(CommonConstants.SELECT, CommonConstants.ZERO.ToString()));

            //remove the Dept Name
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByValue(CommonConstants.DeptId_RaveDevelopment.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.PRESALES_USA.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.PRESALES_UK.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.PRESALES_INDIA.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.RAVECONSULTANT_USA.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.RAVECONSULTANT_UK.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.RAVEFORCASTEDPROJECT.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.SALES_DEPARTMENT.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.Senior_Mgt_DEPARTMENT.ToString()));
            ddlDepartment.Items.Remove(ddlDepartment.Items.FindByText(CommonConstants.Project_Mentee2010_DEPARTMENT.ToString()));
        }

        //ddlDepartment.Items.Clear();
        //ddlDepartment.DataSource = raveHRCollection;
        //ddlDepartment.DataTextField = Common.CommonConstants.DDL_DataTextField;
        //ddlDepartment.DataValueField = Common.CommonConstants.DDL_DataValueField;
        //ddlDepartment.DataBind();
        //ddlDepartment.Items.Insert(0, new ListItem(CommonConstants.SELECT, CommonConstants.ZERO.ToString()));
        ////remove the Dept Name called RaveDevelopment from Dropdown -Vandna
        //ddlDepartment.Items.Remove(ddlDepartment.Items.FindByValue(CommonConstants.DeptId_RaveDevelopment.ToString()));
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
        HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
        HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
        HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
        HttpContext.Current.Response.Cache.SetNoStore();

        //AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();
        //UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
        //UserMailId = UserRaveDomainId.Replace("co.in", "com");

        //temp access
        string txtUser = null;
        AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();

        if (ViewState["UserMailId"] == null)
        {
            if (PreviousPage != null)
            {
                prev    = (ASP._4clogin_aspx)PreviousPage;
                txtUser = prev.UserName;

                if (txtUser != null && !string.IsNullOrEmpty(txtUser))
                {
                    ViewState["UserMailId"] = objRaveHRAuthorizationManager.GetDomainUsers(txtUser.ToUpper().Trim());
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(DecryptQueryString("LoginEmailId").ToString()))
                {
                    ViewState["UserMailId"] = DecryptQueryString("LoginEmailId").ToString().Trim();
                }
                else
                {
                    //for all employees
                    UserRaveDomainId        = objRaveHRAuthorizationManager.getLoggedInUser();
                    ViewState["UserMailId"] = UserRaveDomainId.Replace("co.in", "com");
                }
            }

            UserMailId = ViewState["UserMailId"].ToString();
        }
        else
        {
            UserMailId = ViewState["UserMailId"].ToString();
        }
        if (ViewState["dept"] != null)
        {
            dept = Convert.ToInt32(ViewState["dept"]);
        }
        if (!IsPostBack)
        {
            lstRights = CheckAccessRights(UserMailId);

            if (lstRights.Exists(o => o.ToString() == MasterEnum.FourCRole.ViewMy4C.ToString()))
            {
                ViewState["ClickCount"] = "1";
                //lblDate.Text = DateTime.Now.ToString("MMMM") + " " + DateTime.Now.Year;
                lblDate.Text    = DateTime.Now.AddMonths(-1).ToString("MMMM yyyy");
                imgNext.Enabled = false;
                DateTime monthYear = DateTime.Parse(string.Concat("01 ", lblDate.Text));
                //Venkatesh : 4C_Support 26-Mar-2014 : Start
                //Desc : Dept Support
                DataSet dsDepartment = null;
                Rave.HR.BusinessLayer.FourC.FourC fourCBAL = new Rave.HR.BusinessLayer.FourC.FourC();
                try
                {
                    dsDepartment = fourCBAL.GetDepartmentName(UserMailId, "", "");
                    if (dsDepartment != null)
                    {
                        if (dsDepartment.Tables[1] != null)
                        {
                            if (dsDepartment.Tables[1].Rows.Count > 0)
                            {
                                dept = Convert.ToInt32(dsDepartment.Tables[1].Rows[0]["DepartmentID"].ToString());
                                ViewState["dept"] = dept;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetEmployeeDepartment", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
                    LogErrorMessage(objEx);
                }

                //Venkatesh : 4C_Support 26-Mar-2014 : End
                BindProjectData(dept, projectId, monthYear.Month, monthYear.Year);
            }
            else
            {
                Response.Redirect("Home.aspx");
            }
        }
    }