コード例 #1
0
    /// <summary>
    /// Instancia a imagem imagemIniciarSistema sobre o sistema escolhido para facilitar a visualização de que deve ser
    /// selecionado novamente para entrar
    /// </summary>
    /// <param name="systemNumber"></param>
    public static void ReadyToGoToSystem(int systemNumber)
    {
        SystemRecognizer systemRecognizer = GameObject.Find("Main Camera").GetComponent <SystemRecognizer>();

        Destroy(initImage);
        initImage = Instantiate(systemRecognizer.imagemIniciarSistema, GameObject.Find("Canvas").transform);
        initImage.transform.position = systems[systemNumber].transform.position;
    }
コード例 #2
0
        /* new action to be deleted if not working VV */
        protected async Task <InvoiceFile> GetGeneratedPDF(int id)
        {
            try
            {
                var invoiceWithAll = await _repositoryWrapper.Invoice.GetInvoiceWihtAllDetailsForInvoiceGeneration(id);

                // Add Application user to get access for email data
                ApplicationUser landlordAspUser = invoiceWithAll.Rent.Landlord.ApplicationUser;
                ApplicationUser tenantAspUser   = invoiceWithAll.Rent.Tenant.ApplicationUser;
                Invoice         invoice         = _mapper.Map <Invoice>(invoiceWithAll);
                Rent            rent            = _mapper.Map <Rent>(invoiceWithAll.Rent);
                Tenant          tenant          = _mapper.Map <Tenant>(invoiceWithAll.Rent.Tenant);
                Property        property        = _mapper.Map <Property>(invoiceWithAll.Rent.Property);
                Landlord        landlord        = _mapper.Map <Landlord>(invoiceWithAll.Rent.Landlord);
                Photo           photo           = _mapper.Map <Photo>(invoiceWithAll.State.Photo);
                Rate            rate            = _mapper.Map <Rate>(invoiceWithAll.Rent.Property.Rate);

                var globalSettings = new GlobalSettings
                {
                    ColorMode   = ColorMode.Color,
                    Orientation = Orientation.Portrait,
                    PaperSize   = PaperKind.A4,
                    Margins     = new MarginSettings {
                        Top = 10
                    },
                    DocumentTitle = "Invoice title",
                };

                InvoiceFile invoiceGenerated = TemplateGenerator.GetInvoiceHTMLString(landlordAspUser, tenantAspUser, invoice, tenant, property, landlord, rent);

                var objectSettings = new ObjectSettings
                {
                    PagesCount     = true,
                    HtmlContent    = invoiceGenerated.getInvoiceString(),
                    WebSettings    = { DefaultEncoding = "utf-8", UserStyleSheet = SystemRecognizer.GetCssFileLocation() },
                    HeaderSettings = { FontName = "Arial", FontSize = 9, Right = "Page [page] of [toPage]", Line = true },
                    FooterSettings = { FontName = "Arial", FontSize = 9, Line = true, Center = "Report Footer" }
                };

                var pdf = new HtmlToPdfDocument()
                {
                    GlobalSettings = globalSettings,
                    Objects        = { objectSettings }
                };

                byte[] file = _converter.Convert(pdf);

                invoiceGenerated.setInvoiceBytes(file);

                return(invoiceGenerated);
            }
            catch (Exception e)
            {
                _logger.LogError($"Something went wrong inside ViewOnWebPDF(id) action: {e.ToString()}");
                return(null);
            }
        }
コード例 #3
0
 public void OnClick()
 {
     if (clicked)
     {
         this.GetComponent <LoadScene>().LoadSceneWithFade(string.Concat("07_stageSelect ", systemNumber.ToString()));
     }
     else
     {
         for (int i = 0; i < SystemRecognizer.numberOfSystems; i++)
         {
             anotherSystem = GameObject.Find(string.Concat("Sistema ", i.ToString()));
             anotherSystem.GetComponent <SystemSelectButtons>().clicked = false;
             anotherSystem.transform.GetChild(0).gameObject.SetActive(false);
         }
         this.clicked = true;
         this.transform.GetChild(0).gameObject.SetActive(true);
         SystemRecognizer.ReadyToGoToSystem(systemNumber);
     }
 }
コード例 #4
0
        public async Task <IActionResult> SendMailToTenantWithPDF(int id)
        {
            try
            {
                var invoiceWithAll = await _repositoryWrapper.Invoice.GetInvoiceWihtAllDetailsForInvoiceGeneration(id);

                // Add Application user to get access for email data
                ApplicationUser landlordAspUser = invoiceWithAll.Rent.Landlord.ApplicationUser;
                ApplicationUser tenantAspUser   = invoiceWithAll.Rent.Tenant.ApplicationUser;
                Invoice         invoice         = _mapper.Map <Invoice>(invoiceWithAll);
                Rent            rent            = _mapper.Map <Rent>(invoiceWithAll.Rent);
                Tenant          tenant          = _mapper.Map <Tenant>(invoiceWithAll.Rent.Tenant);
                Property        property        = _mapper.Map <Property>(invoiceWithAll.Rent.Property);
                Landlord        landlord        = _mapper.Map <Landlord>(invoiceWithAll.Rent.Landlord);
                Photo           photo           = _mapper.Map <Photo>(invoiceWithAll.State.Photo);
                Rate            rate            = _mapper.Map <Rate>(invoiceWithAll.Rent.Property.Rate);

                var globalSettings = new GlobalSettings
                {
                    ColorMode   = ColorMode.Color,
                    Orientation = Orientation.Portrait,
                    PaperSize   = PaperKind.A4,
                    Margins     = new MarginSettings {
                        Top = 10
                    },
                    DocumentTitle = "Invoice title",
                    //Out = SystemRecognizer.GetGeneratedInvoiceFileLocation() // this line will generate an invoice file on in InvoiceGeneratior/invoices folder but wont let generate proper attachment!!
                };

                InvoiceFile invoiceGenerated = TemplateGenerator.GetInvoiceHTMLString(landlordAspUser, tenantAspUser, invoice, tenant, property, landlord, rent);

                var objectSettings = new ObjectSettings
                {
                    PagesCount     = true,
                    HtmlContent    = invoiceGenerated.getInvoiceString(),
                    WebSettings    = { DefaultEncoding = "utf-8", UserStyleSheet = SystemRecognizer.GetCssFileLocation() },
                    HeaderSettings = { FontName = "Arial", FontSize = 9, Right = "Page [page] of [toPage]", Line = true },
                    FooterSettings = { FontName = "Arial", FontSize = 9, Line = true, Center = "Report Footer" }
                };

                var pdf = new HtmlToPdfDocument()
                {
                    GlobalSettings = globalSettings,
                    Objects        = { objectSettings }
                };

                var invoiceFile = _converter.Convert(pdf);

                var message = new Email(
                    new string[] { /*tenant.Email,*/ "*****@*****.**" /*, "*****@*****.**",*/ },
                    $"Nowa Faktura od: {landlord.CompanyName}",
                    $"Nowa faktura do zaplaty za mieszkanie {property.FlatLabel} " +
                    $"{property.Address.City} " +
                    $"{property.Address.Street} " +
                    $"{property.Address.BuildingNumber}/{property.Address.FlatNumber}. Prosimy o terminową wpłatę na konto: {landlord.BankAccount}. ",
                    new List <byte[]> {
                    invoiceFile
                },
                    new List <string> {
                    invoiceGenerated.getInvoiceFileName().Replace('/', '-')
                }
                    );
                await _emailEmmiter.SendMailAsync(message);

                return(Ok());
            }
            catch (Exception e)
            {
                _logger.LogError($"Something went wrong inside SendMailToTenantWithPDF(id) action: {e.ToString()}");
                return(StatusCode(500, e.Message));
            }
        }