public async Task <QuantitiesTemplateModel> GetQuantityTablesForDirectPurchase(int tenderId, int offerId) { QuantitiesTemplateModel lst = new QuantitiesTemplateModel(); var Qitems = await _offerQueries.GetSupplierQTableItemsForDirectPurchase(offerId); lst.QuantitiesItems = Qitems; return(lst); }
public async Task <IViewComponentResult> InvokeAsync(string offerIdString, bool allowEdit) { QuantitiesTemplateModel qtableHtml = new QuantitiesTemplateModel(); if (offerIdString == null) { } else { qtableHtml = await _ApiClient.GetAsync <QuantitiesTemplateModel>("Offer/GetOpeningQuantityTablesTest/" + Util.Decrypt(offerIdString) + "/" + allowEdit, null); } return(View(qtableHtml)); }
public async Task <QueryResult <TableModel> > GetOfferTableQuantityItemsVRO(QuantityTableSearchCretriaModel quantityTableSearchCretriaModel) { var cellsCount = 0; cellsCount = await _offerQueries.GetOfferTableQuantityItems(quantityTableSearchCretriaModel.QuantityTableId); quantityTableSearchCretriaModel.CellsCount = cellsCount; var offer = await _offerQueries.FindOfferWithStatusById(quantityTableSearchCretriaModel.OfferId); var quantityItems = await _offerQueries.GetSupplierQTableItemsForChecking(quantityTableSearchCretriaModel); QuantitiesTemplateModel lst = await _offerQueries.GetOfferQuantityItems(quantityTableSearchCretriaModel.OfferId, quantityTableSearchCretriaModel.QuantityTableId); lst.QuantitiesItems = quantityItems.Items.ToList(); if (lst == null) { lst = new QuantitiesTemplateModel(); } lst.grid = new List <string>(); lst.ActivityTemplates = new List <int> { (int)TenderActivityTamplate.OldSystemAndVRO }; foreach (var item in lst.ActivityTemplates) { FormConfigurationDTO DTOModel = new FormConfigurationDTO() { SubmitAction = "/Offer/SaveVROCheckingQuantityItem", TenderId = quantityTableSearchCretriaModel.TenderId, HasAlternative = offer.Tender.HasAlternativeOffer ?? false, ApplySelected = offer.Tender.HasAlternativeOffer ?? false, CanEditAlternative = ((_httpContextAccessor.HttpContext.User.IsInRole(RoleNames.OffersOpeningAndCheckSecretary) && (offer.Tender.TenderStatusId == (int)Enums.TenderStatus.VROFinancialCheckingOpening || offer.Tender.TenderStatusId == (int)Enums.TenderStatus.VROOffersFinancialChecking))) ? true : false, AllowEdit = false, ActivityId = 1, EncryptedOfferId = Util.Encrypt(quantityTableSearchCretriaModel.OfferId), EncryptedTenderId = Util.Encrypt(quantityTableSearchCretriaModel.TenderId), QuantityItemDtos = lst.QuantitiesItems.ToList(), YearsCount = (offer.Tender.TemplateYears ?? 0) }; ApiResponse <List <HtmlTemplateDto> > resultList = new ApiResponse <List <HtmlTemplateDto> >(); ApiResponse <HtmlTemplateDto> resultItem = new ApiResponse <HtmlTemplateDto>(); if (_httpContextAccessor.HttpContext.User.IsInRole(RoleNames.OffersOpeningAndCheckSecretary) && (offer.Tender.TenderStatusId == (int)Enums.TenderStatus.VROOffersFinancialChecking || offer.Tender.TenderStatusId == (int)Enums.TenderStatus.VROFinancialCheckingOpening)) { resultList = resultList = await _qantityTemplatesProxy.GetMonafasatSupplierForChecking(DTOModel); } else { resultList = await _qantityTemplatesProxy.GenerateSupplierReadOnlyTemplate(DTOModel); } HTMLObject obje = new HTMLObject(); ApiResponse <List <HtmlTemplateDto> > obj = new ApiResponse <List <HtmlTemplateDto> > { Data = resultList.Data }; if (obj.Data != null && obj.Data.Count > 0 && obj.Data[0] != null) { lst.grid.AddRange(obj.Data.Select(a => a.FormHtml).ToList()); obje.grid.AddRange(obj.Data.Select(a => a.FormHtml).ToList()); lst.grids.AddRange(obj.Data.GroupBy(o => new { o.FormId, o.FormName, o.TemplateName, o.FormExcellTemplate }).Select(o => new HTMLObject { FormId = o.Key.FormId, FormName = o.Key.FormName, TemplateName = o.Key.TemplateName, FormExcellTemplate = _configuration.APIConfiguration.QuantityTemplates + "/api/QuantityTable/" + o.Key.FormExcellTemplate, Javascript = o.FirstOrDefault().JsScript, gridTables = o.Select(u => new TableModel { TableHtml = u.FormHtml, TableId = u.TableId, TableName = !string.IsNullOrEmpty(u.TableName) ? u.TableName : "اسم الجدول", FormId = u.FormId, DeleteFormHtml = u.DeleteFormHtml, EditFormHtml = u.EditFormHtml, Javascript = u.JsScript }).ToList() }).ToList()); } } lst.IsReadOnly = quantityTableSearchCretriaModel.IsReadOnly; return(new QueryResult <TableModel>(lst.grids[0].gridTables.ToList(), quantityItems.TotalCount, quantityTableSearchCretriaModel.PageNumber, quantityTableSearchCretriaModel.PageSize * cellsCount)); }