private void Fill_cmbPostsSearchResult_Posts(string SearchTerm) { string[] retMessage = new string[4]; try { IList <OrganizationUnit> orgUnitList = this.OrganizationPostBusiness.SearchOrganizationUnit(SearchTerm); foreach (OrganizationUnit orgUnitItem in orgUnitList) { ComboBoxItem orgUnitCmbItem = new ComboBoxItem(orgUnitItem.Name); orgUnitCmbItem.Id = orgUnitItem.ID.ToString(); OrganizationPostNodeValue orgPost = new OrganizationPostNodeValue(); orgPost.CustomCode = orgUnitItem.CustomCode; orgPost.ParentPath = orgUnitItem.ParentPath; orgPost.PersonnelCode = orgUnitItem.Person == null ? new Person().BarCode : orgUnitItem.Person.BarCode; orgPost.PersonnelID = orgUnitItem.PersonID.ToString(); orgPost.PersonnelName = orgUnitItem.Person == null ? new Person().Name : orgUnitItem.Person.Name; orgPost.ChildCount = orgUnitItem.ChildCount.ToString(); orgPost.ParentID = orgUnitItem.Parent != null?orgUnitItem.Parent.ID.ToString() : "0"; orgUnitCmbItem.Value = this.JsSerializer.Serialize(orgPost); this.cmbPostsSearchResult_Posts.Items.Add(orgUnitCmbItem); } } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_PostsSearchResult_Posts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_PostsSearchResult_Posts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_PostsSearchResult_Posts.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }
private void Fill_trvOrganizationPost_PersonnelSearch() { string imageUrl = "Images\\TreeView\\folder.gif"; string imagePath = "Images/TreeView/folder.gif"; string[] retMessage = new string[4]; try { this.InitializeCulture(); OrganizationUnit rootOrgPost = this.PersonnelSearchBusiness.GetOrganizationRoot(); TreeViewNode rootOrgPostNode = new TreeViewNode(); rootOrgPostNode.ID = rootOrgPost.ID.ToString(); string rootOrgPostNodeText = string.Empty; if (GetLocalResourceObject("OrgNode_trvOrganizationPost_PersonnelSearch") != null) { rootOrgPostNodeText = GetLocalResourceObject("OrgNode_trvOrganizationPost_PersonnelSearch").ToString(); } else { rootOrgPostNodeText = rootOrgPost.Name; } rootOrgPostNode.Text = rootOrgPostNodeText; OrganizationPostNodeValue rootOrgPostNodeValue = new OrganizationPostNodeValue(); rootOrgPostNodeValue.CustomCode = rootOrgPost.CustomCode; rootOrgPostNodeValue.ParentPath = string.Empty; rootOrgPostNodeValue.PersonnelName = string.Empty; rootOrgPostNodeValue.PersonnelCode = string.Empty; rootOrgPostNodeValue.PersonnelID = "0"; rootOrgPostNode.Value = this.JsSerializer.Serialize(rootOrgPostNodeValue); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl)) { rootOrgPostNode.ImageUrl = imagePath; } this.trvOrganizationPost_PersonnelSearch.Nodes.Add(rootOrgPostNode); IList <OrganizationUnit> OrganizationUnitChildList = this.PersonnelSearchBusiness.GetOrganizationChild(rootOrgPost.ID); foreach (OrganizationUnit childOrgPost in OrganizationUnitChildList) { TreeViewNode childOrgPostNode = new TreeViewNode(); childOrgPostNode.ID = childOrgPost.ID.ToString(); childOrgPostNode.Text = childOrgPost.Name; OrganizationPostNodeValue childOrgPostNodeValue = new OrganizationPostNodeValue(); childOrgPostNodeValue.CustomCode = childOrgPost.CustomCode; childOrgPostNodeValue.ParentPath = childOrgPost.ParentPath; childOrgPostNodeValue.PersonnelName = childOrgPost.Person != null ? childOrgPost.Person.Name : string.Empty; childOrgPostNodeValue.PersonnelCode = childOrgPost.Person != null ? childOrgPost.Person.PersonCode : string.Empty; childOrgPostNodeValue.PersonnelID = childOrgPost.Person != null?childOrgPost.Person.ID.ToString() : "0"; childOrgPostNode.Value = this.JsSerializer.Serialize(childOrgPostNodeValue); if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + imageUrl)) { childOrgPostNode.ImageUrl = imagePath; } childOrgPostNode.ContentCallbackUrl = "XmlOrganizationPostsLoadonDemand.aspx?ParentOrgPostID=" + childOrgPost.ID + "&LangID=" + this.LangProv.GetCurrentLanguage(); if (childOrgPost.ChildList.Count > 0) { childOrgPostNode.Nodes.Add(new TreeViewNode()); } rootOrgPostNode.Nodes.Add(childOrgPostNode); } if (OrganizationUnitChildList.Count > 0) { rootOrgPostNode.Expanded = true; } } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_OrganizationPost_PersonnelSearch.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_OrganizationPost_PersonnelSearch.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_OrganizationPost_PersonnelSearch.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }