示例#1
0
        public void Should_Empty_Construct_BillArchive()
        {
            var billArchive = new BillArchive();

            billArchive.ShouldNotBeNull();
            billArchive.Id.ShouldBe(0);
        }
示例#2
0
        public async Task <BillArchive> CreateAsync(BillArchive billArchive)
        {
            await _context.BillArchives.AddAsync(billArchive);

            await _context.SaveChangesAsync();

            return(billArchive);
        }
示例#3
0
        protected void searchbtn_Click(object sender, EventArgs e)
        {
            int customer_id;

            customer_id = Convert.ToInt32(UserControl1.GetCustID);
            //To use method to populate a gridview in a partial class(aka code behind) for example you can do something like this
            //get the bill
            var bills = Models.LinqQueries.view_billArchive(customer_id);

            //lets go through the bill records
            foreach (var bill in bills)
            {
                //here we can access each element if you want or...
            }
            /*Do this to populate a grid view */

            BillArchive.DataSource = bills;
            BillArchive.DataBind();
        }
示例#4
0
        public void Should_Construct_BillArchive()
        {
            int?         conditionsBookletId   = 1;
            int?         invitationId          = 1;
            const int    tenderId              = 1;
            const string tenderReferenceNumber = "tenderReferenceNumber";
            const string billInvoiceNumber     = "billInvoiceNumber";
            const string agencyCode            = "agencyCode";
            const string supplierNumber        = "supplierNumber";

            var billArchive = new BillArchive(conditionsBookletId, invitationId, tenderId,
                                              tenderReferenceNumber, billInvoiceNumber, agencyCode, supplierNumber);

            billArchive.ShouldNotBeNull();
            billArchive.ConditionsBookletID.ShouldBe(conditionsBookletId);
            billArchive.InvitationId.ShouldBe(invitationId);
            billArchive.TenderId.ShouldBe(tenderId);
            billArchive.TenderReferenceNumber.ShouldBe(tenderReferenceNumber);
            billArchive.BillInvoiceNumber.ShouldBe(billInvoiceNumber);
            billArchive.AgencyCode.ShouldBe(agencyCode);
            billArchive.SupplierNumber.ShouldBe(supplierNumber);
        }
示例#5
0
        private async Task <bool> UploadThroughTahseel(BillModel billModel, BillInfo billInfo)
        {
            NewBillModel objBill                = new NewBillModel();
            decimal      totalAmount            = 0;
            List <RevenueEntryInfoType> revList = new List <RevenueEntryInfoType>();

            foreach (var item in billModel.TenderFees)
            {
                totalAmount += item.FeesValue;
                if (item.FessType == (int)Enums.TenderFeesType.FinantialCostForInvitation)
                {
                    revList.Add(
                        new RevenueEntryInfoType()
                    {
                        BenAgencyId = _benAgencyCodeForInvitations,
                        Amt         = item.FeesValue,
                        GFSCode     = _gFSCODEForInvitations
                    });
                }
                else if (item.FessType == (int)Enums.TenderFeesType.FinantialCostForConditionalBooklet)
                {
                    revList.Add(
                        new RevenueEntryInfoType()
                    {
                        BenAgencyId = _benAgencyCodeForConditionsBooklet,
                        Amt         = item.FeesValue,
                        GFSCode     = _gFSCODEForAddedValue
                    });
                }
                else if (item.FessType == (int)Enums.TenderFeesType.ConditionalBookletPrice)
                {
                    revList.Add(
                        new RevenueEntryInfoType()
                    {
                        BenAgencyId = billModel.ChapterNumber + billModel.BankBranchId + billModel.SectionId + billModel.SequenceNumber + billModel.NumOfSubDepartments + billModel.NumOfSubSections,
                        Amt         = item.FeesValue,
                        GFSCode     = _gFSCODEForConditionalBooklet
                    });
                }
            }
            objBill.RevList   = revList;
            objBill.ClientKey = _clientKey;
            objBill.AmountDue = billModel.AmountDue;
            objBill.DueDate   = billModel.DueDate;
            objBill.ExpDate   = billModel.ExpDate;
            objBill.billRefIdForBillingForSaddad = _billRefIdForBillingForSaddad; objBill.AgencyJebayaCodeForSaddad = _billAgencyJebayaIdentifierForSaddad;
            objBill.SupplierNameAr = billModel.DisplayLabelAr;
            objBill.SupplierNameEn = billModel.DisplayLabelAr;
            var BillInvoiceNumber = await _billProxy.CreateNewBill(objBill);

            if (!string.IsNullOrEmpty(BillInvoiceNumber))
            {
                foreach (var item in billModel.TenderFees)
                {
                    billInfo.BillPaymentDetails.Add(new BillPaymentDetails(item.FeesValue, BillInvoiceNumber, item.GFSCode, item.FessType));
                }
                billInfo.UpdateBillInfo(BillInvoiceNumber, billModel.ChapterNumber, billModel.BankBranchId, billModel.NumOfSubSections, billModel.SequenceNumber, billModel.NumOfSubDepartments, billModel.NumOfSubSections, _billAgencyCodeForSaddad, billModel.DisplayLabelAr, billModel.DisplayLabelEn, billModel.BatchId);
                await _billCommands.UpdateBillAsync(billInfo);

                var    tender = new Tender();
                string cr     = "";
                string CrName = "";
                if (billInfo != null)
                {
                    if (billModel.RequestType == (int)Enums.RequestType.ConditionalBookletRequest)
                    {
                        tender = billInfo.ConditionsBooklet.Tender;
                        CrName = string.IsNullOrEmpty(billInfo.DisplayLabelAr) ? billInfo.DisplayLabelEn : billInfo.DisplayLabelAr;
                        cr     = billInfo.ConditionsBooklet.CommericalRegisterNo;
                    }
                    else
                    {
                        tender = billInfo.Invitation.Tender;
                        CrName = string.IsNullOrEmpty(billInfo.DisplayLabelAr) ? billInfo.DisplayLabelEn : billInfo.DisplayLabelAr;
                        cr     = billInfo.Invitation.CommericalRegisterNo;
                    }
                    NotificationArguments NotificationArgument = new NotificationArguments
                    {
                        BodyEmailArgs = new object[] { CrName, tender.TenderName, BillInvoiceNumber },
                        PanelArgs     = new object[] { BillInvoiceNumber },
                        SMSArgs       = new object[] { BillInvoiceNumber }
                    };
                    MainNotificationTemplateModel billStatusSuccessUploadedForSupplier = new MainNotificationTemplateModel(
                        NotificationArgument,
                        $"Tender/Details?STenderId={Util.Encrypt(tender.TenderId)}",
                        NotificationEntityType.Tender,
                        tender.TenderId.ToString(),
                        tender.BranchId
                        );
                    await _notificationAppService.SendNotificationForSuppliers(NotificationOperations.Supplier.OperationsOnTheTender.sadadgeneratedbill, new List <string> {
                        cr
                    }, billStatusSuccessUploadedForSupplier);
                }
            }
            else
            {
                if (billModel.RequestType == (int)Enums.RequestType.ConditionalBookletRequest)
                {
                    BillArchive billArchiveForCondtionalBooklet = new BillArchive(billInfo.ConditionsBookletID, billInfo.InvitationId, billInfo.ConditionsBooklet.TenderId, billInfo.ConditionsBooklet.Tender.ReferenceNumber, BillInvoiceNumber, billInfo.AgencyCode, billInfo.ConditionsBooklet.CommericalRegisterNo);
                    await _billArchiveCommands.CreateAsync(billArchiveForCondtionalBooklet);

                    billInfo.DeleteBooklet();
                    await _billCommands.DeleteBillAsync(billInfo);
                }
                else
                {
                    if (billInfo.ConditionsBookletID != null)
                    {
                        billInfo.DeleteBooklet();
                    }
                    BillArchive billArchive = new BillArchive(billInfo.ConditionsBookletID, billInfo.InvitationId, billInfo.Invitation.TenderId, billInfo.Invitation.Tender.ReferenceNumber, BillInvoiceNumber, billInfo.AgencyCode, billInfo.Invitation.CommericalRegisterNo);
                    await _billArchiveCommands.CreateWithoutSave(billArchive);

                    await _billCommands.DeleteWithoutSave(billInfo); billInfo.DeleteInvitation();
                    await _billCommands.Save();
                }
                throw new BusinessRuleException(Resources.TenderResources.Messages.IDmSadadDetailsNotExist);
            }
            return(true);
        }
示例#6
0
        public BillArchive GetBillArchiveData()
        {
            BillArchive billArchive = new BillArchive(_conditionalBookletId, 1, 1, "123", _billInvoicenumber, _agencyCode, _cr);

            return(billArchive);
        }
示例#7
0
        public async Task <BillArchive> CreateWithoutSave(BillArchive billArchive)
        {
            await _context.BillArchives.AddAsync(billArchive);

            return(billArchive);
        }