示例#1
0
        static void Main(string[] args)
        {
            List <Contract> listContrato = new List <Contract>();

            Console.WriteLine("Enter contract data");
            Console.Write("Number: ");
            int contractNumber = int.Parse(Console.ReadLine());

            Console.Write("Date (dd/MM/yyyy): ");
            DateTime contractDate = DateTime.Parse(Console.ReadLine());

            Console.Write("Contract value: ");
            double contractValue = double.Parse(Console.ReadLine());

            Console.Write("Enter number of installments: ");
            int months = int.Parse(Console.ReadLine());

            Contract contract = new Contract(contractNumber, contractDate, contractValue);

            ContratService contractService = new ContratService(new PayPal());

            contractService.processContract(contract, months);

            Console.WriteLine("Installments:");
            foreach (Installment installment in contract.Installments)
            {
                Console.WriteLine(installment);
            }
        }
        protected async override Task OnInitializedAsync()
        {
            int.TryParse(Id, out int contratId);
            if (contratId != 0)
            {
                PageHeeaderText = "Modifier le contrat";
                Contrat         = await ContratService.GetContrat(int.Parse(Id));
            }
            else
            {
                PageHeeaderText = "Nouveau contrat";
                Contrat         = new Contrat
                {
                    CodeContrat    = "Saisir-un-code-unique",
                    DebutContrat   = DateTime.Now,
                    DureContrat    = 0,
                    IdOffre        = 1,
                    IdTypeContrat  = 1,
                    FichierContrat = "Ficher.pdf"
                };
            }

            Offres       = (await OffreService.GetOffres()).ToList();
            TypeContrats = (await TypeContratService.GetTypeContrats()).ToList();
            Mapper.Map(Contrat, EditContratModel);
        }
示例#3
0
        protected async Task ConfirmDelete_Click(bool deleteConfirmed)
        {
            if (deleteConfirmed)
            {
                await ContratService.DeleteContrat(Contrat.Id);

                await OnContratDeleted.InvokeAsync(Contrat.Id);
            }
        }
        protected async Task HandleValidSubmit()
        {
            Mapper.Map(EditContratModel, Contrat);
            Contrat result = null;

            if (Contrat.Id != 0)
            {
                result = await ContratService.UpdateContrat(Contrat);
            }
            else
            {
                result = await ContratService.AddContrat(Contrat);
            }
            if (result != null)
            {
                NavigationManager.NavigateTo("/");
            }
        }
 protected async override Task OnInitializedAsync()
 {
     //Si la valuer {id} n'est pas précisée dans l'URL d'Api, la valeur par défaut sera 1.
     Id      = Id ?? "1";
     Contrat = await ContratService.GetContrat(int.Parse(Id));
 }
示例#6
0
 protected async Task ContratDeleted()
 {
     Contrats = (await ContratService.GetContrats()).ToList();
 }
示例#7
0
 protected override async Task OnInitializedAsync()
 {
     Contrats = (await ContratService.GetContrats()).ToList();
 }
        protected async Task Delete_Click()
        {
            await ContratService.DeleteContrat(Contrat.Id);

            NavigationManager.NavigateTo("/");
        }
 public ContratsController()
 {
     contratService = new ContratService();
     userService    = new UserService();
     annonceService = new AnnonceService();
 }
示例#10
0
 public ContratsController()
 {
     contratService = new ContratService();
 }