コード例 #1
0
ファイル: MailingDAL.cs プロジェクト: EdnilsonMartins/CCBC
        public MailingResponse RegistrarMailing(MailingDTO Mailing)
        {
            MailingResponse resp = new MailingResponse();

            AcessoDados acesso = new AcessoDados();

            DataTable tabela = new DataTable();

            tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_INS_Mailing",    Mailing.MailingId,
                                                                                    Mailing.SiteId,
                                                                                    Mailing.Nome,
                                                                                    Mailing.Email,
                                                                                    Mailing.Segmento,
                                                                                    Mailing.Ativo
                                                                                    );
            if (tabela.Rows.Count > 0)
            {
                //CarregarDTO(resp.Mailing, tabela.Rows[0]);
                resp.Resposta.Erro = false;
                resp.Resposta.Mensagem = "";
            }
            else
            {
                resp.Resposta.Erro = true;
                resp.Resposta.Mensagem = "";
            }

            return resp;
        }
コード例 #2
0
ファイル: MailingDAL.cs プロジェクト: EdnilsonMartins/CCBC
 private void CarregarDTO(MailingDTO dto, DataRow dr)
 {
     if (Util.GetNonNull(dr["MailingId"]))
         dto.MailingId = (int)dr["MailingId"];
     if (Util.GetNonNull(dr["SiteId"]))
         dto.SiteId = (int)dr["SiteId"];
     if (Util.GetNonNull(dr["Nome"]))
         dto.Nome = dr["Nome"].ToString();
     if (Util.GetNonNull(dr["Email"]))
         dto.Email = dr["Email"].ToString();
     if (Util.GetNonNull(dr["Segmento"]))
         dto.Segmento = dr["Segmento"].ToString();
     if (Util.GetNonNull(dr["DataInclusao"]))
         dto.DataInclusao = (DateTime)dr["DataInclusao"];
     if (Util.GetNonNull(dr["Ativo"]))
         dto.Ativo = (bool)dr["Ativo"];
 }
コード例 #3
0
ファイル: MailingDAL.cs プロジェクト: EdnilsonMartins/CCBC
        public List<MailingDTO> ListarMailing(int? MailingId, int? SiteId)
        {
            List<MailingDTO> lista = new List<MailingDTO>();
            MailingDTO reg;

            AcessoDados acesso = new AcessoDados();

            DataTable tabela = new DataTable();

            tabela = acesso.CarregarDadosParametros("dbCCBC", "USP_SEL_Mailing", MailingId, SiteId);

            foreach (DataRow r in tabela.Rows)
            {
                reg = new MailingDTO();
                CarregarDTO(reg, r);
                lista.Add(reg);
            }

            return lista;
        }
コード例 #4
0
 public MailingResponse()
 {
     Resposta = new Resposta();
     Mailing = new MailingDTO();
 }
コード例 #5
0
        public ActionResult RegistrarMailing(string Nome, string Email, bool Cadastrar)
        {
            var currentSite = HttpContext.Request.Cookies["site"] != null ? HttpContext.Request.Cookies["site"].Value : "2";
            if (string.IsNullOrEmpty(currentSite)) currentSite = "0";
            int _siteId = Convert.ToInt32(currentSite);

            MailingDAL dal = new MailingDAL();
            MailingDTO mailing = new MailingDTO()
            {
                Nome = Nome,
                Email = Email,
                SiteId = _siteId,
                Ativo = Cadastrar
            };
            var resp = dal.RegistrarMailing(mailing);
            return Json(resp, JsonRequestBehavior.AllowGet);
        }
コード例 #6
0
 private static void CriarConteudo(StringBuilder conteudo, MailingDTO item)
 {
     conteudo.AppendFormat("<tr>\r\n");
     conteudo.AppendFormat(String.Format("\t<td class=\"tabRow\">{0}</td>\r\n", item.MailingId));
     conteudo.AppendFormat(String.Format("\t<td class=\"tabRow\">{0}</td>\r\n", item.Nome));
     conteudo.AppendFormat(String.Format("\t<td class=\"tabRow\">{0}</td>\r\n", item.Email));
     conteudo.AppendFormat(String.Format("\t<td class=\"tabRow\">{0}</td>\r\n", item.Segmento));
     conteudo.AppendFormat(String.Format("\t<td class=\"tabRow\">{0}</td>\r\n", item.DataInclusao.ToString("dd/MM/yyyy")));
     conteudo.AppendFormat(String.Format("\t<td class=\"tabRow\">{0}</td>\r\n", item.Ativo));
     conteudo.AppendFormat("</tr>\r\n");
 }