private void Fill_trvReports_Reports(LoadSttate Ls, string SearchItem) { string[] retMessage = new string[4]; JavaScriptSerializer JsSerializer = new JavaScriptSerializer(); try { this.InitializeCulture(); IList <Report> reportsList = this.ReportBusiness.GetAllReports(); TreeViewNode rootRepGroupNode = new TreeViewNode(); Report rootRepGroup = reportsList.Where(x => x.ParentId == 0).FirstOrDefault(); if (rootRepGroup != null) { rootRepGroupNode.ID = rootRepGroup.ID.ToString(); string rootRepGroupNodeText = string.Empty; if (GetLocalResourceObject("ReportsNode_trvReports_Reports") != null) { rootRepGroupNodeText = GetLocalResourceObject("ReportsNode_trvReports_Reports").ToString(); } else { rootRepGroupNodeText = rootRepGroup.Name; } rootRepGroupNode.Text = rootRepGroupNodeText; TargetDetails targetDetails = new TargetDetails(); targetDetails.TargetType = TargetType.ReportGroup.ToString(); rootRepGroupNode.Value = JsSerializer.Serialize(targetDetails); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + PathHelper.GetModulePath_Nuke() + "Images\\TreeView\\group.png")) { rootRepGroupNode.ImageUrl = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/group.png"; } this.trvReports_Reports.Nodes.Add(rootRepGroupNode); rootRepGroupNode.Expanded = true; switch (Ls) { case LoadSttate.Normal: this.GetChildItem_trvReports_Reports(rootRepGroupNode, rootRepGroup, reportsList); break; case LoadSttate.Search: if (!string.IsNullOrEmpty(SearchItem)) { this.GetChildItem_trvReports_Reports(rootRepGroupNode, rootRepGroup, reportsList.Where(c => c.Name.Contains(SearchItem) || c.IsReport == false).ToList()); } else { this.GetChildItem_trvReports_Reports(rootRepGroupNode, rootRepGroup, reportsList); } break; } } } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_Reports.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_Reports.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_Reports.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }
/// <summary> ///پر کردن درخت گروه های قوانین /// </summary> private void Fill_trvRulesGroup_RulesGroup(LoadSttate Ls, string SearchItem) { string imageUrl = PathHelper.GetModulePath_Nuke() + "Images\\TreeView\\folder.gif"; string imagePath = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/folder.gif"; string groupImageUrl = PathHelper.GetModulePath_Nuke() + "Images\\TreeView\\group.png"; string groupImagePath = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/group.png"; string[] retMessage = new string[4]; this.InitializeCulture(); try { IList <RuleCategory> rulesGroupList = this.RulesGroupBusiness.GetAll(); RuleCategory rootRuleGroup = this.RulesGroupBusiness.GetRoot(); TreeViewNode rootRuleGroupNode = new TreeViewNode(); rootRuleGroupNode.ID = rootRuleGroup.ID.ToString(); string rootRuleGroupNodeText = string.Empty; if (GetLocalResourceObject("RulesGroupsNode_trvRulesGroup_RulesGroup") != null) { rootRuleGroupNodeText = GetLocalResourceObject("RulesGroupsNode_trvRulesGroup_RulesGroup").ToString(); } else { rootRuleGroupNodeText = rootRuleGroup.Name; } rootRuleGroupNode.Text = rootRuleGroupNodeText; rootRuleGroupNode.Value = rootRuleGroup.Discription; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + groupImageUrl)) { rootRuleGroupNode.ImageUrl = groupImagePath; } this.trvRulesGroup_RulesGroup.Nodes.Add(rootRuleGroupNode); //foreach (RuleCategory childRuleCategory in rootRuleGroup.ChildList) //{ // TreeViewNode childRuleCategoryNode = new TreeViewNode(); // childRuleCategoryNode.ID = childRuleCategory.ID.ToString(); // childRuleCategoryNode.Text = childRuleCategory.Name; // childRuleCategoryNode.Value = childRuleCategory.Discription; // if ( childRuleCategory.IsGroup==false && File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl)) // childRuleCategoryNode.ImageUrl = imagePath; // if (childRuleCategory.IsGroup == true && File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl)) // childRuleCategoryNode.ImageUrl = groupImagePath; // rootRuleGroupNode.Nodes.Add(childRuleCategoryNode); //} switch (Ls) { case LoadSttate.Normal: // برگرداندن فرزندان بدون جستجو this.GetChildItem_trvRulesGroup_RulesGroup(rootRuleGroupNode, rootRuleGroup, rulesGroupList); break; case LoadSttate.Search: // برگرداندن فرزندان با جستجو if (!string.IsNullOrEmpty(SearchItem)) { this.GetChildItem_trvRulesGroup_RulesGroup(rootRuleGroupNode, rootRuleGroup, rulesGroupList.Where(c => c.Name.Contains(SearchItem) || c.IsGroup == true).ToList()); } else { this.GetChildItem_trvRulesGroup_RulesGroup(rootRuleGroupNode, rootRuleGroup, rulesGroupList); } break; } if (rootRuleGroup.ChildList.Count > 0) { rootRuleGroupNode.Expanded = true; } } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_RulesGroup.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_RulesGroup.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_RulesGroup.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }
private void GetDataAccessLevelsRoot_MultiLevelsDataAccessLevels(ComponentArt.Web.UI.TreeView trvDataAccessLevels, DataAccessLevelsType Dalt, DataAccessParts DataAccessLevelKey, DataAccessLevelOperationType?Dalot, DataAccessLevelOperationState?Dalos, decimal UserID, UserSearchKeys?SearchKey, string UserSearchTerm, LoadSttate Ls, string SearchItem) { DataAccessProxy rootDals = null; string rootDalsNodeText = string.Empty; if (Dalot == DataAccessLevelOperationType.Group && Dalos == DataAccessLevelOperationState.After) { UserID = BUser.CurrentUser.ID; } switch (DataAccessLevelKey) { case DataAccessParts.Department: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetDepartmentRoot(Dalt, UserID); if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; case DataAccessParts.OrganizationUnit: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetOrganizationRoot(Dalt, UserID); if (GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("OrgNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; case DataAccessParts.Report: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetReportRoot(Dalt, UserID); if (GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("ReportsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; case DataAccessParts.RuleGroup: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetRuleRoot(Dalt, UserID); if (GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("RulesGroupsNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; case DataAccessParts.Role: rootDals = this.MultiLevelsDataAccessLevelesBusiness.GetRoleRoot(Dalt, UserID); if (GetLocalResourceObject("RolesNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels") != null) { rootDalsNodeText = GetLocalResourceObject("RolesNode_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels").ToString(); } else { rootDalsNodeText = rootDals.Name; } break; } TreeViewNode rootDalsNode = new TreeViewNode(); rootDalsNode.ID = rootDals.ID.ToString(); rootDalsNode.Text = rootDalsNodeText; rootDalsNode.Value = rootDals.DeleteEnable.ToString().ToLower(); string ImagePath = string.Empty; string ImageUrl = string.Empty; if (rootDals.DeleteEnable) { if (DataAccessLevelKey != DataAccessParts.Report) { ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\folder_blue.gif"; ImageUrl = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/folder_blue.gif"; } else { ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\group.png"; ImageUrl = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/group.png"; } } else { if (DataAccessLevelKey != DataAccessParts.Report) { ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\folder.gif"; ImageUrl = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/folder.gif"; } else { ImagePath = PathHelper.GetModulePath_Nuke() + "\\Images\\TreeView\\group_silver.png"; ImageUrl = PathHelper.GetModuleUrl_Nuke() + "Images/TreeView/group_silver.png"; } } if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImagePath)) { rootDalsNode.ImageUrl = ImageUrl; } trvDataAccessLevels.Nodes.Add(rootDalsNode); rootDalsNode.Expanded = true; switch (Ls) { case LoadSttate.Search: switch (Dalot) { case DataAccessLevelOperationType.Single: this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, null, UserID, SearchKey, string.Empty, rootDalsNode, rootDals, SearchItem); break; case DataAccessLevelOperationType.Group: switch (Dalos) { case DataAccessLevelOperationState.Before: break; case DataAccessLevelOperationState.After: this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals, SearchItem); break; } break; default: if (Dalt == DataAccessLevelsType.Source) { this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals, SearchItem); } break; } break; case LoadSttate.Normal: switch (Dalot) { case DataAccessLevelOperationType.Single: this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, null, UserID, SearchKey, string.Empty, rootDalsNode, rootDals); break; case DataAccessLevelOperationType.Group: switch (Dalos) { case DataAccessLevelOperationState.Before: break; case DataAccessLevelOperationState.After: this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals); break; } break; default: if (Dalt == DataAccessLevelsType.Source) { this.GetChildDataAccessLevels_MultiLevelsDataAccessLevels(Dalt, DataAccessLevelKey, Dalot, UserID, SearchKey, UserSearchTerm, rootDalsNode, rootDals); } break; } break; } }
private void Fill_trvDataAccessLevelsTarget_MultiLevelsDataAccessLevels(decimal UserID, DataAccessParts DataAccessLevelKey, DataAccessLevelOperationType Dalot, DataAccessLevelOperationState Dalos, UserSearchKeys?UserSearchKey, string UserSearchTerm, LoadSttate Ls, string SearchItem) { string[] retMessage = new string[4]; try { this.GetDataAccessLevelsRoot_MultiLevelsDataAccessLevels(trvDataAccessLevelsTarget_MultiLevelsDataAccessLevels, DataAccessLevelsType.Target, DataAccessLevelKey, Dalot, Dalos, UserID, UserSearchKey, UserSearchTerm, Ls, SearchItem); } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_DataAccessLevelsTarget.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_DataAccessLevelsTarget.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_DataAccessLevelsTarget.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }
private void Fill_trvDataAccessLevelsSource_MultiLevelsDataAccessLevels(DataAccessParts DataAccessLevelKey, LoadSttate Ls, string SearchItem) { string[] retMessage = new string[4]; try { this.GetDataAccessLevelsRoot_MultiLevelsDataAccessLevels(trvDataAccessLevelsSource_MultiLevelsDataAccessLevels, DataAccessLevelsType.Source, DataAccessLevelKey, null, null, -1, null, string.Empty, Ls, SearchItem); } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_DataAccessLevelsSource.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_DataAccessLevelsSource.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_DataAccessLevelsSource.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }