/// <summary> /// Metodo que ejecuta el comando /// </summary> /// <returns>booleano que refleja el exito de la ejecucion del comando</returns> public override bool Ejecutar() { try { DatosCorreo _datosCorreo = (DatosCorreo)LaEntidad; Correo cr = new Correo(); MailMessage mnsj = new MailMessage(); mnsj.From = new MailAddress(ResourceLogica.systemmail, ResourceLogica.SysName); mnsj.Subject = _datosCorreo.asunto; //mnsj.From = new MailAddress(ResourcesLogic.systemmail, ResourcesLogic.SysName); mnsj.Body = _datosCorreo.mensjae; /* Si deseamos Adjuntar algún archivo*/ if (_datosCorreo.adjunto != String.Empty) { mnsj.Attachments.Add(new Attachment(_datosCorreo.adjunto)); } string[] mailArray = _datosCorreo.destinatario.Split(','); List <string> mailsList = new List <string>(mailArray.Length); mailsList.AddRange(mailArray); mailsList.Reverse(); foreach (String value in mailsList) { IsValid(value); mnsj.To.Add(value); } cr.mandarCorreo(mnsj); IDao dao = FabricaDAOSqlServer.crearDaoVenta(); bool respuesta = dao.Desactivar(this.LaEntidad); return(respuesta); } catch (ArgumentNullException ex) { throw new NullArgumentException(ResourcesLogic.Codigo, ResourcesLogic.Mensaje, ex); } catch (FormatException ex) { throw new WrongFormatException(ResourcesLogic.Codigo, ResourcesLogic.Mensaje_Error_Formato, ex); } catch (Exception ex) { throw ex; } }
/// <summary> /// Metodo que ejecuta el comando /// </summary> /// <returns>booleano que refleja el exito de la ejecucion del comando</returns> /// public override bool Ejecutar() { try { IDao dao = FabricaDAOSqlServer.crearDaoVenta(); bool respuesta = dao.Modificar(this.LaEntidad); return(respuesta); } catch (ArgumentNullException ex) { throw new NullArgumentException(ResourcesLogic.Codigo, ResourcesLogic.Mensaje, ex); } catch (FormatException ex) { throw new WrongFormatException(ResourcesLogic.Codigo, ResourcesLogic.Mensaje_Error_Formato, ex); } catch (Exception ex) { throw ex; } }
/// <summary> /// Metodo que ejecuta el comando /// </summary> /// <returns>Entidad que refleja el exito de la ejecucion del comando</returns> /// public override List <Entidad> Ejecutar() { try { IDao dao = FabricaDAOSqlServer.crearDaoVenta(); List <Entidad> respuesta = dao.ConsultarTodos(); return(respuesta); } catch (ArgumentNullException ex) { throw new NullArgumentException(ResourcesLogic.Codigo, ResourcesLogic.Mensaje, ex); } catch (FormatException ex) { throw new WrongFormatException(ResourcesLogic.Codigo, ResourcesLogic.Mensaje_Error_Formato, ex); } catch (Exception ex) { throw ex; } }