//ERACategoryForInf public FormOptionsSettingViewModel.ERACategoryForInfListResult getERACategoryForInfListResult(FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param) { FormOptionsSettingViewModel.ERACategoryForInfListResult ret = new FormOptionsSettingViewModel.ERACategoryForInfListResult(); try { ret.success = true; ret.resultCode = "200"; Tuple <List <ERACategoryForInf>, int> tuple_list = this.formOptionSettingDao.getERACategoryForInfList(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 void btn_formClassSettingForInfoSystemApply_add_Click(object sender, EventArgs e) { this.lt_akert_msg.Text = ""; //新增時判斷DB是否有此項資料(目前作法判斷項目名稱,只要名稱重複.一律不能新增(已存在).即使是同名稱不同人不同層級) FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter param = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter() { desc = true, orderField = "Id", pageIndex = 1, pageSize = int.MaxValue, personnelID = this.hid_formClassSettingForInfoSystemApply_personnelID.Value, name = this.txt_formClassSettingForInfoSystemApply_className.Text.ToString().Trim(), departmentID = this.hid_departmentID.Value, dicisionProcessLevel = this.ddl_formClassSettingForInfoSystemApply_dicisionProcessLevel.SelectedValue }; FormOptionsSettingViewModel.ERACategoryForInfListResult list_ret = this.formOptSvc.getERACategoryForInfListResult(param); if (list_ret.count > 0) { this.lt_akert_msg.Text = UtilitySvc.alertMsg("此類別已存在"); return; } //新增ERACategoryForInf項目作法 long pID = 0; if (this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue == "-") { pID = -1;//代表父類別 } else { pID = long.Parse(this.ddl_formClassSettingForInfoSystemApply_parentID.SelectedValue);//子類別parentID欄位抓取父類別ID } ERACategoryForInf ec = new ERACategoryForInf() { parentID = pID, name = this.txt_formClassSettingForInfoSystemApply_className.Text, departmentID = this.hid_departmentID.Value, personnelID = this.hid_formClassSettingForInfoSystemApply_personnelID.Value, dicisionProcessLevel = this.ddl_formClassSettingForInfoSystemApply_dicisionProcessLevel.SelectedValue, deleted = false, DateCreated = DateTime.Now, addActivityPersonnelID = this.hid_formClassSettingForInfoSystemApply_ActivityPersonnelID.Value }; FormOptionsSettingViewModel.ERACategoryForInfResult add_ret_ERAC = this.formOptSvc.addERACategoryForInf(ec); //新增ERAPermissionForInf項目作法 long iERACategoryID = ec.Id; //ERAPermissionForInf.ERACategoryID bool bIsforAll = true; if (this.ddl_formClassSettingForInfoSystemApply_isforAll.SelectedValue == "0") { bIsforAll = false; } ERAPermissionForInf ep = new ERAPermissionForInf() { ERACategoryID = iERACategoryID, isforAll = bIsforAll, enable = true, departmentID = this.ddl_PermissionDepartmentID.SelectedValue, deleted = false, DateCreated = DateTime.Now }; FormOptionsSettingViewModel.ERAPermissionForInfResult add_ret_ERAP = this.formOptSvc.addERAPermissionForInf(ep); if (add_ret_ERAC.success || add_ret_ERAP.success) { this.lt_akert_msg.Text = UtilitySvc.alertMsg("新增成功"); } else { this.lt_akert_msg.Text = UtilitySvc.alertMsg(add_ret_ERAC.resultException) + UtilitySvc.alertMsg(add_ret_ERAP.resultException); } this.reload(); }
//View_advanced控制項 protected void AdvancedInit() { var pID = Request.QueryString["pID"] as string; this.hid_ViewAdvanced_PersonnelID.Value = string.IsNullOrEmpty(pID) ? "" : HttpUtility.UrlDecode(pID);//處理人員 var spID = Request.QueryString["spID"] as string; this.hid_ViewAdvanced_ActivityPersonnelID.Value = string.IsNullOrEmpty(spID) ? "" : HttpUtility.UrlDecode(spID);//加簽人員 FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter View_advanced_forDLL = new FormOptionsSettingViewModel.FormClassSettingForInfoSystemApplyQueryParameter { desc = true, orderField = "Id", pageIndex = 1, pageSize = int.MaxValue, id = int.Parse(query_id) }; //主類別 FormOptionsSettingViewModel.ERACategoryForInfListResult View_advanced_retERAC = this.formOptSvc.getERACategoryForInfMainClassListResult(View_advanced_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 View_advanced_retERAC.list) { view_list_parentID.Add(new ListItem() { Text = v.name, Value = v.Id.ToString() }); } this.ddl_ViewAdvanced_PartentID.DataValueField = "Value"; this.ddl_ViewAdvanced_PartentID.DataTextField = "Text"; this.ddl_ViewAdvanced_PartentID.DataSource = view_list_parentID; this.ddl_ViewAdvanced_PartentID.DataBind(); //部門單位 FormOptionsSettingViewModel.OrganizationUnitListResult View_advanced_retOrgUnit = this.formOptSvc.getOrganizationUnitListResult(View_advanced_forDLL); //List<ListItem> view_list_departmentID = new List<ListItem>(); //view_list_departmentID.Add(new ListItem() { Text = "- 請選擇 -", Value = "" }); //foreach (var v in View_advanced_retOrgUnit.list) { // view_list_departmentID.Add(new ListItem() { Text = v.organizationUnitName, Value = v.id }); //} //this.ddl_ViewAdvanced_DepartmentID.DataValueField = "Value"; //this.ddl_ViewAdvanced_DepartmentID.DataTextField = "Text"; //this.ddl_ViewAdvanced_DepartmentID.DataSource = view_list_departmentID; //this.ddl_ViewAdvanced_DepartmentID.DataBind(); //改作所屬部門方式 this.ddl_departmentID_listItem = new List <ListItem>(); this.ddl_departmentID_listItem.Add(new ListItem() { Text = "- 請輸入部門名稱 -", Value = "" }); List <FormOptionsSettingViewModel.departmentLight> depList = this.formOptSvc.getDepList(); foreach (var c in depList) { this.ddl_departmentID_listItem.Add(new ListItem() { Text = c.organizationUnitName + " - (" + c.id + ")", Value = c.id }); } this.ddl_ViewAdvanced_DepartmentID.DataSource = this.ddl_departmentID_listItem; this.ddl_ViewAdvanced_DepartmentID.DataBind(); //隱藏處理單位對應處理人員 FormOptionsSettingViewModel.ViewERAUsersOrganizationUnitDepartmentListResult list_retViewERA = this.formOptSvc.getViewERAUsersOrganizationUnitDepartmentListResult(View_advanced_forDLL); List <ListItem> view_list_hid_departmentID = new List <ListItem>(); view_list_hid_departmentID.Add(new ListItem() { Text = "- 請選擇 -", Value = "" }); foreach (var v in list_retViewERA.list) { view_list_hid_departmentID.Add(new ListItem() { Text = v.OUName + " - (" + v.OUID + ")", Value = v.ID }); //view_list_hid_departmentID.Add(new ListItem() { Text = v.OUName, Value = v.ID }); } this.hid_ddl_ViewAdvanced_DepartmentID.DataValueField = "Value"; this.hid_ddl_ViewAdvanced_DepartmentID.DataTextField = "Text"; this.hid_ddl_ViewAdvanced_DepartmentID.DataSource = view_list_hid_departmentID; this.hid_ddl_ViewAdvanced_DepartmentID.DataBind(); //權限單位控制項 List <ListItem> view_list_PermissionDepartmentID = new List <ListItem>(); view_list_PermissionDepartmentID.Add(new ListItem() { Text = "- 請選擇 -", Value = "" }); foreach (var v in View_advanced_retOrgUnit.list) { view_list_PermissionDepartmentID.Add(new ListItem() { Text = v.organizationUnitName, Value = v.id }); } this.ddl_ViewAdvanced_PermissionDepartmentID.DataValueField = "Value"; this.ddl_ViewAdvanced_PermissionDepartmentID.DataTextField = "Text"; this.ddl_ViewAdvanced_PermissionDepartmentID.DataSource = view_list_PermissionDepartmentID; this.ddl_ViewAdvanced_PermissionDepartmentID.DataBind(); //顯示額外欄位 FormOptionsSettingViewModel.ERADynamicFieldSettingListResult View_advanced_setDynamicField = this.formOptSvc.getERADynamicFieldSettingListResult(View_advanced_forDLL); List <ListItem> view_list_DynamicField_text = new List <ListItem>(); List <ListItem> view_list_DynamicField_temp = new List <ListItem>(); foreach (var v in View_advanced_setDynamicField.list) { string sname = v.isRequire == true ? "*" + v.name : v.name; if (v.type == "text") { view_list_DynamicField_text.Add(new ListItem() { Text = sname, Value = v.Id.ToString() }); } } this.ckl_DisplayOtherField.Items.Clear(); this.ckl_DisplayOtherField.Items.AddRange(view_list_DynamicField_text.ToArray()); //批次範本下載 foreach (var v in View_advanced_setDynamicField.list) { if (v.type == "fileDownloadBtn") { view_list_DynamicField_temp.Add(new ListItem() { Text = v.name + "(" + v.memo + ")", Value = v.Id.ToString() }); } } this.chk_TemplateDownload.Items.Clear(); this.chk_TemplateDownload.Items.AddRange(view_list_DynamicField_temp.ToArray()); //本頁所點選資料 FormOptionsSettingViewModel.ViewERACategoryPermissionDynamicFieldSettingForInfListResult View_advanced_data = this.formOptSvc.getViewERACategoryPermissionDynamicFieldSettingForInfListResult(View_advanced_forDLL); this.lblAdvancedID.Text = string.IsNullOrEmpty(View_advanced_data.list[0].Id.ToString()) ? "" : View_advanced_data.list[0].Id.ToString(); //ID this.txt_ViewAdvanced_ClassName.Text = string.IsNullOrEmpty(View_advanced_data.list[0].name) ? "" : View_advanced_data.list[0].name.ToString(); //類別名稱 this.ddl_ViewAdvanced_PartentID.SelectedValue = View_advanced_data.list[0].parentID == -1 ? "-" : View_advanced_data.list[0].parentID.ToString(); //主類別 this.ddl_ViewAdvanced_DepartmentID.SelectedValue = string.IsNullOrEmpty(View_advanced_data.list[0].departmentID) ? "" : this.ddl_ViewAdvanced_DepartmentID.Items.FindByValue(View_advanced_data.list[0].departmentID.ToString()).Value; //部門名稱 this.hid_ViewAdvanced_departmentID.Value = string.IsNullOrEmpty(View_advanced_data.list[0].departmentID) ? "" : this.ddl_ViewAdvanced_DepartmentID.Items.FindByValue(View_advanced_data.list[0].departmentID.ToString()).Value; //部門名稱 this.ddl_ViewAdvanced_DicisionProcessLevel.SelectedValue = string.IsNullOrEmpty(View_advanced_data.list[0].dicisionProcessLevel) ? "" : View_advanced_data.list[0].dicisionProcessLevel.ToString(); //核決層級 this.ddl_ViewAdvanced_IsforAll.SelectedValue = View_advanced_data.list[0].isforAll == true ? "1" : "0"; //適用全部門 this.ddl_ViewAdvanced_PermissionDepartmentID.SelectedValue = string.IsNullOrEmpty(View_advanced_data.list[0].Permission_departmentID) ? "" : this.ddl_ViewAdvanced_PermissionDepartmentID.Items.FindByValue(View_advanced_data.list[0].Permission_departmentID.ToString()).Value; //權限單位 //額外動態欄位 if (View_advanced_data.list[0].CDF_ID_T != null) { var gCDF_ID_T = View_advanced_data.list[0].CDF_ID_T.Split(','); for (var i = 0; i < gCDF_ID_T.Count(); i++) { this.ckl_DisplayOtherField.Items.FindByValue(gCDF_ID_T[i]).Selected = true; this.lbl_cklValues.Text += gCDF_ID_T[i].ToString(); } } //範本下載 if (View_advanced_data.list[0].CDF_ID_B != null) { var gCDF_ID_B = View_advanced_data.list[0].CDF_ID_B.Split(','); for (var i = 0; i < gCDF_ID_B.Count(); i++) { this.chk_TemplateDownload.Items.FindByValue(gCDF_ID_B[i]).Selected = true; this.lbl_cklValues.Text += gCDF_ID_B[i].ToString(); } } }
/// <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 = ""; }