private void BindTaskTypes() { DiaryServiceClient diaryService = null; try { diaryService = new DiaryServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; collectionRequest.StartRow = 0; collectionRequest.RowCount = 0; DiaryParameterReturnValue returnValue = new DiaryParameterReturnValue(); returnValue = diaryService.GetTaskTypes(_logonSettings.LogonId, collectionRequest); if (returnValue.Success) { _ddlType.DataSource = returnValue.DiaryParamters.Rows; _ddlType.DataTextField = "Description"; _ddlType.DataValueField = "Id"; _ddlType.DataBind(); if (_logonSettings.UserType == (int)DataConstants.UserType.Client || _logonSettings.UserType == (int)DataConstants.UserType.ThirdParty) { for (int i = 0; i < _ddlType.Items.Count - 1; i++) { if (_ddlType.Items[i].Text != "Standard Task") { _ddlType.Items.RemoveAt(i); } } _ddlType.Enabled = false; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (diaryService != null) { if (diaryService.State != System.ServiceModel.CommunicationState.Faulted) { diaryService.Close(); } } } }
public DiaryParameterReturnValue GetTaskTypes(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest) { DiaryParameterReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.GetTaskTypes(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest); } else { returnValue = new DiaryParameterReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public DiaryParameterReturnValue GetTaskTypes(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest) { DiaryParameterReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDiaryService = new DiaryService(); returnValue = oDiaryService.GetTaskTypes(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest); } else { returnValue = new DiaryParameterReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
private void BindTaskTypes() { DiaryServiceClient diaryService = null; try { diaryService = new DiaryServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; collectionRequest.StartRow = 0; collectionRequest.RowCount = 0; DiaryParameterReturnValue returnValue = new DiaryParameterReturnValue(); returnValue = diaryService.GetTaskTypes(_logonSettings.LogonId, collectionRequest); if (returnValue.Success) { _ddlType.DataSource = returnValue.DiaryParamters.Rows; _ddlType.DataTextField = "Description"; _ddlType.DataValueField = "Id"; _ddlType.DataBind(); if (_logonSettings.UserType == (int)DataConstants.UserType.Client || _logonSettings.UserType == (int)DataConstants.UserType.ThirdParty) { for (int i = 0; i < _ddlType.Items.Count - 1; i++) { if (_ddlType.Items[i].Text != "Standard Task") { _ddlType.Items.RemoveAt(i); } } _ddlType.Enabled = false; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (diaryService != null) { if (diaryService.State != System.ServiceModel.CommunicationState.Faulted) diaryService.Close(); } } }
public DiaryParameterReturnValue GetTaskTypes(Guid logonId, CollectionRequest collectionRequest) { DiaryParameterReturnValue returnValue = new DiaryParameterReturnValue(); 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 banks DataListCreator<DiaryParameterSearchItem> dataListCreator = new DataListCreator<DiaryParameterSearchItem>(); // Declare an inline event (annonymous delegate) to read the // dataset if it is required dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { DataSet dsTaskType = new DataSet(); DataColumn dcBookingTypeID = new DataColumn("BookingTypeID", typeof(System.Int32)); DataColumn dcBTDescription = new DataColumn("BTDescription"); DataTable dtTaskType = new DataTable(); dtTaskType.Columns.Add(dcBookingTypeID); dtTaskType.Columns.Add(dcBTDescription); DiaryParamsDts dts = SrvDiaryParameterLookup.GetDiaryParameter(); foreach (DiaryParamsDts.TaskTypesRow dr in dts.TaskTypes.Rows) { //if (!dr.CRDefault) { DataRow drNew = dtTaskType.NewRow(); drNew["BookingTypeID"] = dr.BookingTypeID; drNew["BTDescription"] = dr.BTDescription; dtTaskType.Rows.Add(drNew); } } dsTaskType.Tables.Add(dtTaskType); e.DataSet = dsTaskType; }; // Create the data list returnValue.DiaryParamters = dataListCreator.Create(logonId, // Give the query a name so it can be cached "TaskTypeSearch", // Tell it the query criteria used so if the cache is accessed // again it knows if it is the same query string.Empty, collectionRequest, // Import mappings to map the dataset row fields to the data // list entity properties new ImportMapping[] { new ImportMapping("Id", "BookingTypeID"), new ImportMapping("Description", "BTDescription") } ); } 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; }