public GridDto GetListLikeSearchWithPageCounters(Specification <Product> specification, int page = 0, int pageSize = 5) { List <Product> products = new List <Product>(); GridDto result = new GridDto(); bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); products = _unitOfWork.GetSession().Query <Product>() .Where(specification.ToExpression()) .Skip(page * pageSize) .Take(pageSize) .ToList(); _unitOfWork.Commit(uowStatus); result = new GridDto { Content = products, TotalRecords = CountTotalRecordsLikeSearchByName(specification), CurrentPage = page, PageSize = pageSize }; } catch (Exception ex) { _unitOfWork.Rollback(uowStatus); throw ex; } return(result); }
public GridDto GetListSearchLikeByNameAndDocumentNumberWithPageCounters(Specification <Customer> specification, int page = 0, int pageSize = 5) { List <Customer> customers = new List <Customer>(); GridDto result = new GridDto(); bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); customers = _unitOfWork.GetSession().Query <Customer>() .Where(specification.ToExpression()) .Skip(page * pageSize) .Take(pageSize) .ToList(); _unitOfWork.Commit(uowStatus); result = new GridDto { Content = customers, TotalRecords = CountTotalRecordsSearchLikeByNameAndDocumentNumber(specification), CurrentPage = page, PageSize = pageSize }; } catch (Exception ex) { _unitOfWork.Rollback(uowStatus); throw ex; } return(result); }
public GridAdminViewModel(GridDto gridData, string gridDataUrl, string rowEditUrl) { GridInstance = new JQGrid(); GridInstance.DataUrl = gridDataUrl; GridInstance.EditUrl = rowEditUrl; InitGrid(gridData); }
public GridDto GetListWithPageCounters(int page = 0, int pageSize = 5) { List <Customer> customers = new List <Customer>(); GridDto result = new GridDto(); bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); customers = _unitOfWork.GetSession().Query <Customer>() .Skip(page * pageSize) .Take(pageSize) .ToList(); _unitOfWork.Commit(uowStatus); result = new GridDto { Content = customers, TotalRecords = CountTotalRecords(), CurrentPage = page, PageSize = pageSize }; } catch (Exception ex) { _unitOfWork.Rollback(uowStatus); throw ex; } return(result); }
private void InitGrid(GridDto gridData) { // Create columns CreateColumns(gridData); // Set other properties GridUniqueId = gridData.Id.ToString(); // Customize/change some of the default settings for this model // ID is a mandatory field. Must by unique if you have several grids on one page. GridInstance.ID = string.Format("grid{0}", GridUniqueId); // Setting the DataUrl to an action (method) in the controller is required. // This action will return the data needed by the grid // show the search toolbar //ordersGrid.ToolBarSettings.ShowSearchToolBar = true; //ordersGrid.Columns.Find(c => c.DataField == "OrderID").Searchable = false; //ordersGrid.Columns.Find(c => c.DataField == "OrderDate").Searchable = false; //SetUpCustomerIDSearchDropDown(ordersGrid); //SetUpFreightSearchDropDown(ordersGrid); //SetShipNameSearchDropDown(ordersGrid); GridInstance.AutoWidth = true; GridInstance.ToolBarSettings.ShowEditButton = true; GridInstance.ToolBarSettings.ShowAddButton = true; GridInstance.ToolBarSettings.ShowDeleteButton = true; GridInstance.EditDialogSettings.CloseAfterEditing = true; GridInstance.EditDialogSettings.Width = 800; GridInstance.AddDialogSettings.CloseAfterAdding = true; GridInstance.AddDialogSettings.Width = 800; // setup the dropdown values for the CustomerID editing dropdown //SetUpCustomerIDEditDropDown(ordersGrid); }
public static BlockInfoDto MockRecipeDetail() { BlockInfoDto block = new BlockInfoDto(); block.Name = "RecipeDetail"; block.WidgetName = BlockRegister.RecipeBlock.WidgetName; block.IsBuiltIn = true; List <SubitemInfoDto> items = new List <SubitemInfoDto>(); block.Subitems = items; GridDto ingredientGrid = new GridDto() { Id = CmsRegister.IngredientGridId }; GridDto instructionGrid = new GridDto() { Id = CmsRegister.InstructionGridId }; items.Add(new SubitemInfoDto { SubitemId = BlockRegister.RecipeBlock.IngredientGrid, Grid = ingredientGrid }); items.Add(new SubitemInfoDto { SubitemId = BlockRegister.RecipeBlock.InstructionGrid, Grid = instructionGrid }); return(block); }
public async Task <GridDto <OyuncuListDto> > GetGridAsync(int start, int pageSize, Expression <Func <Oyuncu, bool> > filter = null) { GridDto <OyuncuListDto> gridDto = new GridDto <OyuncuListDto>(); using (var context = new CastAjansContext()) { var query = (filter == null ? context.Oyuncular : context.Oyuncular.Where(filter)); query = query.Include(i => i.Kisi); query = query.Include(i => i.Kisi.Uyruk); query = query.Include(i => i.OyuncuResimleri); var data = query.Select(i => new OyuncuListDto { Id = i.Id, Adi = i.Kisi.Adi, Soyadi = i.Kisi.Soyadi, Cep = i.Kisi.Cep.IfIsNull(i.Kisi.Telefon.DataForUsage().IfIsNull(i.Kisi.Telefon2.DataForUsage())).DataForUsage(), AltBeden = i.AltBeden, Boy = i.Boy, Cinsiyet = i.Kisi.Cinsiyet.ToDisplay(), DogumTarihi = i.Kisi.DogumTarihi, GozRengi = i.GozRengi.ToDisplay(), Kase = i.Kase, Kilo = i.Kilo, ProfilFotoUrl = i.Kisi.ProfilFotoUrl, SacRengi = i.SacRengi.ToDisplay(), TenRengi = i.TenRengi.ToDisplay(), UstBeden = i.UstBeden, Uyruk = i.Kisi.Uyruk.Adi, GuncellemeTarihi = i.GuncellemeZamani } ).OrderByDescending(i => i.GuncellemeTarihi); gridDto.RecordsFiltered = data.Count(); gridDto.Data = await data.Skip(start).Take(pageSize).ToListAsync <OyuncuListDto>(); gridDto.RecordsTotal = gridDto.Data.Count; foreach (var item in gridDto.Data) { item.Projeler = (from proje in context.Projeler join pkararakter in context.ProjeKarakterleri on proje.Id equals pkararakter.ProjeId join projeOyuncu in context.ProjeKarakterOyunculari on pkararakter.Id equals projeOyuncu.ProjeKarakterId where projeOyuncu.OyuncuId == item.Id && proje.TarihBas >= DateTime.Today && projeOyuncu.Aktif && pkararakter.Aktif && proje.Aktif select proje).ToList(); } } return(gridDto); }
// This method is called when the grid requests data public JsonResult GetGridData(int referenceId, int jqGridID) { ReferenceInfoDto reference = GetReference(referenceId); GridDto grid = GetGrid(reference, jqGridID); List <GridRowDto> gridRows = reference.GridRows.Where(o => object.Equals(o.GridId, jqGridID)).ToList(); return(ConvertToJson(grid, gridRows)); }
private float[] OneHotEncode(GridDto p_cell) { float[] result = new float[_cellProjection.Count + _itemProjection.Count]; int c_index = _cellProjection[p_cell.idCell]; int i_index = _cellProjection.Count + _itemProjection[p_cell.idItem]; result[c_index] = 1; result[i_index] = 1; return(result); }
private float[] BinaryEncode(GridDto p_cell) { List <float> tmp = new List <float>(); float[] c_code = DecToBin(_cellProjection[p_cell.idCell], (int)Math.Ceiling(Math.Log(_cellProjection.Count, 2))); float[] i_code = DecToBin(_itemProjection[p_cell.idItem], (int)Math.Ceiling(Math.Log(_itemProjection.Count, 2))); tmp.AddRange(c_code); tmp.AddRange(i_code); return(tmp.ToArray()); }
private JsonResult ConvertToJson(GridDto grid, List <GridRowDto> gridRows) { var result = new { page = 1, total = 1, records = gridRows.Count, rows = gridRows.Select(x => ConvertRow(grid, x)) }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public GridDto getAll(int offset, int limit) { List <BankAccount> bankAccounts = _iUnitOfWork.BankAccounts.GetAllWithPaginated(offset, limit, "number", "asc").ToList(); GridDto result = new GridDto { Content = bankAccounts, TotalRecords = _iUnitOfWork.BankAccounts.CountTotalRecords(), CurrentPage = offset, PageSize = limit }; return(result); }
public GridDto getAll(int offset, int limit) { List <Customer> customers = _iUnitOfWork.Customers.GetAllWithPaginated(offset, limit, "FirstName", "asc").ToList(); GridDto result = new GridDto { Content = customers, TotalRecords = _iUnitOfWork.Customers.CountTotalRecords(), CurrentPage = offset, PageSize = limit }; return(result); }
public GridDto getAll(int offset, int limit, string orderBy, string orderDirection) { List <Customer> customers = _iUnitOfWork.Customers.GetAllWithPaginated(offset, limit, orderBy, orderDirection).ToList(); GridDto result = new GridDto { Content = customers, TotalRecords = _iUnitOfWork.Customers.CountTotalRecords(), CurrentPage = offset, PageSize = limit }; return(result); }
private string[] ConvertRow(GridDto grid, GridRowDto row) { List <string> values = new List <string>(); values.Add(row.Id.ToString()); foreach (GridColumnDto column in grid.Columns) { DucValueDto ducValue = row.Cells.SingleOrDefault(o => o.DucId.Equals(column.Id)); if (ducValue != null) { switch (column.ColumnType) { case DucTypes.SubTitle: case DucTypes.Text: case DucTypes.TextArea: values.Add(ducValue.ValueText); break; case DucTypes.Html: case DucTypes.HtmlArea: values.Add(ducValue.ValueHtml); break; case DucTypes.Integer: values.Add(ducValue.ValueInt.HasValue ? ducValue.ValueInt.Value.ToString() : string.Empty); break; case DucTypes.Image: values.Add(ducValue.ValueUrl); values.Add(ducValue.ValueText); break; case DucTypes.Hyperlink: values.Add(ducValue.ValueUrl); values.Add(ducValue.ValueText); break; case DucTypes.Datetime: break; default: break; } } } return(values.ToArray()); }
public GridDto <TarefaGridDto> CarregarGrid(int numeroDaPagina, int registrosPorPagina, string filtro, TarefaGridFiltroAvancadoDto filtroAvancado = null) { var gridDto = new GridDto <TarefaGridDto>(); if (numeroDaPagina < 1) { numeroDaPagina = 1; } var query = _tarefaRepository.GetAll() .OrderBy(p => p.Titulo) .AsQueryable(); if (filtroAvancado != null) { if (!string.IsNullOrWhiteSpace(filtroAvancado.Titulo)) { query = query.Where(t => EF.Functions.Like(t.Titulo, $"%{filtroAvancado.Titulo}%")); } } else { query = query.Where(t => !t.Excluido); if (!string.IsNullOrWhiteSpace(filtro)) { query = query.Where(t => EF.Functions.Like(t.Titulo, $"%{filtro}%")); } } gridDto.TotalDeItensEncontrados = query.Count(); gridDto.Itens = query .Select(t => new TarefaGridDto() { Id = t.Id, Titulo = t.Titulo, Descricao = t.Descricao, DataDaUltimaAlteracao = t.DataDaUltimaAlteracao == null ? "" : ((DateTime)t.DataDaUltimaAlteracao).ToString("MM/dd/yyyy HH:mm"), DataDeCadastro = t.DataDeCadastro.ToString("MM/dd/yyyy HH:mm"), Excluido = t.Excluido }) .Skip((numeroDaPagina - 1) * registrosPorPagina) .Take(registrosPorPagina) .ToList(); return(gridDto); }
public IActionResult ProductsPaginated([FromQuery] int page = 0, [FromQuery] int size = 5) { bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); GridDto products = _ProductRepository.GetListWithPageCounters(page, size); _unitOfWork.Commit(uowStatus); List <ProductDto> productsDTO = _ProductAssembler.FromListProductToListProductDto((List <Product>)products.Content); products.Content = productsDTO; return(StatusCode(StatusCodes.Status200OK, products)); } catch (Exception ex) { _unitOfWork.Rollback(uowStatus); Console.WriteLine(ex.StackTrace); return(StatusCode(StatusCodes.Status500InternalServerError, new ApiStringResponseDto(ex.Message))); } }
public IActionResult LikeSearchByNameAndDocumentNumberCustomersPaginated([FromQuery] string Name, [FromQuery] string DocumentNumber, [FromQuery] int page = 0, [FromQuery] int size = 5) { bool uowStatus = false; try { Specification <Customer> specification = LikeSearchByNameAndDocumentNumber(Name, DocumentNumber); uowStatus = _unitOfWork.BeginTransaction(); GridDto customers = _customerRepository.GetListSearchLikeByNameAndDocumentNumberWithPageCounters(specification, page, size); _unitOfWork.Commit(uowStatus); List <CustomerDto> productsDTO = _customerAssembler.FromListCustomerToListCustomerDto((List <Customer>)customers.Content); customers.Content = productsDTO; return(StatusCode(StatusCodes.Status200OK, customers)); } catch (Exception ex) { _unitOfWork.Rollback(uowStatus); Console.WriteLine(ex.StackTrace); return(StatusCode(StatusCodes.Status500InternalServerError, new ApiStringResponseDto(ex.Message))); } }
public async Task <GridDto> GetGridByGridId(long gridId, string company) { GridDto gridConfig = new GridDto(); var queryParameters = new DynamicParameters(); queryParameters.Add("@GridId", gridId); queryParameters.Add("@CompanyId", company); using (var grid = await ExecuteQueryMultipleAsync(StoredProcedureNames.GetGridColumnConfigByGridId, queryParameters)) { gridConfig = grid.Read <GridDto>().FirstOrDefault(); if (gridConfig != null) { gridConfig.CompanyId = company; gridConfig.Columns = grid.Read <GridColumnDto>().ToList(); } } return(gridConfig); }
public ActionResult Grid(int current, int rowCount, String sortExpression) { var data = new GridDto <Author>(); data.current = current; data.rowCount = rowCount; var startRow = rowCount * (current - 1); var authors = db.Authors.OrderBy(x => x.LastName).Skip(startRow).Take(rowCount).ToList(); data.rows = authors; data.total = authors.Count; var list = JsonConvert.SerializeObject(data, Formatting.Indented, new JsonSerializerSettings() { ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore }); return(Content(list, "application/json")); }
public static BlockInfoDto MockPhotoGallery() { BlockInfoDto block = new BlockInfoDto(); block.Name = "PhotoGallery"; block.WidgetName = BlockRegister.PhotoGallery.WidgetName; block.IsBuiltIn = true; List <SubitemInfoDto> items = new List <SubitemInfoDto>(); block.Subitems = items; GridDto photosGrid = new GridDto() { Id = CmsRegister.PhotosGridId }; items.Add(new SubitemInfoDto { SubitemId = BlockRegister.PhotoGallery.PhotosGrid, Grid = photosGrid }); return(block); }
public async Task <IEnumerable <SectionAssignedToCharterDto> > SearchCharterAssignmentsAsync(string company, EntitySearchRequest searchRequest, GridDto grid) { var dynamicQueryDefinition = _mapper.Map <DynamicQueryDefinition>(searchRequest); var columnConfiguration = _mapper.Map <List <ColumnConfiguration> >(grid.Columns); var companyDate = await _systemDateTimeService.GetCompanyDate(company); var dataVersionId = searchRequest.DataVersionId ?? await _systemDateTimeService.GetCompanyCurrentDataVersionId(company); var buildQueryResult = DynamicQueryBuilder.BuildQuery(company, _identityService.GetUserName(), dynamicQueryDefinition, "[Configuration].[Vw_CharterSectionAssignmentListAndSearch]", columnConfiguration, companyDate, dataVersionId); var charterAssignmentSections = await ExecuteDynamicQueryAsync <SectionAssignedToCharterDto>(buildQueryResult.Sql, buildQueryResult.Parameters); return(charterAssignmentSections.ToList()); }
private void CreateColumns(GridDto gridData) { JQGridColumn keyColumn = new JQGridColumn(); GridInstance.Columns.Add(keyColumn); keyColumn.DataField = BaseDto.FLD_Id; keyColumn.PrimaryKey = true; keyColumn.Width = 40; keyColumn.Editable = false; keyColumn.Visible = true; foreach (GridColumnDto item in gridData.Columns) { switch (item.ColumnType) { case DucTypes.SubTitle: case DucTypes.Integer: case DucTypes.Text: case DucTypes.Html: JQGridColumn textColumn = new JQGridColumn(); GridInstance.Columns.Add(textColumn); textColumn.HeaderText = item.ColumnName; textColumn.DataField = DucHelper.GetClientId(item.Id); textColumn.Editable = true; textColumn.EditType = EditType.TextBox; textColumn.Width = item.ColumnWidth; break; case DucTypes.TextArea: case DucTypes.HtmlArea: JQGridColumn column = new JQGridColumn(); GridInstance.Columns.Add(column); column.HeaderText = item.ColumnName; column.DataField = DucHelper.GetClientId(item.Id); column.Editable = true; column.EditType = EditType.TextArea; column.Width = item.ColumnWidth; break; case DucTypes.Image: JQGridColumn imageColumn1 = new JQGridColumn(); GridInstance.Columns.Add(imageColumn1); imageColumn1.HeaderText = string.Format(UIConst.ValueUrlKeyFormatString, item.ColumnName); imageColumn1.DataField = string.Format(UIConst.ValueUrlKeyFormatString, DucHelper.GetClientId(item.Id)); imageColumn1.Editable = true; imageColumn1.EditType = EditType.TextArea; imageColumn1.Resizable = true; imageColumn1.DataType = typeof(string); imageColumn1.Width = item.ColumnWidth; JQGridColumn imageColumn2 = new JQGridColumn(); GridInstance.Columns.Add(imageColumn2); imageColumn2.HeaderText = string.Format(UIConst.ValueTextKeyFormatString, item.ColumnName); imageColumn2.DataField = string.Format(UIConst.ValueTextKeyFormatString, DucHelper.GetClientId(item.Id)); imageColumn2.Editable = true; imageColumn2.EditType = EditType.TextBox; imageColumn2.Resizable = true; imageColumn2.DataType = typeof(string); imageColumn2.Width = item.ColumnWidth; break; case DucTypes.Hyperlink: JQGridColumn linkColumn1 = new JQGridColumn(); GridInstance.Columns.Add(linkColumn1); linkColumn1.HeaderText = string.Format(UIConst.ValueUrlKeyFormatString, item.ColumnName); linkColumn1.DataField = string.Format(UIConst.ValueUrlKeyFormatString, DucHelper.GetClientId(item.Id)); linkColumn1.Editable = true; linkColumn1.EditType = EditType.TextBox; linkColumn1.Width = item.ColumnWidth; JQGridColumn linkColumn2 = new JQGridColumn(); GridInstance.Columns.Add(linkColumn2); linkColumn2.HeaderText = string.Format(UIConst.ValueTextKeyFormatString, item.ColumnName); linkColumn2.DataField = string.Format(UIConst.ValueTextKeyFormatString, DucHelper.GetClientId(item.Id)); linkColumn2.Editable = true; linkColumn2.EditType = EditType.TextBox; linkColumn2.Width = item.ColumnWidth; break; case DucTypes.Datetime: break; default: break; } } }
public IHttpActionResult GetGrid(int restaurantId, string date, string fromTime, string toTime) { // TODO: change the signature of this mathod to be meaningful //userName = "******"; //password = "******"; //var restaurantOwner = db.RestaurantOwners.Where(x => x.UserName == userName && x.Password == password).FirstOrDefault(); //if (restaurantOwner == null) //{ // return NotFound(); //} //var restaurantId = restaurantOwner.RestaurantId; var today = Convert.ToDateTime(date); var grid = db.Grids.Where(x => DbFunctions.TruncateTime(x.Date).Value == today && x.RestaurantId == restaurantId).FirstOrDefault(); //var grid = db.Grids.Where(x => x.RestaurantId == restaurantId).FirstOrDefault(); if (grid == null) { return(NotFound()); } var tables = db.Tables.Where(x => x.GridId == grid.Id).ToList(); var gridItems = db.GridItems.Where(x => x.GridId == grid.Id).ToList(); //************************************************ DateTime startDinner = Convert.ToDateTime(date + " " + fromTime.Replace('-', ':')); DateTime endDinner = Convert.ToDateTime(date + " " + toTime.Replace('-', ':')); //check if the table is reserve between times or start/end dinner is part of other dinner var orders = db.Orders.Where(x => x.GridId == grid.Id && ((x.FromTime <= startDinner && x.ToTime > startDinner) || (x.FromTime < endDinner && x.ToTime >= endDinner) || (x.FromTime >= startDinner && x.ToTime <= endDinner))).ToList(); GridDto gridDto = new GridDto(); gridDto.simpleItems = gridItems; gridDto.XLen = grid.XLen; gridDto.YLen = grid.YLen; gridDto.Id = grid.Id; gridDto.Items = new List <ItemDto>(); tables.ForEach(table => { var tableDto = new GridTableDto { X = table.xCoord, Y = table.yCoord, MaxCapacity = table.Capacity, SmokingAllowed = table.IsSmokingAllowed, TableNumber = table.TableNumber, XLen = table.xLength, YLen = table.yLength }; tableDto.Taken = orders.Where(x => x.TableNumber == tableDto.TableNumber).FirstOrDefault() != null; gridDto.Items.Add(tableDto); }); return(Ok(gridDto)); }
public IHttpActionResult GetGrid(int restaurantId, string date, string fromTime, string toTime) { // TODO: change the signature of this mathod to be meaningful //userName = "******"; //password = "******"; //var restaurantOwner = db.RestaurantOwners.Where(x => x.UserName == userName && x.Password == password).FirstOrDefault(); //if (restaurantOwner == null) //{ // return NotFound(); //} //var restaurantId = restaurantOwner.RestaurantId; var today = Convert.ToDateTime(date); var grid = db.Grids.Where(x => DbFunctions.TruncateTime(x.Date).Value == today && x.RestaurantId == restaurantId).FirstOrDefault(); //var grid = db.Grids.Where(x => x.RestaurantId == restaurantId).FirstOrDefault(); if (grid == null) { return NotFound(); } var tables = db.Tables.Where(x => x.GridId == grid.Id).ToList(); var gridItems = db.GridItems.Where(x => x.GridId == grid.Id).ToList(); //************************************************ DateTime startDinner = Convert.ToDateTime(date + " " + fromTime.Replace('-', ':')); DateTime endDinner = Convert.ToDateTime(date + " " + toTime.Replace('-', ':')); //check if the table is reserve between times or start/end dinner is part of other dinner var orders = db.Orders.Where(x => x.GridId == grid.Id && ((x.FromTime <= startDinner && x.ToTime > startDinner) || (x.FromTime < endDinner && x.ToTime >= endDinner) || (x.FromTime >= startDinner && x.ToTime <= endDinner))).ToList(); GridDto gridDto = new GridDto(); gridDto.simpleItems = gridItems; gridDto.XLen = grid.XLen; gridDto.YLen = grid.YLen; gridDto.Id = grid.Id; gridDto.Items = new List<ItemDto>(); tables.ForEach(table => { var tableDto = new GridTableDto { X = table.xCoord, Y = table.yCoord, MaxCapacity = table.Capacity, SmokingAllowed = table.IsSmokingAllowed, TableNumber = table.TableNumber, XLen = table.xLength, YLen = table.yLength }; tableDto.Taken = orders.Where(x => x.TableNumber == tableDto.TableNumber).FirstOrDefault() != null; gridDto.Items.Add(tableDto); }); return Ok(gridDto); }
public ActionResult EditGridRow(int referenceId, int jqGridID) { ReferenceInfoDto reference = GetReference(referenceId); GridDto grid = GetGrid(reference, jqGridID); List <GridRowDto> gridRows = reference.GridRows.Where(o => object.Equals(o.GridId, jqGridID)).ToList(); JQGrid gridInstance = new JQGrid(); switch (gridInstance.AjaxCallBackMode) { case AjaxCallBackMode.EditRow: bool isValidEdit = ValidateInput(); if (isValidEdit) { int rowId = Convert.ToInt32(Request.Form[BaseDto.FLD_Id]); GridRowDto row = gridRows.SingleOrDefault(r => r.Id.Equals(rowId)); foreach (GridColumnDto column in grid.Columns) { DucValueDto cell = row.Cells.SingleOrDefault(o => o.DucId.Equals(column.Id)); if (cell != null) { CollectValues(cell, Request.Form, column.ColumnType, reference); } } IFacadeUpdateResult <GridRowData> result = Service.SaveGridRow(row); if (result.IsSuccessful) { GridRowDto savedRow = result.ToDto(new GridRowConverter()); gridRows.Remove(row); gridRows.Add(savedRow); } } break; case AjaxCallBackMode.AddRow: bool isValid = ValidateInput(); if (isValid) { GridRowDto newRow = new GridRowDto(); newRow.ReferenceId = referenceId; newRow.GridId = jqGridID; List <DucValueDto> cells = new List <DucValueDto>(); newRow.Cells = cells; foreach (GridColumnDto column in grid.Columns) { DucValueDto cell = new DucValueDto(); cell.DucId = column.Id; CollectValues(cell, Request.Form, column.ColumnType, reference); cells.Add(cell); } IFacadeUpdateResult <GridRowData> result = Service.SaveGridRow(newRow); if (result.IsSuccessful) { GridRowDto savedRow = result.ToDto(new GridRowConverter()); gridRows.Add(savedRow); } } break; case AjaxCallBackMode.DeleteRow: int deleteRowId = Convert.ToInt32(Request.Form[BaseDto.FLD_Id]); bool isDeleteSuccessful = Service.DeleteGridRow(deleteRowId); gridRows.Remove(gridRows.SingleOrDefault(o => o.Id.Equals(deleteRowId))); break; } return(ConvertToJson(grid, gridRows)); }
public async Task <IEnumerable <CounterpartyDto> > GetBankBrokerAsync(string company, EntitySearchRequest searchRequest, GridDto grid) { var dynamicQueryDefinition = AutoMapper.Mapper.Map <DynamicQueryDefinition>(searchRequest); var columnConfiguration = AutoMapper.Mapper.Map <List <ColumnConfiguration> >(grid.Columns); BuildQueryResult buildQueryResult; var companyDate = await _systemDateTimeService.GetCompanyDate(company); var dataVersionId = await _systemDateTimeService.GetCompanyCurrentDataVersionId(company); buildQueryResult = DynamicQueryBuilder.BuildQuery(company, _identityService.GetUserName(), dynamicQueryDefinition, "[Configuration].[Vw_BankBrokerCounterPartyListAndSearch]", columnConfiguration, companyDate, null, null); var bankResults = await ExecuteDynamicQueryAsync <CounterpartyDto>(buildQueryResult.Sql, buildQueryResult.Parameters); return(bankResults.ToList()); }
/// <summary> /// Returns the list of trades for bulk edit /// </summary> /// <param name="company"> The company code</param> /// <param name="searchRequest">List and search request</param> /// <param name="grid"> the grid details</param> public async Task <IEnumerable <SectionBulkEditDto> > GetContractsForBulkEdit(string company, EntitySearchRequest searchRequest, GridDto grid) { var dynamicQueryDefinition = _mapper.Map <DynamicQueryDefinition>(searchRequest); var columnConfiguration = _mapper.Map <List <ColumnConfiguration> >(grid.Columns); var companyDate = await _systemDateTimeService.GetCompanyDate(company); var userDepartments = (await _userService.GetUserByIdAsync(_identityService.GetUserAtlasId(), false)).Permissions .FirstOrDefault(permission => permission.CompanyId == company) .Departments.Select(department => department.DepartmentId).ToList(); var dataVersionId = searchRequest.DataVersionId ?? await _systemDateTimeService.GetCompanyCurrentDataVersionId(company); var buildQueryResult = DynamicQueryBuilder.BuildQuery(company, _identityService.GetUserName(), dynamicQueryDefinition, "[Configuration].[Vw_TradeListAndSearch]", columnConfiguration, companyDate, dataVersionId, userDepartments); var bulkEditResults = await ExecuteDynamicQueryAsync <SectionBulkEditDto>(buildQueryResult.Sql, buildQueryResult.Parameters); return(bulkEditResults.ToList()); }