Esempio n. 1
0
 /*
  * Constructor of GraphsUserControl.
  */
 public GraphsUserControl()
 {
     _filesUpload = (Application.Current as App)._filesUpload;
     _vmGraphs    = (Application.Current as App)._vmGraphs;
     DataContext  = _vmGraphs;
     InitializeComponent();
 }
Esempio n. 2
0
        public async Task <IActionResult> Post([FromForm] FilesUpload filesToUpload)
        {
            var blobContainer = _blobServiceClient.GetBlobContainerClient(_blobStorageSettings.ContainerName);
            await blobContainer.CreateIfNotExistsAsync();

            long size = filesToUpload.Files.Sum(f => f?.Length ?? 0);

            if (filesToUpload?.Files == null || size == 0)
            {
                return(BadRequest("No file to upload found"));
            }

            foreach (var formFile in filesToUpload.Files)
            {
                using (var memoryStream = new MemoryStream())
                {
                    await formFile.CopyToAsync(memoryStream);

                    BlobClient blob = blobContainer.GetBlobClient(formFile.FileName);
                    await blob.UploadAsync(memoryStream);
                }
            }

            return(Created("Get", null));
        }
Esempio n. 3
0
 protected void mfMetricValue_Action(object sender, Micajah.Common.WebControls.MagicFormActionEventArgs e)
 {
     if (e.Action == Micajah.Common.WebControls.CommandActions.Cancel)
     {
         FilesUpload.RejectChanges();
         RedirectToGrid(true);
     }
 }
Esempio n. 4
0
        public JsonResult AnexarArquivo(HttpPostedFileBase pdfFile)
        {
            string Path = "~/Attachments";

            if (pdfFile.FileName.EndsWith("pdf"))
            {
                FilesUpload.UploadPhoto(pdfFile, Path);
                string arquivoPdf = string.Format("{0}/{1}", Path, pdfFile);
                return(Json(new { pdfFile }, JsonRequestBehavior.AllowGet));
            }
            return(Json(true));
        }
Esempio n. 5
0
        public ActionResult AttachmentFile(HttpPostedFileBase pdfFile)
        {
            string Path = "~/Attachments";

            if (pdfFile.FileName.EndsWith("pdf"))
            {
                FilesUpload.UploadPhoto(pdfFile, Path);
                string arquivoPdf = string.Format("{0}/{1}", Path, pdfFile);
                return(View());
            }
            return(View());
        }
        public JsonResult FileUpload([FromBody] FilesUpload filesUpload)
        {
            ActionsResult result = new ActionsResult()
            {
                Id      = 0,
                Message = "Error"
            };

            if (filesUpload.Files != null)
            {
                result = ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/ImageUpload", filesUpload);
            }
            return(Json(new { result }));
        }
        public async Task <ActionResult <List <Uri> > > PostImage(List <IFormFile> files)
        {
            List <Uri> urls = new List <Uri>();

            foreach (IFormFile formFile in files)
            {
                var fileUpload = new FilesUpload(formFile);

                Uri tmpUrl = await fileUpload.Excute();

                urls.Add(tmpUrl);
            }

            return(urls);
        }
Esempio n. 8
0
        public async Task <List <ActionsResult> > Post([FromForm] FilesUpload filesUpload)
        {
            var result = new List <ActionsResult>();

            if (filesUpload.Files.Count() > 0)
            {
                try
                {
                    if (!Directory.Exists(webHostEnvironment.WebRootPath + "\\images\\"))
                    {
                        Directory.CreateDirectory(webHostEnvironment.WebRootPath + "\\images\\");
                    }
                    foreach (var file in filesUpload.Files)
                    {
                        var fileName = $"{Guid.NewGuid()}{Path.GetExtension(file.FileName)}";
                        await using (FileStream fileStream = System.IO.File.Create(webHostEnvironment.WebRootPath + "\\images\\" + fileName))
                        {
                            file.CopyTo(fileStream);
                            fileStream.Flush();
                            result.Add(new ActionsResult()
                            {
                                Id      = 1,
                                Message = fileName
                            });
                        }
                    }
                }
                catch (Exception e)
                {
                    result.Add(new ActionsResult()
                    {
                        Id      = 0,
                        Message = e.Message.ToString()
                    });
                }
            }
            else
            {
                result.Add(new ActionsResult()
                {
                    Id      = 0,
                    Message = "Error"
                });
            }
            return(result);
        }
        public async Task <IActionResult> Post([FromForm] FilesUpload filesToUpload, CancellationToken cancellationToken)
        {
            if (filesToUpload?.Files == null)
            {
                return(BadRequest("No file found to upload"));
            }

            long size = filesToUpload.Files.Sum(f => f?.Length ?? 0);

            if (size == 0)
            {
                return(BadRequest("No file found to upload"));
            }

            foreach (var formFile in filesToUpload.Files)
            {
                var fileTempPath = @$ "{Path.GetTempPath()}{formFile.FileName}";

                using (var stream = new FileStream(fileTempPath, FileMode.Create, FileAccess.Write))
                {
                    await formFile.CopyToAsync(stream, cancellationToken);
                }

                var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
                cts.CancelAfter(TimeSpan.FromSeconds(3));

                try
                {
                    var fileWritten = await _fileProcessingChannel.AddFileAsync(fileTempPath, cts.Token);

                    if (!fileWritten)
                    {
                        _logger.LogError($"An error occurred when processing file: {formFile.FileName}");
                        return(StatusCode(500, $"An error occurred when processing file: {formFile.FileName}"));
                    }
                }
                catch (OperationCanceledException) when(cts.IsCancellationRequested)
                {
                    System.IO.File.Delete(fileTempPath);
                    throw;
                }
            }

            return(Ok());
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            _algorithmDll           = new DllAlgorithms();
            _graphModel             = new GraphsModel();
            _vmGraphs               = new VMGraphs(_graphModel);
            _filesUpload            = new FilesUpload();
            _popOutModel            = new PopOutModel();
            _simultorConnectorModel = new SimulatorConnectorModel();
            _dashBoardModel         = new DashBoardModel();
            _joystickModel          = new JoystickModel();
            _joystickDashBoardModel = new JoystickDashBoardModel();
            _sliderModel            = new SliderModel(_simultorConnectorModel);
            _algoritemDetectModel   = new AlgoritemDetectModel();
            // Create main application window
            MainWindow mainWindow = new MainWindow();

            mainWindow.Show();
        }
Esempio n. 11
0
        public async Task CreateAsync(FilesUpload files)
        {
            await _context.Files.AddAsync(files);

            await _context.SaveChangesAsync();
        }
Esempio n. 12
0
        public ActionResult Assinatura(int plano, string assunto, string nomeAss, string emailAss, string cepAss, string bairroAss, string logradouroAss, string cidadeAss, string estadoAss, string numTelAss, string complementoAss, string numDDDAss, string cpfAss, string rgAss, string cellDDD, string numCell, string radGroupBtn2_1, string radGroupBtn2_2, HttpPostedFileBase pdfFile, string newsletter, string iccidAss)
        {
            ViewBag.Plano = plano;
            string linhaTipoDoc    = "";
            string linhaTipoCli    = "";
            string receberNoticias = "";

            string Path = "~/Attachments";

            if (pdfFile.FileName.EndsWith("pdf") || pdfFile.FileName.EndsWith("jpg"))
            {
                //string arquivoEx = Server.MapPath(@"\Attachments\" + pdfFile.FileName);
                try
                {
                    FilesUpload.UploadPhoto(pdfFile, Path);
                }
                catch
                {
                    ViewBag.Erro1 = "O arquivo já está sendo utilizado em outro processo! Por favor renomeio o arquivo ou atualize o site clicando em " + "<i class=''></i>" + " e tente novamente!";
                }


                string arquivoPdf = string.Format("{0}/{1}", Path, pdfFile);
            }

            if (radGroupBtn2_1 == "on")
            {
                linhaTipoDoc = "<tr><td style='width:120px;'>CPF:</td><td style='width:380px'>" + cpfAss + "</td></tr>";
            }
            else if (radGroupBtn2_2 == "on")
            {
                linhaTipoDoc = "<tr><td style='width:120px;'>CNPJ:</td><td style='width:380px'>" + cpfAss + "</td></tr>";
            }

            if (newsletter == "on")
            {
                receberNoticias = "<tr><td style='width:120px;'></td><td style='width:380px'>Aceito receber notícias e promoções.</td></tr>";
            }
            else
            {
                receberNoticias = "<tr><td style='width:120px;'></td><td style='width:380px'>Não solicitei receber notícias e promoções.</td></tr>";
            }

            MailMessage objEmail = new MailMessage();

            objEmail.From = new MailAddress(emailAss);
            //objEmail.ReplyTo = new MailAddress("*****@*****.**", "*****@*****.**");
            objEmail.To.Add("*****@*****.**");
            //objEmail.To.Add("*****@*****.**");
            objEmail.Bcc.Add("*****@*****.**");
            objEmail.To.Add("*****@*****.**");
            //objEmail.Bcc.Add("*****@*****.**");
            objEmail.Priority   = MailPriority.Normal;
            objEmail.IsBodyHtml = true;
            objEmail.Subject    = assunto;
            string anexo = Server.MapPath(@"\Attachments\" + pdfFile.FileName);

            objEmail.Attachments.Add(new Attachment(anexo));
            objEmail.Body = "<h3 style='font-family:Arial'>" + nomeAss + "</h3>" +
                            "<table style='width:500px; height:70px; font-family:Arial; border:0px'>" +
                            "<tr style='background-color:#0a2f59'>" +
                            "<td style='width:120px;'><img src='https://www.easysim4ubrasil.com/assets/img/logo/LogoEasySim4u.png' alt='Logo Unioperadora' style='width:120px' /></td>" +
                            "<td style='width:380px'><h3 style='font-family:Arial; color:white; text-align:center'>Assinatura - " + assunto + "</h3></td></tr></table>" +
                            "<table style='width:500px; height:70px; font-family:Arial; border:0px'>" +
                            linhaTipoDoc +
                            "<tr><td style='width:120px;'>RG:</td><td style='width:380px'>" + rgAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Email:</td><td style='width:380px'>" + emailAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Fone:</td><td style='width:380px'>" + "(" + numDDDAss + ")" + numTelAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>CEP:</td><td style='width:380px'>" + cepAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Bairro:</td><td style='width:380px'>" + bairroAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Logradouro:</td><td style='width:380px'>" + logradouroAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Numero:</td><td style='width:380px'>" + numTelAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Compl.:</td><td style='width:380px'>" + complementoAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Cidade:</td><td style='width:380px'>" + cidadeAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Estado:</td><td style='width:380px'>" + estadoAss + "</td></tr>" +
                            "<tr><td style='width:120px;'>Cell:</td><td style='width:380px'>" + "(" + cellDDD + ")" + numCell + "</td></tr>" +
                            "<tr><td style='width:120px;'>COD. ICCID:</td><td>" + iccidAss + "</td></tr>" +
                            receberNoticias +
                            "<tr><td style='width:120px;'></td><td style='width:380px'>Concordo com os termos de uso. " + nomeAss + "- CPF:" + cpfAss + "</td></tr>";
            objEmail.SubjectEncoding = Encoding.GetEncoding("ISO-8859-1");
            objEmail.BodyEncoding    = Encoding.GetEncoding("ISO-8859-1");
            SmtpClient objSmtp = new SmtpClient();

            objSmtp.Host        = "mail.unioperadora.com.br";
            objSmtp.Port        = 587;
            objSmtp.EnableSsl   = true;
            objSmtp.Credentials = new NetworkCredential("*****@*****.**", "Campinas2020");
            objSmtp.Send(objEmail);

            string urlPag = "";

            switch (plano)
            {
            case 1:
                urlPag = "http://pag.ae/7V-Q9wD9r";
                break;

            case 2:
                urlPag = "http://pag.ae/7VZvv-A9u";
                break;

            case 3:
                urlPag = "http://pag.ae/7VZvBgoCR";
                break;

            case 4:
                urlPag = "http://pag.ae/7VZvBLHYR";
                break;

            case 5:
                urlPag = "http://pag.ae/7VZvC8vxQ";
                break;

            case 6:
                urlPag = "http://pag.ae/7VZvCuier";
                //Compra do Chip
                //urlPag = "https://pag.ae/7Wcmk2CB9";
                break;
            }
            return(Redirect(urlPag));
        }
Esempio n. 13
0
        public IList <Veiculos> InserirVeiculos(string path)
        {
            FileInfo file     = new FileInfo(Path.Combine(path));
            string   FileName = file.Name.Remove(file.Name.Length - 5, 5);

            byte[] arquivo = System.IO.File.ReadAllBytes(path);

            try
            {
                //Inserir Arquivo no banco de dados
                var FileUpload = new FilesUpload();
                FileUpload.Arquivo = arquivo;
                FileUpload.Data    = Convert.ToDateTime(FileName);
                _db.FilesUpload.Add(FileUpload);
                _db.SaveChanges();


                using (ExcelPackage package = new ExcelPackage(file))
                {
                    //Guid do Id do Evento
                    Guid IdEvento = new Guid();

                    string ConvertGarantia = string.Empty;

                    ExcelWorksheet workSheet = package.Workbook.Worksheets["ImportarVeiculos"];
                    int            totalRows = workSheet.Dimension.Rows;

                    List <Veiculos> ExcelList = new List <Veiculos>();

                    var eventos = _db.Eventos.ToList();

                    foreach (var item in eventos)
                    {
                        if (item.start == FileUpload.Data)
                        {
                            IdEvento = item.Id;
                        }
                    }

                    for (int i = 2; i <= totalRows; i++)
                    {
                        if (workSheet.Cells[i, 19].Value.ToString() == "Sim")
                        {
                            workSheet.Cells[i, 19].Value = true;
                        }
                        else
                        {
                            workSheet.Cells[i, 19].Value = false;
                        }

                        ExcelList.Add(new Veiculos
                        {
                            Id              = Guid.NewGuid(),
                            IdEvento        = IdEvento,
                            Lote            = Convert.ToInt32(workSheet.Cells[i, 1].Value),
                            Modelo          = workSheet.Cells[i, 2].Value.ToString(),
                            Marca           = workSheet.Cells[i, 3].Value.ToString(),
                            Ano             = Convert.ToInt32(workSheet.Cells[i, 4].Value),
                            Valor           = Convert.ToDecimal(workSheet.Cells[i, 5].Value),
                            Descricao       = workSheet.Cells[i, 6].Value.ToString(),
                            Quilometragem   = Convert.ToDecimal(workSheet.Cells[i, 7].Value),
                            Cambio          = workSheet.Cells[i, 8].Value.ToString(),
                            Carroceria      = workSheet.Cells[i, 9].Value.ToString(),
                            Combustivel     = workSheet.Cells[i, 10].Value.ToString(),
                            ValorDoIPVA     = Convert.ToDecimal(workSheet.Cells[i, 11].Value),
                            FinalDaPlaca    = Convert.ToInt32(workSheet.Cells[i, 12].Value),
                            Opcionais       = workSheet.Cells[i, 13].Value.ToString(),
                            Potencia        = workSheet.Cells[i, 14].Value.ToString(),
                            Portas          = Convert.ToInt32(workSheet.Cells[i, 15].Value),
                            Imagem          = workSheet.Cells[i, 1].Value.ToString() + ".png",
                            InclusoNaCompra = workSheet.Cells[i, 16].Value.ToString(),
                            Placa           = workSheet.Cells[i, 17].Value.ToString(),
                            Cor             = workSheet.Cells[i, 18].Value.ToString(),
                            Garantia        = Convert.ToBoolean(workSheet.Cells[i, 19].Value)
                        });
                    }

                    _db.Veiculos.AddRange(ExcelList);
                    _db.SaveChanges();

                    File.Delete(path);

                    return(ExcelList);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 14
0
 public static bool FilesUpload_Update(FilesUpload data)
 {
     return(db.FilesUpload_Update(data));
 }
Esempio n. 15
0
 public static bool FilesUpload_Insert(FilesUpload data)
 {
     return(db.FilesUpload_Insert(data));
 }
Esempio n. 16
0
        protected void ldsMetricValue_Updating(object sender, LinqDataSourceUpdateEventArgs e)
        {
            // save previous value
            MetricTrac.Bll.MetricValue.Extend OldMetricValue = MVS;
            // get new data
            string Value = String.Empty;

            if (rntValue.Visible)
            {
                Value = rntValue.Value.ToString();
            }
            else
            if (tbValue.Visible)
            {
                Value = tbValue.Text;
            }
            else
            if (chbValue.Visible)
            {
                Value = chbValue.Checked ? bool.TrueString : bool.FalseString;
            }
            else
            if (rdpDateValue.Visible)
            {
                Value = rdpDateValue.SelectedDate.ToString();
            }
            ValueArgument = Value;
            Guid?ActualUoMID = null;

            if (!String.IsNullOrEmpty(ddlInputUnitOfMeasure.SelectedValue))
            {
                ActualUoMID = new Guid(ddlInputUnitOfMeasure.SelectedValue);
            }
            string CustomMetricAlias = null; // if pass null to Isert/Update - nothing changed. It's possible if custom names disabled or bulk edit
            string CustomMetricCode  = null;

            if (MVS.AllowMetricCustomNames)
            {
                CustomMetricAlias = tbAlias.Text;
                CustomMetricCode  = tbCode.Text;
            }

            bool?Approved = false;

            switch (ddlApprovalStatus.SelectedValue)
            {
            case "":
                Approved = null;
                break;

            case "True":
                Approved = true;
                break;

            case "False":
            default:
                Approved = false;
                break;
            }
            ValueArgument = Value + "|" + Approved.ToString();
            string comments     = tbComments.Text;
            string Notes        = ((Micajah.Common.WebControls.TextBox)mfMetricValue.FindFieldControl("Notes")).Text;
            Guid   CurentUserId = Micajah.Common.Security.UserContext.Current.UserId;
            //------------------------------

            Guid _ValueID = Bll.MetricValue.InsertOrUpdate(
                MetricID,
                OperationDate,
                OrgLocationID,
                !FilesUpload.IsEmpty,
                Mode == DataMode.Approve,
                ActualUoMID,
                OldMetricValue.Value,
                Value,
                OldMetricValue.Approved,
                Approved,
                CurentUserId,
                Notes,
                CustomMetricAlias,
                CustomMetricCode);

            if (_ValueID != Guid.Empty)
            {
                FilesUpload.LocalObjectId = _ValueID.ToString();
                if (!FilesUpload.AcceptChanges())
                {
                    if (FilesUpload.ErrorOccurred)
                    {
                        string _errorMessage = String.Empty;
                        foreach (string s in FilesUpload.ErrorMessages)
                        {
                            _errorMessage += s + "\n";
                        }
                        this.ErrorMessage = _errorMessage;
                    }
                }
            }
            else // change this error handler after adding central error tracker
            {
                this.ErrorMessage = "Unable to save changes. Please, try again later.";
            }
            Bll.MetricValue.Extend NewMetricValue = Bll.MetricValue.Get(MetricID, OperationDate, OrgLocationID);
            Bll.Mc_User.Extend     mue            = Bll.Mc_User.GetValueInputUser(OldMetricValue.MetricValueID);
            // build mail to data collector if status or comment were changed
            if ((Mode == DataMode.Approve) && ((!String.IsNullOrEmpty(comments)) || (OldMetricValue.Approved != NewMetricValue.Approved)))
            {
                string MailCaption = OldMetricValue.Approved != NewMetricValue.Approved ? "MetricTrac - Value Status is changed" : "SustainApp - Value has new comment from Data Approver";
                if (OldMetricValue.Approved != NewMetricValue.Approved)
                {
                    Bll.MetricValueChangeLog.LogChange(NewMetricValue.MetricValueID,
                                                       Bll.MetricValueChangeTypeEnum.StatusChanged,
                                                       OldMetricValue.ApprovalStatus,
                                                       NewMetricValue.ApprovalStatus,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, comments, Micajah.Common.Security.UserContext.Current, mue, Bll.MetricValueChangeTypeEnum.StatusChanged));
                }
                else
                {
                    Bll.MetricValueChangeLog.LogChange(NewMetricValue.MetricValueID,
                                                       Bll.MetricValueChangeTypeEnum.CommentToDataCollector,
                                                       null,
                                                       comments,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, comments, Micajah.Common.Security.UserContext.Current, mue, Bll.MetricValueChangeTypeEnum.CommentToDataCollector));
                }
                if (NewMetricValue.Approved == null && mue != null)
                {
                    Utils.Mail.Send(mue.Email, mue.FullName, MailCaption, Utils.Mail.BuildEmailBody(OldMetricValue, NewMetricValue, comments, Micajah.Common.Security.UserContext.Current));
                }
            }


            // record in change log
            // first time value entered
            if (OldMetricValue.MetricValueID == Guid.Empty)
            {
                Bll.MetricValueChangeLog.LogChange(NewMetricValue.MetricValueID,
                                                   MetricTrac.Bll.MetricValueChangeTypeEnum.ValueEntered,
                                                   String.Empty,
                                                   NewMetricValue.Value,
                                                   Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, Notes, Micajah.Common.Security.UserContext.Current, mue, MetricTrac.Bll.MetricValueChangeTypeEnum.ValueEntered));
            }
            else
            {
                // value changed
                if (OldMetricValue.Value != NewMetricValue.Value)
                {
                    Bll.MetricValueChangeLog.LogChange(MVS.MetricValueID,
                                                       MetricTrac.Bll.MetricValueChangeTypeEnum.ValueChanged,
                                                       OldMetricValue.Value,
                                                       NewMetricValue.Value,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, Notes, Micajah.Common.Security.UserContext.Current, mue, MetricTrac.Bll.MetricValueChangeTypeEnum.ValueChanged));
                }
                // notes changed
                if (OldMetricValue.Notes != NewMetricValue.Notes)
                {
                    Bll.MetricValueChangeLog.LogChange(MVS.MetricValueID,
                                                       MetricTrac.Bll.MetricValueChangeTypeEnum.NoteChanged,
                                                       OldMetricValue.Notes,
                                                       NewMetricValue.Notes,
                                                       Utils.Mail.BuildLogMessageBody(OldMetricValue, NewMetricValue, Notes, Micajah.Common.Security.UserContext.Current, mue, MetricTrac.Bll.MetricValueChangeTypeEnum.NoteChanged));
                }
            }

            e.Cancel = true;
        }
Esempio n. 17
0
        public JsonResult EnviaEmailPlanRecorr(string assunto, string nome, string email, string cep, string bairro, string logradouro, string numero, string cidade, string estado, string telefone, string complemento, string numDDD, string cpf, string rg, string cellDDD, string cellNum, string tipoNum, string tipoCliente, HttpPostedFileBase pdfFile)
        {
            string linhaTipoDoc = "";
            string linhaTipoCli = "";

            string Path = "~/Attachments";

            if (pdfFile.FileName.EndsWith("pdf") || pdfFile.FileName.EndsWith("jpg"))
            {
                if (System.IO.File.Exists(Path + "/" + pdfFile.FileName))
                {
                    System.IO.File.Delete(Path + "/" + pdfFile.FileName);
                }

                FilesUpload.UploadPhoto(pdfFile, Path);
                string arquivoPdf = string.Format("{0}/{1}", Path, pdfFile);
            }

            if (tipoCliente == "PessoaFísica")
            {
                linhaTipoDoc = "<tr><td style='width:120px;'>CPF:</td><td style='width:380px'>" + cpf + "</td></tr>";
            }
            else if (tipoCliente == "PessoaJurídica")
            {
                linhaTipoDoc = "<tr><td style='width:120px;'>CNPJ:</td><td style='width:380px'>" + cpf + "</td></tr>";
            }

            MailMessage objEmail = new MailMessage();

            //objEmail.From = new MailAddress("*****@*****.**");
            objEmail.From = new MailAddress(email);
            //objEmail.ReplyTo = new MailAddress("*****@*****.**", "*****@*****.**");
            objEmail.To.Add("*****@*****.**");
            //objEmail.To.Add("*****@*****.**");
            objEmail.Bcc.Add("*****@*****.**");
            objEmail.Priority   = MailPriority.Normal;
            objEmail.IsBodyHtml = true;
            objEmail.Subject    = assunto;
            string anexo = Server.MapPath(@"\Attachments\" + pdfFile);

            objEmail.Attachments.Add(new Attachment(anexo));
            objEmail.Body = "<h3 style='font-family:Arial'>" + nome + "</h3>" +
                            "<table style='width:500px; height:70px; font-family:Arial; border:0px'>" +
                            "<tr style='background-color:#0a2f59'>" +
                            "<td style='width:120px;'><img src='http://www.unioperadora.com.br/assets/img/logo/LogoEasySim4u.png' alt='Logo Unioperadora' style='width:120px' /></td>" +
                            "<td style='width:380px'><h3 style='font-family:Arial; color:white; text-align:center'>Assinatura - " + assunto + "</h3></td></tr></table>" +
                            "<table style='width:500px; height:70px; font-family:Arial; border:0px'>" +
                            linhaTipoDoc +
                            "<tr><td style='width:120px;'>RG:</td><td style='width:380px'>" + rg + "</td></tr>" +
                            "<tr><td style='width:120px;'>Email:</td><td style='width:380px'>" + email + "</td></tr>" +
                            "<tr><td style='width:120px;'>Fone:</td><td style='width:380px'>" + "(" + numDDD + ")" + telefone + "</td></tr>" +
                            "<tr><td style='width:120px;'>CEP:</td><td style='width:380px'>" + cep + "</td></tr>" +
                            "<tr><td style='width:120px;'>Bairro:</td><td style='width:380px'>" + bairro + "</td></tr>" +
                            "<tr><td style='width:120px;'>Logradouro:</td><td style='width:380px'>" + logradouro + "</td></tr>" +
                            "<tr><td style='width:120px;'>Numero:</td><td style='width:380px'>" + numero + "</td></tr>" +
                            "<tr><td style='width:120px;'>Compl.:</td><td style='width:380px'>" + complemento + "</td></tr>" +
                            "<tr><td style='width:120px;'>Cidade:</td><td style='width:380px'>" + cidade + "</td></tr>" +
                            "<tr><td style='width:120px;'>Estado:</td><td style='width:380px'>" + estado + "</td></tr>" +

                            "<tr><td style='width:120px;'>Cell:</td><td style='width:380px'>" + "(" + cellDDD + ")" + cellNum + "</td></tr>";
            objEmail.SubjectEncoding = Encoding.GetEncoding("ISO-8859-1");
            objEmail.BodyEncoding    = Encoding.GetEncoding("ISO-8859-1");
            SmtpClient objSmtp = new SmtpClient();

            objSmtp.Host        = "mail.unioperadora.com.br";
            objSmtp.Port        = 587;
            objSmtp.EnableSsl   = true;
            objSmtp.Credentials = new NetworkCredential("*****@*****.**", "Campinas2020");
            objSmtp.Send(objEmail);


            return(Json(true));
        }
Esempio n. 18
0
 public async Task CreateAsync(Guid userId, Guid?productId, string name, DateTime data)
 {
     var fu = new FilesUpload(userId, productId, name, data);
     await _fileRepository.CreateAsync(fu);
 }