コード例 #1
0
        public async Task <decimal> GetTenderPurshasesReportTotalAmount(TenderSearchCriteriaModel criteria)
        {
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var result = await _reportsService.GetTenderPurshasesReportTotalAmount(tenderSearchCriteria);

            return(result);
        }
コード例 #2
0
        public async Task <ActionResult> EnquirySupplierListPagingAsync(TenderSearchCriteriaModel criteria)
        {
            try
            {
                if (string.IsNullOrEmpty(criteria.Sort))
                {
                    criteria.Sort = "SubmitionDate";
                }
                var result = await _ApiClient.GetQueryResultAsync <TenderInformationModel>("Tender/GetAllTendersHasEnquiry", criteria.ToDictionary());

                return(Json(new PaginationModel(result.Items, result.TotalCount, result.PageSize, result.PageNumber, null)));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
            catch (BusinessRuleException ex)
            {
                AddError(ex.Message);
                return(RedirectToAction(nameof(SupplierEnquiryList)));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString(), ex);
                AddError(Resources.TenderResources.ErrorMessages.UnexpectedError);
                return(RedirectToAction(nameof(SupplierEnquiryList)));
            }
        }
コード例 #3
0
ファイル: OfferProxy.cs プロジェクト: lulzzz/UITest-POC
        public static async Task <QueryResult <BasicTenderModel> > GetAsync(TenderSearchCriteriaModel criteria)
        {
            //Deserializing the response recieved from web api and storing into the Tender List
            var tenderList = JsonConvert.DeserializeObject <QueryResult <BasicTenderModel> >(await apiRequest.GetAsync("Tender/GetTendersBySearchCriteria?" + UrlHelper.ToQueryString(criteria)));

            return(tenderList);
        }
コード例 #4
0
        public async Task <ActionResult> TenderPurshasesReportTotalAmount(TenderSearchCriteriaModel tenderSearchCriteria)
        {
            tenderSearchCriteria.ToLastOfferPresentationDate   = tenderSearchCriteria.ToLastOfferPresentationDateString;
            tenderSearchCriteria.FromLastOfferPresentationDate = tenderSearchCriteria.FromLastOfferPresentationDateString;
            var result = await _ApiClient.GetAsync <decimal>("Reports/GetTenderPurshasesReportTotalAmount", tenderSearchCriteria.ToDictionary());

            return(Json(result));
        }
コード例 #5
0
        public async Task <ActionResult> TenderPurshasesReportPagingAsync(TenderSearchCriteriaModel tenderSearchCriteria)
        {
            tenderSearchCriteria.ToLastOfferPresentationDate   = tenderSearchCriteria.ToLastOfferPresentationDateString;
            tenderSearchCriteria.FromLastOfferPresentationDate = tenderSearchCriteria.FromLastOfferPresentationDateString;
            var result = await _ApiClient.GetQueryResultAsync <PurchaseModel>("Reports/GetTendersPurshasesReportList", tenderSearchCriteria.ToDictionary());

            return(Json(new PaginationModel(result.Items, result.TotalCount, result.PageSize, result.PageNumber, null)));
        }
コード例 #6
0
        public async Task <ActionResult> ReportCountTenderCountsReportAsync(TenderSearchCriteriaModel tenderSearchCriteria)
        {
            tenderSearchCriteria.FromLastOfferPresentationDate = tenderSearchCriteria.FromLastOfferPresentationDateString;
            tenderSearchCriteria.ToLastOfferPresentationDate   = tenderSearchCriteria.ToLastOfferPresentationDateString;

            var result = await _ApiClient.GetListAsync <TenderCountsModel>("Reports/ReportGetTendersCountReportAsync", tenderSearchCriteria.ToDictionary());

            return(Json(result));
        }
コード例 #7
0
        public async Task <byte[]> DownloadTenderPurchaseReport(TenderSearchCriteriaModel criteria)
        {
            criteria.PageSize = 999;
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var tenders = await _reportsService.GetTendersPurshasesReportList(tenderSearchCriteria);

            byte[] fileContents;

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Report");
                int rowNum    = 1;
                //  for cell on row1 col1
                worksheet.View.RightToLeft                        = true;
                worksheet.Cells[rowNum, 1].Value                  = Resources.TenderResources.DisplayInputs.TenderName;
                worksheet.Cells[rowNum, 1].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 1].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 1].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 2].Value                  = Resources.TenderResources.DisplayInputs.TenderPurshasingDate;
                worksheet.Cells[rowNum, 2].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 2].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 2].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 3].Value                  = Resources.TenderResources.DisplayInputs.CommercialName;
                worksheet.Cells[rowNum, 3].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 3].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 3].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 4].Value                  = Resources.TenderResources.DisplayInputs.CommercialNumber;
                worksheet.Cells[rowNum, 4].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 4].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 4].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 5].Value                  = Resources.TenderResources.DisplayInputs.ConditionsBookletValueRiyal;
                worksheet.Cells[rowNum, 5].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 5].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 5].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                if (tenders.Items.Count() > 0)
                {
                    foreach (PurchaseModel tenderItem in tenders.Items)
                    {
                        rowNum++;
                        worksheet.Cells[rowNum, 1].Value = tenderItem.TenderName;
                        worksheet.Cells[rowNum, 2].Value = tenderItem.PurshaseDate.ToString();
                        worksheet.Cells[rowNum, 3].Value = tenderItem.CommericalRegisterName;
                        worksheet.Cells[rowNum, 4].Value = tenderItem.CommericalRegisterNo;
                        worksheet.Cells[rowNum, 5].Value = tenderItem.ConditionsBookletPrice;
                    }
                }

                fileContents = package.GetAsByteArray();
            }

            return(fileContents);
        }
コード例 #8
0
        public async Task <ActionResult> SupplierPurshasesReportPagingAsync([FromQuery] TenderSearchCriteriaModel tenderSearchCriteria)
        {
            tenderSearchCriteria.ToLastOfferPresentationDate   = tenderSearchCriteria.ToLastOfferPresentationDateString;
            tenderSearchCriteria.FromLastOfferPresentationDate = tenderSearchCriteria.FromLastOfferPresentationDateString;

            //var result = await TenderProxy.FindSuppliersPurshaseReport(tenderSearchCriteria);
            var result = await _ApiClient.GetQueryResultAsync <BasicTenderModel>("Reports/FindSuppliersPurshaseReport", tenderSearchCriteria.ToDictionary());

            return(Json(new PaginationModel(result.Items, result.TotalCount, result.PageSize, result.PageNumber, null)));
        }
コード例 #9
0
        public async Task <QueryResult <BasicTenderModel> > GetTendersReportList(TenderSearchCriteriaModel criteria)
        {
            bool statusFlag = true;

            if (User.IsInRole(RoleNames.DataEntry) || User.IsInRole(RoleNames.Auditer))
            {
                statusFlag = false;
            }
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var tenders = await _reportsService.GetTendersReportList(tenderSearchCriteria);

            return(_mapper.Map <QueryResult <BasicTenderModel> >(tenders, opt => opt.Items["statusFlag"] = statusFlag));
        }
コード例 #10
0
        public async Task <IActionResult> DownloadSupplierPurchaseReport(TenderSearchCriteriaModel tenderSearchCriteria)
        {
            tenderSearchCriteria.ToLastOfferPresentationDate   = tenderSearchCriteria.ToLastOfferPresentationDateString;
            tenderSearchCriteria.FromLastOfferPresentationDate = tenderSearchCriteria.FromLastOfferPresentationDateString;
            var downloadFileContents = await _ApiClient.GetAsync <byte[]>("Reports/DownloadSupplierPurchaseReportAsync", tenderSearchCriteria.ToDictionary());

            if (downloadFileContents == null || downloadFileContents.Length == 0)
            {
                return(NotFound());
            }
            return(File(
                       fileContents: downloadFileContents,
                       contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                       fileDownloadName: Resources.SharedResources.DisplayInputs.PurshasesReport + ".xlsx"
                       ));
        }
コード例 #11
0
        public async Task <byte[]> DownloadTenderReport(TenderSearchCriteriaModel criteria)
        {
            criteria.PageSize = 999;
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var tenders = await _reportsService.GetTendersReportList(tenderSearchCriteria);

            var mapedTenders = _mapper.Map <QueryResult <BasicTenderModel> >(tenders, opt => opt.Items["statusFlag"] = true);

            byte[] fileContents;

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Report");
                int rowNum    = 1;
                //  for cell on row1 col1
                worksheet.Cells[rowNum, 1].Value                  = Resources.TenderResources.DisplayInputs.TenderName;
                worksheet.Cells[rowNum, 1].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 1].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 1].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 2].Value                  = Resources.TenderResources.DisplayInputs.SubmtionDate;
                worksheet.Cells[rowNum, 2].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 2].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 2].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 3].Value                  = Resources.TenderResources.DisplayInputs.TenderStatus;
                worksheet.Cells[rowNum, 3].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 3].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 3].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                if (mapedTenders.Items.Count() > 0)
                {
                    foreach (BasicTenderModel tenderItem in mapedTenders.Items)
                    {
                        rowNum++;
                        worksheet.Cells[rowNum, 1].Value = tenderItem.TenderName;
                        worksheet.Cells[rowNum, 2].Value = tenderItem.SubmitionDate.ToString();
                        worksheet.Cells[rowNum, 3].Value = tenderItem.TenderStatusName;
                    }
                }

                fileContents = package.GetAsByteArray();
            }

            return(fileContents);
        }
コード例 #12
0
        public async Task <List <TenderCountsModel> > ReportGetTendersCountReportAsync(TenderSearchCriteriaModel criteria)
        {
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var tenders = await _reportsService.ReportGetTendersCountReportAsync(tenderSearchCriteria);

            int total = _reportsService.GetTendersCountReportsCount(tenderSearchCriteria);

            foreach (var item in tenders)
            {
                item.Percent = string.Format("{0:0.00}", (item.Count / total) * 100);;
            }

            return(tenders);
        }
コード例 #13
0
        public async Task <byte[]> DownloadSupplierPurchaseReport(TenderSearchCriteriaModel criteria)
        {
            criteria.PageSize = 999;
            bool statusFlag = true;

            if (User.IsInRole(RoleNames.DataEntry) || User.IsInRole(RoleNames.Auditer))
            {
                statusFlag = false;
            }
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var tenders = await _reportsService.FindSuppliersPurshaseReport(tenderSearchCriteria);

            QueryResult <BasicTenderModel> model = _mapper.Map <QueryResult <BasicTenderModel> >(tenders, opt => opt.Items["statusFlag"] = statusFlag);

            foreach (var item in model.Items)
            {
                var conditionBook = item.ConditionsBooklets.FirstOrDefault();
                var invitation    = item.Invitations.FirstOrDefault();

                if (conditionBook != null)
                {
                    if (conditionBook.ConfirmPurchase)
                    {
                        item.InvitationStatus += Resources.TenderResources.DisplayInputs.Paid;
                    }
                    else
                    {
                        item.InvitationStatus += Resources.TenderResources.DisplayInputs.NotPaid;
                    }
                }

                if (invitation != null)
                {
                    item.InvitationStatus += invitation.InvitationStatus.NameAr;
                }

                if (string.IsNullOrEmpty(item.InvitationStatus))
                {
                    item.InvitationStatus = "-";
                }
            }

            // start casting report to Exel over byte arr
            byte[] fileContents;

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Report");
                worksheet.View.RightToLeft = true;

                int rowNum = 1;
                //  for cell on row1 col1
                worksheet.Cells[rowNum, 1].Value                  = Resources.TenderResources.DisplayInputs.TenderName;
                worksheet.Cells[rowNum, 1].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 1].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 1].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 2].Value                  = Resources.TenderResources.DisplayInputs.TenderNumber;
                worksheet.Cells[rowNum, 2].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 2].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 2].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 3].Value                  = Resources.TenderResources.DisplayInputs.TenderType;
                worksheet.Cells[rowNum, 3].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 3].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 3].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 4].Value                  = Resources.TenderResources.DisplayInputs.SubmtionDate;
                worksheet.Cells[rowNum, 4].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 4].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 4].Style.Border.Top.Style = ExcelBorderStyle.Hair;

                worksheet.Cells[rowNum, 5].Value                  = Resources.TenderResources.DisplayInputs.InvitationPurchaseStatus;
                worksheet.Cells[rowNum, 5].Style.Font.Size        = 12;
                worksheet.Cells[rowNum, 5].Style.Font.Bold        = true;
                worksheet.Cells[rowNum, 5].Style.Border.Top.Style = ExcelBorderStyle.Hair;


                if (tenders.Items.Count() > 0)
                {
                    foreach (BasicTenderModel tenderItem in model.Items)
                    {
                        rowNum++;
                        worksheet.Cells[rowNum, 1].Value = tenderItem.TenderName;
                        worksheet.Cells[rowNum, 2].Value = tenderItem.TenderNumber;
                        worksheet.Cells[rowNum, 3].Value = tenderItem.TenderTypeName;
                        worksheet.Cells[rowNum, 4].Value = tenderItem.SubmitionDate;
                        worksheet.Cells[rowNum, 5].Value = tenderItem.InvitationStatus;
                    }
                }

                fileContents = package.GetAsByteArray();
            }

            return(fileContents);
        }
コード例 #14
0
        public async Task <QueryResult <BasicTenderModel> > FindSuppliersPurshaseReport(TenderSearchCriteriaModel criteria)
        {
            bool statusFlag = true;

            if (User.IsInRole(RoleNames.DataEntry) || User.IsInRole(RoleNames.Auditer))
            {
                statusFlag = false;
            }
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var tenders = await _reportsService.FindSuppliersPurshaseReport(tenderSearchCriteria);

            QueryResult <BasicTenderModel> model = _mapper.Map <QueryResult <BasicTenderModel> >(tenders, opt => opt.Items["statusFlag"] = statusFlag);

            foreach (var item in model.Items)
            {
                var conditionBook = item.ConditionsBooklets.FirstOrDefault();
                var invitation    = item.Invitations.FirstOrDefault();

                if (conditionBook != null)
                {
                    if (conditionBook.ConfirmPurchase)
                    {
                        item.InvitationStatus += Resources.TenderResources.DisplayInputs.Paid;
                    }
                    else
                    {
                        item.InvitationStatus += Resources.TenderResources.DisplayInputs.NotPaid;
                    }
                }

                if (invitation != null)
                {
                    item.InvitationStatus += invitation.InvitationStatus.NameAr;
                }

                if (string.IsNullOrEmpty(item.InvitationStatus))
                {
                    item.InvitationStatus = "-";
                }
            }

            return(model);
        }
コード例 #15
0
        public async Task <QueryResult <PurchaseModel> > GetTendersPurshasesReportList(TenderSearchCriteriaModel criteria)
        {
            var tenderSearchCriteria = _mapper.Map <TenderSearchCriteria>(criteria);
            var tenders = await _reportsService.GetTendersPurshasesReportList(tenderSearchCriteria);

            return(tenders);
        }