Esempio n. 1
0
    private void InitTreeView(int stuffUserId)
    {
        this.OrganizationTreeView.Nodes.Clear();
        foreach (AuthorizationDS.OrganizationUnitRow organizationUnit in new OUTreeBLL().GetRootOrganizationUnits())
        {
            this.OrganizationTreeView.Nodes.Add(CreateOUTreeNode(organizationUnit));
        }

        AuthorizationDS.PositionDataTable positions = this.AuthBLL.GetPositionByStuffUser(stuffUserId);
        //AuthorizationDS.StuffUserRow stuffUser = this.AuthBLL.GetStuffUserById(stuffUserId);
        //BusinessObjects.AuthorizationDS.StuffUserAndPositionRow[] stuffUserAndPositions = stuffUser.GetStuffUserAndPositionRows();
        List <String> positionIds = new List <String>();

        //foreach (AuthorizationDS.StuffUserAndPositionRow stuffUserAndPosition in stuffUserAndPositions) {
        //    positionIds.Add(stuffUserAndPosition.PositionId.ToString());
        //}
        foreach (AuthorizationDS.PositionRow position in positions)
        {
            positionIds.Add(position.PositionId.ToString());
        }
        foreach (TreeNode node in this.OrganizationTreeView.Nodes)
        {
            CheckTreeNode(node, positionIds);
        }
    }
Esempio n. 2
0
        /// <summary>
        /// 在机构中具有职务类型的职务
        /// </summary>
        /// <param name="ouId"></param>
        /// <param name="positionTypeId"></param>
        /// <returns></returns>
        public AuthorizationDS.PositionRow[] GetPositionsInOU(int ouId, int positionTypeId)
        {
            List <AuthorizationDS.PositionRow> result = new List <AuthorizationDS.PositionRow>();

            AuthorizationDS.PositionDataTable pos = this.PositionTA.GetDataByScope("P" + ouId + "P", positionTypeId);
            foreach (AuthorizationDS.PositionRow po in pos)
            {
                result.Add(DS.Position.FindByPositionId(po.PositionId));
            }
            return(result.ToArray());
        }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        //lwy, migrate from mainpage
        if (Session["StuffUser"] == null)
        {
            this.NavigateMenu.Visible = false;
            return;
        }
        if (!IsPostBack)
        {
            AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            if (Session["ProxyStuffUserId"] != null)
            {
                this.Session["Position"]  = new OUTreeBLL().GetPositionById((int)Session["PositionId"]);
                this.Session["StuffUser"] = new StuffUserBLL().GetStuffUserById((int)Session["StuffUserId"])[0];
                List <string> useRootItems = new List <string>();
                useRootItems.Add(" 申请与报销");
                //useRootItems.Add("个人费用报销申请");
                //useRootItems.Add("出差申请");
                //useRootItems.Add("出差报销申请");
                this.CustomizeNavigateMenu();
                List <MenuItem> noUseRootItems = new List <MenuItem>();
                foreach (MenuItem rootItem in this.NavigateMenu.Items)
                {
                    if (!useRootItems.Contains(rootItem.Text))
                    {
                        noUseRootItems.Add(rootItem);
                    }
                }
                foreach (MenuItem noUseRootItem in noUseRootItems)
                {
                    this.NavigateMenu.Items.Remove(noUseRootItem);
                }

                this.CustomizeNavigateMenu();
            }
            else
            {
                AuthorizationBLL bll = new AuthorizationBLL();
                AuthorizationDS.PositionDataTable positions = bll.GetPositionByStuffUser(stuffUser.StuffUserId);
                if (positions.Count == 0)
                {
                    PageUtility.ShowModelDlg(this.Page, "没有设置职务,请联系系统管理员");
                    this.Response.Redirect("~/ErrorPage/NoPositionErrorPage.aspx");
                    return;
                }
                this.PositionSelectCtl.Items.Clear();
                foreach (AuthorizationDS.PositionRow position in positions)
                {
                    this.PositionSelectCtl.Items.Add(new ListItem(position.PositionName, position.PositionId.ToString()));
                }
                if (positions.Count > 0)
                {
                    this.PositionSelectCtl.Visible   = true;
                    this.PositionSelectLabel.Visible = true;
                }
                if (this.Session["SelectedPosition"] == null)
                {
                    int currentPositionId = int.Parse(this.PositionSelectCtl.SelectedValue);
                    Session["Position"] = new OUTreeBLL().GetPositionById(currentPositionId);
                }
                else
                {
                    Session["Position"] = Session["SelectedPosition"];
                    this.PositionSelectCtl.SelectedValue = ((AuthorizationDS.PositionRow)Session["Position"]).PositionId.ToString();
                }
                if (Session["Position"] == null)
                {
                    int currentPositionId = int.Parse(this.PositionSelectCtl.SelectedValue);
                    Session["Position"] = new OUTreeBLL().GetPositionById(currentPositionId);
                }
                else
                {
                    this.PositionSelectCtl.SelectedValue = ((AuthorizationDS.PositionRow)Session["Position"]).PositionId.ToString();
                }
            }
            AuthorizationDS.StuffUserRow user = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
            this.StuffNameCtl.Text     = user.StuffName;
            this.LastLogInTimeCtl.Text = user.IsLaterLogInTimeNull() ? "" : user.LaterLogInTime.ToShortDateString();
        }
        this.CustomizeNavigateMenu();
    }