/// <summary> /// Load no complete object. /// </summary> /// <param name="parent"></param> protected virtual void Load(Persistent parent) { if (parent == null || parent.IsDefault) { return; } if (!parent.isCompleted && parent.oid.HasValue) { if (parent.DataFilter == null) { parent.DataFilter = new BrowserDataFilter(); parent.DataFilter.groupOid = parent.oid.Value; parent.DataFilter.page = 0; parent.DataFilter.pageSize = PAGE_SIZE; } if (parent is PeriodName) { PeriodName period = (PeriodName)parent; ForgetDefaultItems(period); period.DataFilter.page++; BrowserDataPage <PeriodInterval> page = this.Service.getRootIntervalsByPeriodName(period.DataFilter); period.intervalListChangeHandler.Items.Clear(); foreach (PeriodInterval interval in page.rows) { interval.periodName = period; period.intervalListChangeHandler.Items.Add(interval); } period.isCompleted = true; period.DataFilter.page = page.currentPage; period.DataFilter.totalPages = page.pageCount; AddDefaultItems(period); } else if (parent is PeriodInterval) { PeriodInterval interval = (PeriodInterval)parent; ForgetDefaultItems(interval); interval.DataFilter.page++; BrowserDataPage <PeriodInterval> page = this.Service.getPeriodIntervalChildren(interval.DataFilter); interval.childrenListChangeHandler.Items.Clear(); foreach (PeriodInterval child in page.rows) { child.parent = interval; child.periodName = interval.periodName; interval.childrenListChangeHandler.Items.Add(child); } interval.isCompleted = true; interval.DataFilter.page = page.currentPage; interval.DataFilter.totalPages = page.pageCount; AddDefaultItems(interval); } parent.isCompleted = true; } }
/// <summary> /// Load no complete object. /// </summary> /// <param name="parent"></param> protected virtual void Load(Persistent parent) { if (parent == null || parent.IsDefault) { return; } if (!parent.isCompleted && parent.oid.HasValue) { if (parent.DataFilter == null) { parent.DataFilter = new BrowserDataFilter(); parent.DataFilter.groupOid = parent.oid.Value; parent.DataFilter.page = 0; parent.DataFilter.pageSize = PAGE_SIZE; } if (parent is Domain.Attribute) { Domain.Attribute attribute = (Domain.Attribute)parent; ForgetDefaultItems(attribute); attribute.DataFilter.page++; BrowserDataPage <AttributeValue> page = this.Service.getRootAttributeValuesByAttribute(attribute.DataFilter); attribute.ClearValuesInItems(); foreach (AttributeValue value in page.rows) { value.attribut = attribute; attribute.Items.Add(value); } attribute.isCompleted = true; attribute.DataFilter.page = page.currentPage; attribute.DataFilter.totalPages = page.pageCount; AddDefaultItems(attribute); } else if (parent is AttributeValue) { AttributeValue value = (AttributeValue)parent; ForgetDefaultItems(value); value.DataFilter.page++; BrowserDataPage <AttributeValue> page = this.Service.getAttributeValueChildren(value.DataFilter); value.childrenListChangeHandler.Items.Clear(); foreach (AttributeValue child in page.rows) { child.parent = value; value.childrenListChangeHandler.Items.Add(child); } value.isCompleted = true; value.DataFilter.page = page.currentPage; value.DataFilter.totalPages = page.pageCount; AddDefaultItems(value); } parent.isCompleted = true; } }
public void Search() { this.Selection = null; Filter.criteria = SearchTextBox.Text; Filter.orderAsc = descButton.IsChecked.HasValue && descButton.IsChecked.Value ? false : true; Filter.pageSize = ShowAllChechBox.IsChecked.Value ? int.MaxValue : BrowserDataFilter.DEFAULT_PAGE_SIZE; BrowserDataPage <Domain.Measure> page = Service.getAllDescendents(Filter); this.listBox.ItemsSource = page != null ? page.rows : null; this.okButton.IsEnabled = Selection != null; SearchTextBox.Focus(); }
/// <summary> /// Affiche une collection d'objets dans le navigateur. /// </summary> /// <param name="datas">La collection d'objet à afficher dans le navigateur</param> public void DisplayPage(BrowserDataPage <B> page) { this.Form.Grid.ItemsSource = new ObservableCollection <B>(); if (page != null) { this.Form.Grid.ItemsSource = page.rows; this.NavigationBar.displayPage(page.pageSize, page.pageFirstItem, page.pageLastItem, page.totalItemCount, page.pageCount, page.currentPage); } else { this.Form.Grid.ItemsSource = new ObservableCollection <B>(); this.NavigationBar.displayPage(10, 0, 0, 0, 0, 0); } }
/// <summary> /// Perform default action /// </summary> /// <param name="action"></param> protected virtual void PerformDefaultAction(Persistent action) { if (action == null || !action.IsShowMoreItem) { return; } if (action is PeriodInterval) { PeriodInterval selection = (PeriodInterval)action; PeriodInterval parent = selection.parent; PeriodName period = selection.periodName; BrowserDataPage <PeriodInterval> page = null; if (parent != null) { ForgetDefaultItems(parent); parent.DataFilter.page++; page = this.Service.getPeriodIntervalChildren(parent.DataFilter); foreach (PeriodInterval interval in page.rows) { interval.parent = parent; interval.periodName = parent.periodName; parent.childrenListChangeHandler.Items.Add(interval); } parent.isCompleted = true; parent.DataFilter.page = page.currentPage; parent.DataFilter.totalPages = page.pageCount; AddDefaultItems(parent); } else if (period != null) { ForgetDefaultItems(period); period.DataFilter.page++; page = this.Service.getRootIntervalsByPeriodName(period.DataFilter); foreach (PeriodInterval interval in page.rows) { interval.periodName = period; period.intervalListChangeHandler.Items.Add(interval); } period.isCompleted = true; period.DataFilter.page = page.currentPage; period.DataFilter.totalPages = page.pageCount; AddDefaultItems(period); } } }
/// <summary> /// Perform default action /// </summary> /// <param name="action"></param> protected virtual void PerformDefaultAction(Persistent action) { if (action == null || !action.IsShowMoreItem) { return; } if (action is AttributeValue) { AttributeValue selection = (AttributeValue)action; AttributeValue parent = selection.parent; Domain.Attribute attribute = selection.attribut; BrowserDataPage <AttributeValue> page = null; if (parent != null) { ForgetDefaultItems(parent); parent.DataFilter.page++; page = this.Service.getAttributeValueChildren(parent.DataFilter); foreach (AttributeValue value in page.rows) { value.parent = parent; parent.childrenListChangeHandler.Items.Add(value); } parent.isCompleted = true; parent.DataFilter.page = page.currentPage; parent.DataFilter.totalPages = page.pageCount; AddDefaultItems(parent); } else if (attribute != null) { ForgetDefaultItems(attribute); attribute.DataFilter.page++; page = this.Service.getRootAttributeValuesByAttribute(attribute.DataFilter); foreach (AttributeValue value in page.rows) { value.attribut = attribute; attribute.Items.Add(value); } attribute.isCompleted = true; attribute.DataFilter.page = page.currentPage; attribute.DataFilter.totalPages = page.pageCount; AddDefaultItems(attribute); } } }
private void onAttributeValueShowMore(object item) { if (item != null && item is Kernel.Domain.AttributeValue) { Kernel.Domain.AttributeValue selection = (Kernel.Domain.AttributeValue)item; Kernel.Domain.AttributeValue parent = selection.parent; parent.DataFilter.page++; BrowserDataPage <Kernel.Domain.AttributeValue> page = parent.parent != null ? ModelService.getAttributeValueChildren(parent.DataFilter) : ModelService.getRootAttributeValuesByAttribute(parent.DataFilter); parent.isCompleted = true; attributeValueTreeList.addPage(parent, page); parent.DataFilter.page = page.currentPage; parent.DataFilter.totalPages = page.pageCount; } }
protected void OnSelectedAttributeChange(object sender, DevExpress.Xpf.Grid.SelectedItemChangedEventArgs e) { Kernel.Domain.Attribute selection = attributeTreeList.GetSelectedValue();; if (selection != null && !selection.isCompleted && selection.oid.HasValue) { BrowserDataFilter filter = new BrowserDataFilter(); filter.groupOid = selection.oid.Value; filter.page = 1; filter.pageSize = 10; BrowserDataPage <Kernel.Domain.AttributeValue> page = ModelService.getRootAttributeValuesByAttribute(filter); selection.valueListChangeHandler.originalList = page.rows; selection.isCompleted = true; filter.page = page.currentPage; filter.totalPages = page.pageCount; selection.DataFilter = filter; } attributeValueTreeList.DisplayAttribute(selection); }
public BrowserDataPage <Kernel.Domain.Measure> getAllDescendents(BrowserDataFilter filter, bool showPostingMeasure = true) { try { var request = new RestRequest(ResourcePath + "/all-descendents/" + showPostingMeasure, Method.POST); JavaScriptSerializer serializer = new JavaScriptSerializer(); request.RequestFormat = DataFormat.Json; serializer.MaxJsonLength = int.MaxValue; string json = serializer.Serialize(filter); request.AddParameter("application/json", json, ParameterType.RequestBody); RestResponse queryResult = (RestResponse)RestClient.Execute(request); BrowserDataPage <Kernel.Domain.Measure> values = RestSharp.SimpleJson.DeserializeObject <BrowserDataPage <Kernel.Domain.Measure> >(queryResult.Content); return(values); } catch (Exception e) { throw new BcephalException("Unable to Return measures.", e); } }
public BrowserDataPage <Kernel.Domain.PeriodInterval> getRootIntervalsByPeriodName(BrowserDataFilter filter) { try { var request = new RestRequest(ResourcePath + "/root-period-intervals", Method.POST); JavaScriptSerializer serializer = new JavaScriptSerializer(); request.RequestFormat = DataFormat.Json; serializer.MaxJsonLength = int.MaxValue; string json = serializer.Serialize(filter); request.AddParameter("application/json", json, ParameterType.RequestBody); RestResponse queryResult = (RestResponse)RestClient.Execute(request); BrowserDataPage <Kernel.Domain.PeriodInterval> values = RestSharp.SimpleJson.DeserializeObject <BrowserDataPage <Kernel.Domain.PeriodInterval> >(queryResult.Content); return(values); } catch (Exception e) { throw new BcephalException("Unable to Return PeriodInterval.", e); } }
public void addPage(Domain.AttributeValue selection, BrowserDataPage <Domain.AttributeValue> page) { if (!selection.isCompleted) { foreach (Domain.AttributeValue value in selection.childrenListChangeHandler.originalList.ToArray()) { selection.childrenListChangeHandler.forget(value); removeFromSource(value); } } Domain.AttributeValue sel = null; foreach (Domain.AttributeValue value in page.rows) { value.parent = selection; addToSource(value); sel = value; } selection.childrenListChangeHandler.Items.BubbleSort(); SetSelectedValue(sel); }
/// <summary> /// effectue la recherche /// </summary> /// <returns></returns> public virtual OperationState FilterByCategory(String category) { if (String.IsNullOrEmpty(category)) { return(Search()); } try { BrowserDataFilter filter = GetBrowser().BuildFilter(0); BrowserDataPage <BrowserData> page = ((GroupService)this.Service).getBrowserDatasByCategory(filter, category); GetBrowser().DisplayPage(page); return(OperationState.CONTINUE); } catch (ServiceExecption e) { DisplayError("error", e.Message); } return(OperationState.STOP); }
public BrowserDataPage <BrowserData> getBrowserDatasByCategory(BrowserDataFilter filter, String category) { try { var request = new RestRequest(ResourcePath + "/browserdatasbycategory/" + category, Method.POST); JavaScriptSerializer serializer = new JavaScriptSerializer(); serializer.MaxJsonLength = int.MaxValue; string json = serializer.Serialize(filter); request.AddParameter("application/json", json, ParameterType.RequestBody); RestResponse queryResult = (RestResponse)RestClient.Execute(request); BrowserDataPage <BrowserData> objects = RestSharp.SimpleJson.DeserializeObject <BrowserDataPage <BrowserData> >(queryResult.Content); return(objects); } catch (Exception e) { logger.Error("Unable to retrieve list of BrowserData.", e); throw new ServiceExecption("Unable to retrieve list of BrowserData.", e); } }
/// <summary> /// effectue la recherche /// </summary> /// <returns></returns> public override OperationState Search(object item) { ApplicationManager.MainWindow.IsBussy = true; Kernel.Application.Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { try { int p = 0; BGroup group = null; if (item != null && item is int) { p = (int)item; } else if (item != null && item is Kernel.Domain.BGroup) { group = (BGroup)item; } BrowserDataFilter filter = GetBrowser().BuildFilter(p); if (group != null && group.oid.HasValue) { filter.groupOid = group.oid; } BrowserDataPage <B> page = this.Service.getBrowserDatas(filter); GetBrowser().DisplayPage(page); } catch (ServiceExecption e) { DisplayError("error", e.Message); } finally { ApplicationManager.MainWindow.IsBussy = false; } })); return(OperationState.CONTINUE); }
private void onAttributeValueExpend(object item) { if (item != null && item is Kernel.Domain.AttributeValue) { Kernel.Domain.AttributeValue selection = (Kernel.Domain.AttributeValue)item; if (selection != null && !selection.isCompleted && selection.oid.HasValue) { if (selection.DataFilter == null) { selection.DataFilter = new BrowserDataFilter(); selection.DataFilter.groupOid = selection.oid.Value; selection.DataFilter.page = 0; selection.DataFilter.pageSize = 10; } selection.DataFilter.page++; BrowserDataPage <Kernel.Domain.AttributeValue> page = ModelService.getAttributeValueChildren(selection.DataFilter); attributeValueTreeList.addPage(selection, page); selection.isCompleted = true; selection.DataFilter.page = page.currentPage; selection.DataFilter.totalPages = page.pageCount; } } }