1
I have a grid and in it I have a product listings from several different suppliers and each supplier has its ID. I would like to select the grid items and send the email to each vendor with their respective items.
I can save the approved data. Below is my controller:
public ActionResult Create(PersonOrcamentoModel model)
{
Orcamento orca = new Orcamento();
Orca_Financeiro_ADO FinanAdo = new Orca_Financeiro_ADO();
Orcamento_ADO OrcaAdo = new Orcamento_ADO();
foreach (var item in model.Dados)
{
orca.Data = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy"));
orca.Descricao = item.Descricao;
orca.Fornecedor = item.Fornecedor;
orca.Marca = item.Marca;
orca.Modelo = item.Modelo;
orca.Prazo = item.Prazo;
orca.Quantidade = item.Quantidade;
orca.Status = "Aguardando";
orca.UnidadeMedida = item.UnidadeMedida;
orca.Valor = item.Valor;
orca.ValorUnitario = item.ValorUnitario;
OrcaAdo.Inserir_Orcamento(orca);
using (var ctx = new EstoqueDBContext())
{
var Dados_Id = ctx.Orcamentos.ToList().Last();
var p = new Orca_Financeiro
{
IdFornecedor = item.IdFornecedor,
Data = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy")),
Descricao = item.Descricao,
Fornecedor = item.Fornecedor,
Marca = item.Marca,
Modelo = item.Modelo,
Prazo = item.Prazo,
Quantidade = item.Quantidade,
Status = "Aguardando",
UnidadeMedida = item.UnidadeMedida,
Valor = item.Valor,
ValorUnitario = item.ValorUnitario,
Id_Orcamento = Dados_Id.Id
};
db.Orca_Financeiro.Add(p);
db.SaveChanges();
}
}
//ArquivoExcel exe = new ArquivoExcel();
//exe.WriteTsv(model.Dados.ToList());
//enviar o e-mail aqui
return RedirectToAction("Index");
}
I didn’t understand what your question or problem is. It would be like sending the email?
– André Luis Marmo
Ola André, I intend to send an email with a list of approved items. Since in this listing I have the supplier id and in some cases, in this listing may occur to have several suppliers. i intend to send for example an email to the provider id=1 with the items belonging to it and if id=2 separate these products from this provider id=2 and send separately.
– Anderson Machado