Beispiel #1
0
    private void DisplayRoleData()
    {
        if (c.qsAct == ConfigFormAction.edit)
        {
            EmployeeRoleForBackend role = empAuth.GetEmployeeRoleData(c.qsRoleId);

            if (role != null)
            {
                txtSortNo.Text            = role.SortNo.ToString();
                txtRoleName.Text          = role.RoleName;
                txtRoleName.Enabled       = false;
                txtRoleDisplayName.Text   = role.RoleDisplayName;
                CopyPrivilegeArea.Visible = false;

                //modification info
                ltrPostAccount.Text = role.PostAccount;
                ltrPostDate.Text    = string.Format("{0:yyyy-MM-dd HH:mm:ss}", role.PostDate);

                if (role.MdfDate.HasValue)
                {
                    ltrMdfAccount.Text = role.MdfAccount;
                    ltrMdfDate.Text    = string.Format("{0:yyyy-MM-dd HH:mm:ss}", role.MdfDate);
                }

                btnSave.Visible = true;
            }
        }
        else if (c.qsAct == ConfigFormAction.add)
        {
            int newSortNo = empAuth.GetEmployeeRoleMaxSortNo() + 10;
            txtSortNo.Text = newSortNo.ToString();

            btnSave.Visible = true;
        }
    }
Beispiel #2
0
    protected void rptRoles_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        EmployeeRoleForBackend role = (EmployeeRoleForBackend)e.Item.DataItem;

        int    roleId          = role.RoleId;
        string roleName        = role.RoleName;
        string roleDisplayName = role.RoleDisplayName;
        int    empTotal        = role.EmpTotal;

        HtmlGenericControl ctlRoleName = (HtmlGenericControl)e.Item.FindControl("ctlRoleName");

        ctlRoleName.InnerHtml           = roleName;
        ctlRoleName.Attributes["class"] = "RoleDisplay-" + roleName;

        HtmlGenericControl ctlRoleDisplayName = (HtmlGenericControl)e.Item.FindControl("ctlRoleDisplayName");

        ctlRoleDisplayName.InnerHtml           = roleDisplayName;
        ctlRoleDisplayName.Attributes["class"] = "RoleDisplay-" + roleName;

        HtmlAnchor btnEdit = (HtmlAnchor)e.Item.FindControl("btnEdit");

        btnEdit.Attributes["onclick"] = string.Format("popWin('Role-Config.aspx?act={0}&roleid={1}', 700, 600); return false;", ConfigFormAction.edit, roleId);
        btnEdit.Title = Resources.Lang.Main_btnEdit_Hint;

        Literal ltrEdit = (Literal)e.Item.FindControl("ltrEdit");

        ltrEdit.Text = Resources.Lang.Main_btnEdit;

        HtmlAnchor btnGrant = (HtmlAnchor)e.Item.FindControl("btnGrant");

        btnGrant.Attributes["onclick"] = string.Format("popWin('Role-Privilege.aspx?roleid={0}', 700, 600); return false;", roleId);
        btnGrant.Title = Resources.Lang.Main_btnGrant_Hint;

        Literal ltrGrant = (Literal)e.Item.FindControl("ltrGrant");

        ltrGrant.Text = Resources.Lang.Main_btnGrant;

        LinkButton btnDelete = (LinkButton)e.Item.FindControl("btnDelete");

        btnDelete.CommandArgument = string.Join(",", roleId.ToString(), roleName);
        btnDelete.Text            = "<i class='fa fa-trash-o'></i> " + Resources.Lang.Main_btnDelete;
        btnDelete.ToolTip         = Resources.Lang.Main_btnDelete_Hint;
        btnDelete.OnClientClick   = string.Format("return confirm('" + Resources.Lang.Role_ConfirmDelete_Format + "');",
                                                  roleName, roleDisplayName);

        string ownerAccount = role.PostAccount;
        int    ownerDeptId  = role.PostDeptId.Value;

        btnEdit.Visible  = empAuth.CanEditThisPage(false, ownerAccount, ownerDeptId);
        btnGrant.Visible = btnEdit.Visible && (roleName != "admin");

        if (!empAuth.CanDelThisPage(ownerAccount, ownerDeptId) ||
            roleName == "admin" ||
            empTotal > 0)
        {
            btnDelete.Visible = false;
        }
    }
    private void LoadRoleInfoUIData()
    {
        EmployeeRoleForBackend role = empAuth.GetEmployeeRoleData(c.qsRoleId);

        if (role != null)
        {
            ltrRoleDisplayName.Text = role.RoleDisplayName;
            ltrRoleName.Text        = role.RoleName;
            hidRoleId.Value         = c.qsRoleId.ToString();
        }
    }
Beispiel #4
0
        /// <summary>
        /// 取得員工身分資料
        /// </summary>
        public EmployeeRoleForBackend GetEmployeeRoleData(int roleId)
        {
            EmployeeRoleForBackend entity = null;

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                entity   = empAuthDao.GetEmployeeRoleDataForBackend(roleId);
                dbErrMsg = empAuthDao.GetErrMsg();
            }

            return(entity);
        }
Beispiel #5
0
        public EmployeeAuthorizationsWithOwnerInfoOfDataExamined InitialAuthorizationResult(bool isTopPageOfOperation, EmployeeAuthorizations authorizations)
        {
            EmployeeAuthorizationsWithOwnerInfoOfDataExamined authAndOwner = new EmployeeAuthorizationsWithOwnerInfoOfDataExamined(authorizations);

            if (!isTopPageOfOperation)
            {
                // get owner info for config-form
                EmployeeRoleForBackend empRole = empAuth.GetEmployeeRoleData(roleId);

                if (empRole != null)
                {
                    if (empRole.RoleName == roleName)
                    {
                        authAndOwner.OwnerAccountOfDataExamined = empRole.PostAccount;
                        authAndOwner.OwnerDeptIdOfDataExamined  = empRole.PostDeptId.Value;
                    }
                }
            }

            return(authAndOwner);
        }
Beispiel #6
0
        public EmployeeAuthorizationsWithOwnerInfoOfDataExamined InitialAuthorizationResult(bool isTopPageOfOperation, EmployeeAuthorizations authorizations)
        {
            EmployeeAuthorizationsWithOwnerInfoOfDataExamined authAndOwner = new EmployeeAuthorizationsWithOwnerInfoOfDataExamined(authorizations);

            if (!isTopPageOfOperation)
            {
                // get owner info for config-form
                EmployeeRoleForBackend empRole = null;

                using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
                {
                    empRole = empAuthDao.GetEmployeeRoleDataForBackend(qsRoleId);
                    string dbErrMsg = empAuthDao.GetErrMsg();
                }

                if (empRole != null)
                {
                    authAndOwner.OwnerAccountOfDataExamined = empRole.PostAccount;
                    authAndOwner.OwnerDeptIdOfDataExamined  = empRole.PostDeptId.Value;
                }
            }

            return(authAndOwner);
        }