예제 #1
0
        public void LockOut()
        {
            objclsBALUsers = new clsBALUsers();
            DataSet ds = objclsBALUsers.GetLockOut();

            if (ds.Tables[0].Rows.Count > 0)
            {
                Session["lockout"] = ds.Tables[0].Rows[0][0].ToString();
            }
            if (role != null)
            {
                #region Admin
                if (role.Contains <string>(clsEALRoles.ComplianceAdmin))
                {
                    //pnlLockOut.Visible = true;
                    lblLockout.Visible = true;
                    chkLock.Visible    = true;

                    if (Session["lockout"] != null)
                    {
                        //chkLock.Checked = bool.Parse(ds.Tables[0].Rows[0][0].ToString());
                        chkLock.Checked = bool.Parse(Session["lockout"].ToString());
                    }
                    // }
                }
                #endregion

                #region approver
                if (role.Contains <string>(clsEALRoles.Approver))
                {
                    string str = Session["lockout"].ToString();
                    if (str == "True")
                    {
                        string LoggedInUserID = "";
                        if (Session["LoggedInUserID"] != null)
                        {
                            LoggedInUserID = Session["LoggedInUserID"].ToString();
                        }
                        clsBALApplication objclsBALApplication = new clsBALApplication();

                        DataTable dt             = objclsBALApplication.GetUnlockApprover(LoggedInUserID);
                        bool      approverUnlock = false;
                        if (dt.Rows.Count > 0)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                if (dt.Rows[i]["UnlockApp"].ToString().ToLower() == "true")
                                {
                                    approverUnlock = true;
                                    break;
                                }
                            }
                        }
                        if (approverUnlock)
                        {
                            Session["lockout"] = "False";
                        }
                    }
                }
                #endregion

                #region Control Owner
                if (role.Contains <string>(clsEALRoles.ControlOwner))
                {
                    string str = Session["lockout"].ToString();
                    if (str == "True")
                    {
                        string LoggedInUserID = "";
                        if (Session["LoggedInUserID"] != null)
                        {
                            LoggedInUserID = Session["LoggedInUserID"].ToString();
                        }
                        clsBALApplication objclsBALApplication = new clsBALApplication();

                        DataTable dtCO     = objclsBALApplication.GetUnlockCO(LoggedInUserID);
                        bool      coUnlock = false;
                        if (dtCO.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtCO.Rows.Count; i++)
                            {
                                if (dtCO.Rows[i]["UnlockApp"].ToString().ToLower() == "true")
                                {
                                    coUnlock = true;
                                    break;
                                }
                            }
                        }
                        if (coUnlock)
                        {
                            Session["lockout"] = "False";
                        }
                        if (role.Contains <string>(clsEALRoles.GlobalApprover) && role.Contains <string>(clsEALRoles.ControlOwner))
                        {
                            rdGA.Enabled = false;
                        }
                    }
                }
                #endregion
            }
        }