protected void ddl_formClassSettingForInfoSystemApply_Change(object sender, EventArgs e)
        {
            FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param_forDLL = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter {
                desc       = true,
                orderField = "Id",
                pageIndex  = 1,//當換頁時下拉資料會沒有出現,將param.pageIndex固定為1
                pageSize   = int.MaxValue,
            };

            //權限單位控制項
            List <ListItem> view_list_PermissionDepartmentID = new List <ListItem>();

            view_list_PermissionDepartmentID.Add(new ListItem()
            {
                Text = "- 請選擇 -", Value = ""
            });

            FormOptionsSettingViewModel.OrganizationUnitListResult   list_retOrgUnit = this.formOptSvc.getOrganizationUnitListResult(param_forDLL);
            FormOptionsSettingViewModel.ClassificationUnitListResult unitRet         = this.formOptSvc.getPurviewUnitByParentID(this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue);

            if (this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue != "" && this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue != "-" && unitRet.list[0].isforAll == false)
            {
                var unit = unitRet.list[0].unit.Split(',');

                if (unit.Length > 0)
                {
                    for (var i = 0; i < unit.Length; i++)
                    {
                        var list_test = list_retOrgUnit.list.FindAll(x => x.OID == unit[i]);

                        foreach (var v in list_test)
                        {
                            view_list_PermissionDepartmentID.Add(new ListItem()
                            {
                                Text = v.organizationUnitName, Value = v.id
                            });
                        }
                    }
                }
            }
            else
            {
                foreach (var v in list_retOrgUnit.list)
                {
                    view_list_PermissionDepartmentID.Add(new ListItem()
                    {
                        Text = v.organizationUnitName, Value = v.id
                    });
                }
            }

            this.ddl_PermissionDepartmentID.DataValueField = "Value";
            this.ddl_PermissionDepartmentID.DataTextField  = "Text";

            this.ddl_PermissionDepartmentID.DataSource = view_list_PermissionDepartmentID;
            this.ddl_PermissionDepartmentID.DataBind();
        }
예제 #2
0
        //2016/08/19 Stephen Add 主類別整合
        public FormOptionsSettingViewModel.ClassificationUnitListResult getPurviewUnitByParentID(string parentID)
        {
            FormOptionsSettingViewModel.ClassificationUnitListResult ret = new FormOptionsSettingViewModel.ClassificationUnitListResult();

            try {
                var list = this.formOptionSettingDao.getPurviewUnitByParentID(parentID);
                ret.list       = list;
                ret.success    = true;
                ret.resultCode = "200";
            } catch (Exception ex) {
                ret.success         = false;
                ret.resultCode      = "500";
                ret.resultException = ex.ToString();
            }


            return(ret);
        }