/// <summary> /// The select list. /// </summary> /// <param name="startRowIndex"> /// The start row index. /// </param> /// <param name="maximumRows"> /// The maximum rows. /// </param> /// <param name="totalRowCount"> /// The total row count. /// </param> /// <returns> /// The <see cref="IEnumerable"/>. /// </returns> public IEnumerable <ParamData> SelectList(int startRowIndex, int maximumRows, out int totalRowCount) { totalRowCount = 0; try { if (this.SearchViewModel == null) { this.SearchViewModel = new FormSearchViewModel(); } var result = this.Service.GetList(this.SearchViewModel).ToList(); if (result.Any()) { totalRowCount = result.Count(); } return(result); } catch (Exception e) { Logger.Error(e); this.Page.ModelState.AddModelError("Select", e.Message); } return(null); }
/// <summary> /// The select value. /// </summary> /// <param name="startRowIndex"> /// The start Row Index. /// </param> /// <param name="maximumRows"> /// The maximum Rows. /// </param> /// <param name="totalRowCount"> /// The total Row Count. /// </param> /// <returns> /// The <see cref="IEnumerable{ServiceOnCallViewModel}"/>. /// </returns> public IEnumerable <OnCallModel> SelectValue(int startRowIndex, int maximumRows, out int totalRowCount) { totalRowCount = 0; try { var searchModel = new FormSearchViewModel { MaximumRows = maximumRows, StartRowIndex = startRowIndex }; var result = this.service.GetList(searchModel); if (result.Count > 0) { totalRowCount = result.First().TotalRowCount; } return(result); } catch (Exception e) { Logger.Error(e); this.ModelState.AddModelError("select", e.Message); } return(null); }
/// <summary> /// The insert. /// </summary> /// <param name="model"> /// The model. /// </param> public void Insert(FormSearchViewModel model) { try { if (this.Page.ModelState.IsValid) { Logger.Info("查詢作業"); foreach (var pi in model.GetType().GetProperties()) { try { if (pi.GetValue(model) != null) { Logger.Info($"參數:{pi.Name},值:{pi.GetValue(model)}"); } } catch (Exception) { // ignore } } this.OnSearch(new HelpDeskEventArgs <FormSearchViewModel> { Data = model }); } } catch (Exception e) { Logger.Error(e); this.Page.ModelState.AddModelError("Search", e.Message); } }
/// <summary> /// The get list. /// </summary> /// <param name="searchViewModel"> /// The search view model. /// </param> /// <returns> /// The <see cref="IEnumerable{KeyValuePair}"/>. /// </returns> public IEnumerable <KeyValuePair <string, string> > GetKeyValuePairs(FormSearchViewModel searchViewModel) { var list = this.GetList(searchViewModel); var result = new List <KeyValuePair <string, string> >(); foreach (var paramData in list) { result.Add(new KeyValuePair <string, string>(paramData.Key, paramData.Data)); } return(result); }
/// <summary> /// The select service on call. /// </summary> /// <returns> /// The <see cref="IEnumerable{OnCallModel}"/>. /// </returns> public IEnumerable <OnCallModel> SelectServiceOnCall(int startRowIndex, int maximumRows, out int totalRowCount) { totalRowCount = 0; try { var searchViewModel = new FormSearchViewModel { StartRowIndex = startRowIndex, MaximumRows = maximumRows }; var result = this.ServiceOnCall.GetList(searchViewModel); totalRowCount = result.Count; return(result); } catch (Exception e) { Logger.Error(e); } return(null); }
/// <summary> /// The insert form view model. /// </summary> /// <param name="model"> /// The model. /// </param> public void InsertFormViewModel(FormSearchViewModel model) { try { if (this.Page.ModelState.IsValid) { this.Finished?.Invoke( this, new HelpDeskEventArgs <FormSearchViewModel> { ExtraObj = model }); } } catch (Exception e) { Logger.Error(e); this.Page.ModelState.AddModelError(e.Source, e.Message); } }
/// <summary> /// The link button submit_ on click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void LinkButtonSubmit_OnClick(object sender, EventArgs e) { var model = new FormSearchViewModel { SearchText = this.TextBoxSearchText.Text.Trim() }; if (!string.IsNullOrWhiteSpace(this.TextBoxStartDate.Text)) { model.StartDate = DateTime.Parse(this.TextBoxCloseDate.Text.Trim()); } if (!string.IsNullOrWhiteSpace(this.TextBoxCloseDate.Text)) { model.CloseDate = DateTime.Parse(this.TextBoxCloseDate.Text.Trim()); } this.OnSearch(new HelpDeskEventArgs <FormSearchViewModel>() { Data = model }); }
/// <summary> /// The form search component_ on search. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void FormSearchComponent_OnSearch(object sender, HelpDeskEventArgs <FormSearchViewModel> e) { this.SearchViewModel = e.Data; this.ListViewMain.DataBind(); }
/// <summary> /// The get list. /// </summary> /// <param name="searchViewModel"> /// The search view model. /// </param> /// <returns> /// The <see cref="IList{OnCallModel}"/>. /// </returns> public IList <OnCallModel> GetList(FormSearchViewModel searchViewModel) { return(this.repo.GetList(searchViewModel)); }
/// <summary> /// The get. /// </summary> /// <param name="model"> /// The model. /// </param> /// <returns> /// The <see cref="OnCallModel"/>. /// </returns> public OnCallModel Get(FormSearchViewModel model) { return(this.repo.Get(model)); }
/// <summary> /// The get list. /// </summary> /// <param name="searchViewModel"> /// The search view model. /// </param> /// <returns> /// The <see cref="IEnumerable{ParamData}"/>. /// </returns> public IEnumerable <ParamData> GetList(FormSearchViewModel searchViewModel) { return(this.repo.GetList(searchViewModel)); }
/// <summary> /// 取得資產設備清單 /// </summary> /// <param name="searchViewModel"> /// The search view model. /// </param> /// <returns> /// The <see cref="DeviceViewModel"/>. /// </returns> public DeviceViewModel GetDevice(FormSearchViewModel searchViewModel) { var data = this.repoDevice.Get(searchViewModel); return(this.IMapper.Map <DeviceViewModel>(data)); }
/// <summary> /// 取得所有資產設備清單 /// </summary> /// <param name="searchViewModel"> /// The search view model. /// </param> /// <returns> /// The <see cref="IList{DeviceViewModel}"/>. /// </returns> public IList <DeviceViewModel> GetDeviceList(FormSearchViewModel searchViewModel) { var data = this.repoDevice.GetList(searchViewModel); return(this.IMapper.Map <IList <DeviceViewModel> >(data)); }