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(); } } } }
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(); } } }