/// <summary> /// Gets the valid time types for the matter. /// </summary> /// <param name="projectId">The project id.</param> private void GetTimeTypes(Guid projectId) { TimeServiceClient timeService = null; try { timeService = new TimeServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); TimeTypeSearchCriteria criteria = new TimeTypeSearchCriteria(); criteria.IncludeArchived = false; criteria.ProjectId = projectId; TimeTypeSearchReturnValue returnValue = timeService.TimeTypeSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.TimeTypes != null) { for (int i = 0; i < returnValue.TimeTypes.Rows.Length; i++) { ListItem item = new ListItem(); item.Text = returnValue.TimeTypes.Rows[i].Description.ToString(); item.Value = returnValue.TimeTypes.Rows[i].Id.ToString().Trim() + "$" + Convert.ToString(returnValue.TimeTypes.Rows[i].CatId); _ddlTimeType.Items.Add(item); } } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (timeService != null) { if (timeService.State != System.ServiceModel.CommunicationState.Faulted) { timeService.Close(); } } } }
/// <summary> /// Gets the valid time types for the matter. /// </summary> private void GetTimeTypes() { _ddlTimeType.Items.Clear(); if (_msAddTimeEntry.ProjectId != DataConstants.DummyGuid) { TimeServiceClient timeService = null; try { timeService = new TimeServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); TimeTypeSearchCriteria criteria = new TimeTypeSearchCriteria(); criteria.IncludeArchived = false; criteria.ProjectId = _msAddTimeEntry.ProjectId; TimeTypeSearchReturnValue returnValue = timeService.TimeTypeSearch(_logonId, collectionRequest, criteria); if (returnValue.Success) { for (int i = 0; i < returnValue.TimeTypes.Rows.Length; i++) { ListItem item = new ListItem(); item.Text = returnValue.TimeTypes.Rows[i].Description.ToString(); item.Value = returnValue.TimeTypes.Rows[i].Id.ToString().Trim() + "$" + Convert.ToString(returnValue.TimeTypes.Rows[i].CatId); _ddlTimeType.Items.Add(item); } //Dont set default time type if we have come back from additional details pg if (!_isLoadingLastSavedTimeEntry) { _ddlTimeType.SelectedIndex = -1; for (int i = 0; i < _ddlTimeType.Items.Count; i++) { if (GetValueOnIndexFromArray(_ddlTimeType.Items[i].Value, 0) == "3ef2937c-c31b-430c-82ed-5701a84f258e") { _ddlTimeType.Items[i].Selected = true; } } } else { TimeDetails timeDetails = (TimeDetails)Session[SessionName.TimeDetails]; _ddlTimeType.SelectedIndex = -1; for (int i = 0; i < _ddlTimeType.Items.Count; i++) { if (GetValueOnIndexFromArray(_ddlTimeType.Items[i].Value, 0) == timeDetails.TimeTypeId.ToString()) { _ddlTimeType.Items[i].Selected = true; } } } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (timeService != null) { if (timeService.State != System.ServiceModel.CommunicationState.Faulted) { timeService.Close(); } } } } }
/// <summary> /// Gets the valid time types for the matter. /// </summary> /// <param name="projectId">The project id.</param> private void GetTimeTypes(Guid projectId) { TimeServiceClient timeService = null; try { timeService = new TimeServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); TimeTypeSearchCriteria criteria = new TimeTypeSearchCriteria(); criteria.IncludeArchived = false; criteria.ProjectId = projectId; TimeTypeSearchReturnValue returnValue = timeService.TimeTypeSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.TimeTypes != null) { for (int i = 0; i < returnValue.TimeTypes.Rows.Length; i++) { ListItem item = new ListItem(); item.Text = returnValue.TimeTypes.Rows[i].Description.ToString(); item.Value = returnValue.TimeTypes.Rows[i].Id.ToString().Trim() + "$" + Convert.ToString(returnValue.TimeTypes.Rows[i].CatId); _ddlTimeType.Items.Add(item); } } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (timeService != null) { if (timeService.State != System.ServiceModel.CommunicationState.Faulted) timeService.Close(); } } }
/// <summary> /// Gets the valid time types for the matter. /// </summary> private void GetTimeTypes() { _ddlTimeType.Items.Clear(); if (_msAddTimeEntry.ProjectId != DataConstants.DummyGuid) { TimeServiceClient timeService = null; try { timeService = new TimeServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); TimeTypeSearchCriteria criteria = new TimeTypeSearchCriteria(); criteria.IncludeArchived = false; criteria.ProjectId = _msAddTimeEntry.ProjectId; TimeTypeSearchReturnValue returnValue = timeService.TimeTypeSearch(_logonId, collectionRequest, criteria); if (returnValue.Success) { for (int i = 0; i < returnValue.TimeTypes.Rows.Length; i++) { ListItem item = new ListItem(); item.Text = returnValue.TimeTypes.Rows[i].Description.ToString(); item.Value = returnValue.TimeTypes.Rows[i].Id.ToString().Trim() + "$" + Convert.ToString(returnValue.TimeTypes.Rows[i].CatId); _ddlTimeType.Items.Add(item); } //Dont set default time type if we have come back from additional details pg if (!_isLoadingLastSavedTimeEntry) { _ddlTimeType.SelectedIndex = -1; for (int i = 0; i < _ddlTimeType.Items.Count; i++) { if (GetValueOnIndexFromArray(_ddlTimeType.Items[i].Value, 0) == "3ef2937c-c31b-430c-82ed-5701a84f258e") { _ddlTimeType.Items[i].Selected = true; } } } else { TimeDetails timeDetails = (TimeDetails)Session[SessionName.TimeDetails]; _ddlTimeType.SelectedIndex = -1; for (int i = 0; i < _ddlTimeType.Items.Count; i++) { if (GetValueOnIndexFromArray(_ddlTimeType.Items[i].Value, 0) == timeDetails.TimeTypeId.ToString()) { _ddlTimeType.Items[i].Selected = true; } } } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (timeService != null) { if (timeService.State != System.ServiceModel.CommunicationState.Faulted) timeService.Close(); } } } }