Example #1
0
        private void rptDepartment_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var departmentId   = (int)e.Item.DataItem;
            var departmentInfo = DepartmentManager.GetDepartmentInfo(departmentId);

            var ltlHtml = e.Item.FindControl("ltlHtml") as Literal;

            if (ltlHtml != null)
            {
                ltlHtml.Text = PageAdminDepartment.GetDepartmentRowHtml(departmentInfo, EDepartmentLoadingType.DepartmentSelect, _additional);
            }
        }
Example #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _departmentId = Body.GetQueryInt("DepartmentID");
            _returnUrl    = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));
            if (string.IsNullOrEmpty(_returnUrl))
            {
                _returnUrl = PageAdminDepartment.GetRedirectUrl(0);
            }

            if (IsPostBack)
            {
                return;
            }

            if (_departmentId == 0)
            {
                DdlParentId.Items.Add(new ListItem("<无上级部门>", "0"));

                var departmentIdList = DepartmentManager.GetDepartmentIdList();
                var count            = departmentIdList.Count;
                _isLastNodeArray = new bool[count];
                foreach (var theDepartmentId in departmentIdList)
                {
                    var departmentInfo = DepartmentManager.GetDepartmentInfo(theDepartmentId);
                    var listitem       = new ListItem(GetTitle(departmentInfo.Id, departmentInfo.DepartmentName, departmentInfo.ParentsCount, departmentInfo.IsLastNode), theDepartmentId.ToString());
                    DdlParentId.Items.Add(listitem);
                }
            }
            else
            {
                PhParentId.Visible = false;
            }

            if (_departmentId != 0)
            {
                var departmentInfo = DepartmentManager.GetDepartmentInfo(_departmentId);

                TbDepartmentName.Text     = departmentInfo.DepartmentName;
                TbCode.Text               = departmentInfo.Code;
                DdlParentId.SelectedValue = departmentInfo.ParentId.ToString();
                TbSummary.Text            = departmentInfo.Summary;
            }
        }