public string GetVariables() { string result = string.Empty; result += Name + "=" + initialValue.ToString() + Environment.NewLine; result += InFlow.GetVariables() + OutFlow.GetVariables(); return(result); }
public async Task <IViewComponentResult> InvokeAsync(string idForm) { var user = await _userHandler.GetUserAsync(HttpContext.User); List <string> partIds = await _userHandler.GetAllowPartsForView(user, idForm); FilterHandler handlerFilter = new FilterHandler(_context, idForm, user, _userHandler); Incomer incomer = await handlerFilter.GetIncomerDataAsync(); TypeQuery typeQuery = await handlerFilter.GetTypeQueryAsync(); OutFlow outFlow = await handlerFilter.GetStackFlowAsync(incomer, typeQuery); IList <MtdStore> mtdStore = outFlow.MtdStores; decimal count = (decimal)outFlow.Count / incomer.PageSize; pageCount = Convert.ToInt32(Math.Round(count, MidpointRounding.AwayFromZero)); pageCount = pageCount == 0 ? 1 : pageCount; IList <string> storeIds = mtdStore.Select(s => s.Id).ToList(); IList <string> fieldIds = fieldIds = incomer.FieldForColumn.Select(x => x.Id).ToList(); IList <string> allowFiieldIds = await _context.MtdFormPartField.Where(x => partIds.Contains(x.MtdFormPart)).Select(x => x.Id).ToListAsync(); fieldIds = allowFiieldIds.Where(x => fieldIds.Contains(x)).ToList(); StackHandler handlerStack = new StackHandler(_context); IList <MtdStoreStack> mtdStoreStack = await handlerStack.GetStackAsync(storeIds, fieldIds); IList <MtdStoreApproval> mtdStoreApprovals = await _context.MtdStoreApproval.Where(x => storeIds.Contains(x.Id)).ToListAsync(); List <ApprovalStore> approvalStores = await ApprovalHandler.GetStoreStatusAsync(_context, storeIds, user); bool isApprovalForm = await ApprovalHandler.IsApprovalFormAsync(_context, idForm); RowsModelView rowsModel = new RowsModelView { IdForm = idForm, SearchNumber = incomer.SearchNumber, PageCount = pageCount, MtdFormPartFields = incomer.FieldForColumn.Where(x => fieldIds.Contains(x.Id)).ToList(), MtdStores = mtdStore, MtdStoreStack = mtdStoreStack, WaitList = incomer.WaitList == 1 ? true : false, ShowDate = await handlerFilter.IsShowDate(), ShowNumber = await handlerFilter.IsShowNumber(), ApprovalStores = approvalStores, IsAppromalForm = isApprovalForm }; return(View("Default", rowsModel)); }
public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 23 + Date.GetHashCode(); hash = hash * 23 + Payee.GetHashCode(); hash = hash * 23 + Memo.GetHashCode(); hash = hash * 23 + Inflow.GetHashCode(); hash = hash * 23 + OutFlow.GetHashCode(); return(hash); } }
public string Render() { string result = string.Empty; if (InFlow == null || OutFlow == null) { return(result); } result = GetVariables(); result += Name + "'=" + "(" + InFlow.Render() + ")" + "-(" + OutFlow.Render() + ")"; return(result); }
public async Task <IActionResult> PostExportAsync() { var data = Request.Form["InputFormForExport"]; if (data.FirstOrDefault() == null || data.FirstOrDefault().Equals(string.Empty)) { return(NotFound()); } string idForm = data.FirstOrDefault(); var user = await _userHandler.GetUserAsync(User); List <string> partIds = await _userHandler.GetAllowPartsForView(user, idForm); FilterHandler handlerFilter = new FilterHandler(_context, idForm, user, _userHandler); MtdFilter mtdFilter = await handlerFilter.GetFilterAsync(); if (mtdFilter == null) { return(NotFound()); } Incomer incomer = await handlerFilter.GetIncomerDataAsync(); TypeQuery typeQuery = await handlerFilter.GetTypeQueryAsync(); incomer.PageSize = 1000; OutFlow outFlow = await handlerFilter.GetStackFlowAsync(incomer, typeQuery); IList <MtdStore> mtdStore = outFlow.MtdStores; IList <string> storeIds = mtdStore.Select(s => s.Id).ToList(); IList <string> fieldIds = incomer.FieldForColumn.Select(x => x.Id).ToList(); IList <string> allowFiieldIds = await _context.MtdFormPartField.Where(x => partIds.Contains(x.MtdFormPart)).Select(x => x.Id).ToListAsync(); fieldIds = allowFiieldIds.Where(x => fieldIds.Contains(x)).ToList(); StackHandler handlerStack = new StackHandler(_context); IList <MtdStoreStack> mtdStoreStack = await handlerStack.GetStackAsync(storeIds, fieldIds); IList <MtdFormPartField> columns = incomer.FieldForColumn.Where(x => fieldIds.Contains(x.Id)).ToList(); IWorkbook workbook = CreateWorkbook(mtdStore, columns, mtdStoreStack); workbook.WriteExcelToResponse(HttpContext, "OrderMakerList.xlsx"); return(Ok()); }
public async Task <IActionResult> PostExportAsync() { IFormCollection requestForm = await Request.ReadFormAsync(); var data = requestForm["InputFormForExport"]; if (data.FirstOrDefault() == null || data.FirstOrDefault().Equals(string.Empty)) { return(NotFound()); } string idForm = data.FirstOrDefault(); var user = await _userHandler.GetUserAsync(User); List <string> partIds = await _userHandler.GetAllowPartsForView(user, idForm); FilterHandler handlerFilter = new FilterHandler(_context, idForm, user, _userHandler); MtdFilter mtdFilter = await handlerFilter.GetFilterAsync(); if (mtdFilter == null) { return(NotFound()); } Incomer incomer = await handlerFilter.GetIncomerDataAsync(); TypeQuery typeQuery = await handlerFilter.GetTypeQueryAsync(); incomer.PageSize = 1000; OutFlow outFlow = await handlerFilter.GetStackFlowAsync(incomer, typeQuery); IList <MtdStore> mtdStore = outFlow.MtdStores; IList <string> storeIds = mtdStore.Select(s => s.Id).ToList(); IList <string> fieldIds = incomer.FieldForColumn.Select(x => x.Id).ToList(); IList <string> allowFiieldIds = await _context.MtdFormPartField.Where(x => partIds.Contains(x.MtdFormPart)).Select(x => x.Id).ToListAsync(); fieldIds = allowFiieldIds.Where(x => fieldIds.Contains(x)).ToList(); StackHandler handlerStack = new StackHandler(_context); IList <MtdStoreStack> mtdStoreStack = await handlerStack.GetStackAsync(storeIds, fieldIds); IList <MtdFormPartField> columns = incomer.FieldForColumn.Where(x => fieldIds.Contains(x.Id)).ToList(); IWorkbook workbook = CreateWorkbook(mtdStore, columns, mtdStoreStack); var ms = new NpoiMemoryStream { AllowClose = false }; workbook.Write(ms); ms.Flush(); ms.Seek(0, SeekOrigin.Begin); ms.AllowClose = true; return(new FileStreamResult(ms, new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) { FileDownloadName = $"{DateTime.UtcNow:yyyyMMddHHmmss}.xlsx" }); return(Ok()); }