/// <summary> /// /// </summary> /// <param name="oHostSecurityToken"></param> /// <param name="collectionRequest"></param> /// <param name="criteria"></param> /// <returns></returns> public BranchSearchReturnValue BranchSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest) { BranchSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oBranchDeptService = new BranchDeptService(); returnValue = oBranchDeptService.BranchSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest); } else { returnValue = new BranchSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
/// <summary> /// /// </summary> /// <param name="oHostSecurityToken"></param> /// <param name="collectionRequest"></param> /// <param name="criteria"></param> /// <returns></returns> public BranchSearchReturnValue BranchSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest) { BranchSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oBranchDeptService = new BranchDeptService(); returnValue = oBranchDeptService.BranchSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest); } else { returnValue = new BranchSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
private void BindBranchDropDownList() { BranchDeptServiceClient branchSearch = null; try { CollectionRequest collectionRequest = new CollectionRequest(); branchSearch = new BranchDeptServiceClient(); BranchSearchReturnValue returnValue = branchSearch.BranchSearch(_logonSettings.LogonId, collectionRequest); if (returnValue.Success) { _ddlBranch.Items.Clear(); foreach (BranchSearchItem branch in returnValue.Branches.Rows) { ListItem item = new ListItem(); item.Text = branch.Name; item.Value = branch.Reference.Trim() + "$" + branch.OrganisationId.ToString(); _ddlBranch.Items.Add(item); } AddDefaultToDropDownList(_ddlBranch, "All Branch"); } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (branchSearch != null) { if (branchSearch.State != System.ServiceModel.CommunicationState.Faulted) { branchSearch.Close(); } } } }
/// <summary> /// /// </summary> /// <param name="logonId"></param> /// <param name="collectionRequest"></param> /// <param name="criteria"></param> /// <returns></returns> public BranchSearchReturnValue BranchSearch(Guid logonId, CollectionRequest collectionRequest) { BranchSearchReturnValue returnValue = new BranchSearchReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: // Can do everything break; default: throw new Exception("Access denied"); } // Create a data list creator for a list of matters DataListCreator<BranchSearchItem> dataListCreator = new DataListCreator<BranchSearchItem>(); // Declare an inline event (annonymous delegate) to read the // dataset if it is required dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { // Create the dataset //e.DataSet = service layer routine to do the query e.DataSet = SrvBranchLookup.GetBranchLookup(); DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "OrgName"); e.DataSet.Tables.Remove(e.DataSet.Tables[0]); e.DataSet.Tables.Add(dt); foreach (DataRow r in e.DataSet.Tables[0].Rows) { r["branchRef"] = r["branchRef"].ToString().Trim(); r["OrgName"] = r["branchRef"].ToString().Trim() + " - " + r["OrgName"]; } }; // Create the data list returnValue.Branches = dataListCreator.Create(logonId, // Give the query a name so it can be cached "BranchSearch", // Tell it the query criteria used so if the cache is accessed // again it knows if it is the same query null, collectionRequest, // Import mappings to map the dataset row fields to the data // list entity properties new ImportMapping[] { new ImportMapping("OrganisationId", "OrgID"), new ImportMapping("Reference", "branchRef"), new ImportMapping("Name", "OrgName"), new ImportMapping("IsLondonRate", "branchLondonRate") } ); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception Ex) { returnValue.Success = false; returnValue.Message = Ex.Message; } return returnValue; }
/// <summary> /// /// </summary> /// <param name="logonId"></param> /// <param name="collectionRequest"></param> /// <param name="criteria"></param> /// <returns></returns> public BranchSearchReturnValue BranchSearch(Guid logonId, CollectionRequest collectionRequest) { BranchSearchReturnValue returnValue = new BranchSearchReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: // Can do everything break; default: throw new Exception("Access denied"); } // Create a data list creator for a list of matters DataListCreator <BranchSearchItem> dataListCreator = new DataListCreator <BranchSearchItem>(); // Declare an inline event (annonymous delegate) to read the // dataset if it is required dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { // Create the dataset //e.DataSet = service layer routine to do the query e.DataSet = SrvBranchLookup.GetBranchLookup(); DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], "OrgName"); e.DataSet.Tables.Remove(e.DataSet.Tables[0]); e.DataSet.Tables.Add(dt); foreach (DataRow r in e.DataSet.Tables[0].Rows) { r["branchRef"] = r["branchRef"].ToString().Trim(); r["OrgName"] = r["branchRef"].ToString().Trim() + " - " + r["OrgName"]; } }; // Create the data list returnValue.Branches = dataListCreator.Create(logonId, // Give the query a name so it can be cached "BranchSearch", // Tell it the query criteria used so if the cache is accessed // again it knows if it is the same query null, collectionRequest, // Import mappings to map the dataset row fields to the data // list entity properties new ImportMapping[] { new ImportMapping("OrganisationId", "OrgID"), new ImportMapping("Reference", "branchRef"), new ImportMapping("Name", "OrgName"), new ImportMapping("IsLondonRate", "branchLondonRate") } ); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception Ex) { returnValue.Success = false; returnValue.Message = Ex.Message; } return(returnValue); }