Пример #1
0
        //ViewERACategoryPermissionForInf
        public FormOptionsSettingViewModel.ViewERACategoryPermissionForInfListResult getViewERACategoryPermissionForInfListResult(FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param)
        {
            FormOptionsSettingViewModel.ViewERACategoryPermissionForInfListResult ret = new FormOptionsSettingViewModel.ViewERACategoryPermissionForInfListResult();

            try
            {
                ret.success    = true;
                ret.resultCode = "200";
                Tuple <List <ViewERACategoryPermissionForInf>, int> tuple_list = this.formOptionSettingDao.getViewERACategoryPermissionForInfList(param);
                ret.list  = tuple_list.Item1;
                ret.count = tuple_list.Item2;
            }
            catch (Exception ex)
            {
                ret.success         = false;
                ret.resultException = ex.ToString();
                ret.resultCode      = "500";
            }

            return(ret);
        }
        //判斷主類別底下是否有子類別
        protected int checkSubClassCount(string sName)
        {
            FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter()
            {
                desc       = true,
                orderField = "Id",
                pageIndex  = 1,
                pageSize   = int.MaxValue,
                name       = sName,
                keyword    = "",
                classType  = 0,
            };

            FormOptionsSettingViewModel.ViewERACategoryPermissionForInfListResult list_ret = this.formOptSvc.getViewERACategoryPermissionForInfListResult(param);

            if (list_ret.count > 0)
            {
                return(list_ret.count);
            }
            else
            {
                return(0);
            }
        }
        /// <summary>
        /// 重載列表
        /// </summary>
        protected void reload()
        {
            this.lt_akert_msg.Text = "";

            int pg_int = 1;

            int.TryParse(pg_str, out pg_int);
            int pageSize = 15;

            var sKeyword = Request.QueryString["k"] as string;

            sKeyword = string.IsNullOrEmpty(sKeyword) ? "" : HttpUtility.UrlDecode(sKeyword);

            var sclassType = Request.QueryString["c"] as string;

            sclassType = string.IsNullOrEmpty(sclassType) ? "0" : sclassType;

            //判斷是否有點選過查詢類別當條件,有的話將查詢條件設定為預設
            if (!string.IsNullOrEmpty(sKeyword))
            {
                this.txt_formClassSettingForInfoSystemApply_className_search_keyword.Text = sKeyword;
            }

            //因為主類別刪除時,會更新DB必須重新Reload.所以移至此處
            FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param_forDLL = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter {
                desc       = true,
                orderField = "Id",
                pageIndex  = 1,
                pageSize   = int.MaxValue,
            };
            //主類別
            FormOptionsSettingViewModel.ERACategoryForInfListResult list_retERAC = this.formOptSvc.getERACategoryForInfMainClassListResult(param_forDLL);

            List <ListItem> view_list_parentID = new List <ListItem>();

            view_list_parentID.Add(new ListItem()
            {
                Text = "- 請選擇 -", Value = ""
            });
            view_list_parentID.Add(new ListItem()
            {
                Text = "無主類別", Value = "-"
            });

            foreach (var v in list_retERAC.list)
            {
                view_list_parentID.Add(new ListItem()
                {
                    Text = v.name, Value = v.Id.ToString()
                });
            }

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

            this.ddl_formClassSettingForInfoSystemApply_parentID.DataSource = view_list_parentID;
            this.ddl_formClassSettingForInfoSystemApply_parentID.DataBind();


            //主類別(搜尋)
            List <ListItem> view_list_mainClass = new List <ListItem>();

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

            foreach (var v in list_retERAC.list)
            {
                view_list_mainClass.Add(new ListItem()
                {
                    Text = v.name, Value = v.Id.ToString()
                });
            }

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

            this.ddl_formClassSettingForInfoSystemApply_mainClass.DataSource = view_list_mainClass;
            this.ddl_formClassSettingForInfoSystemApply_mainClass.DataBind();
            //主類別搜尋移至此處
            if (sclassType != "0")
            {
                ddl_formClassSettingForInfoSystemApply_mainClass.SelectedIndex = ddl_formClassSettingForInfoSystemApply_mainClass.Items.IndexOf(ddl_formClassSettingForInfoSystemApply_mainClass.Items.FindByValue(sclassType));
                if (ddl_formClassSettingForInfoSystemApply_mainClass.SelectedIndex == 0)
                {
                    sclassType = "0";
                }
            }

            //表單資料
            FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter {
                desc       = true,
                orderField = "Id",
                pageIndex  = pg_int,
                pageSize   = pageSize,
                keyword    = sKeyword,
                classType  = int.Parse(sclassType)
            };

            FormOptionsSettingViewModel.ViewERACategoryPermissionForInfListResult list_ret = this.formOptSvc.getViewERACategoryPermissionForInfListResult(param);

            List <page_ERACategoryForInfList> view_list = new List <page_ERACategoryForInfList>();

            foreach (var v in list_ret.list)
            {
                view_list.Add(new page_ERACategoryForInfList(v));
            }

            this.rpt_formClassSettingForInfoSystemApply_list.DataSource = view_list;
            this.rpt_formClassSettingForInfoSystemApply_list.DataBind();

            this.component_pager.queryString  = "pg";
            this.component_pager.pageSize     = pageSize;
            this.component_pager.showPageItem = 5;
            this.component_pager.currentPage  = pg_int;
            this.component_pager.count        = list_ret.count;
            this.component_pager.load();
            this.component_pager.DataBind();

            //清空或預設值
            this.ddl_departmentID.SelectedValue = "";
            this.hid_departmentID.Value         = "";
            this.txt_formClassSettingForInfoSystemApply_className.Text                     = "";
            this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue             = "";
            this.ddl_formClassSettingForInfoSystemApply_dicisionProcessLevel.SelectedValue = "";
            this.ddl_formClassSettingForInfoSystemApply_isforAll.SelectedValue             = "";
            this.ddl_PermissionDepartmentID.SelectedValue = "";
        }