protected void ddlFolders_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                //ILogicaEmails le = FabricaLogica.getLogicaEmails();
                ServiceWebMail sm = new ServiceWebMail();

                Carpeta current = (Carpeta)Session["Carpeta"];
                if (current != null)
                {
                    //le.MoverEmail(Convert.ToInt32(Session["EmailId"]), current.NUMERO_CARPETA, Convert.ToInt32(ddlFolders.SelectedValue));

                    refServiceWebMail.Email email = new refServiceWebMail.Email();
                    email.NUMERO_EMAIL = Convert.ToInt32(Session["EmailId"]);
                    Carpeta cdestino = new Carpeta {NUMERO_CARPETA = Convert.ToInt32(ddlFolders.SelectedValue)};
                    //le.MoverEmail(email, current, cdestino);
                    sm.MoverEmail(email, current, cdestino);
                    lblInfo.Text = "El email se movio a la carpeta " + ddlFolders.SelectedItem.Text;
                }

            }
            catch (Exception ex)
            {
                lblInfo.Text = ex.Message;
            }
        }
        /// <summary>
        /// ENVIA UN EMAIL
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                //ILogicaEmails le = FabricaLogica.getLogicaEmails();
                ServiceWebMail sm = new ServiceWebMail();

                SiteAlumno m = Master;
                if (m != null && m.USUARIO_LOGUEADO != null)
                {
                    Alumno a = (Alumno)m.USUARIO_LOGUEADO;

                    refServiceWebMail.Email newEmail = new refServiceWebMail.Email
                                                   {
                                                       CUERPO = txtContenido.Text,
                                                       FECHA = DateTime.Now,
                                                       ASUNTO = txtAsunto.Text
                                                   };
                    Alumno destinatario = new Alumno {NOMBRE_USUARIO = txtPara.Text};

                    //le.AgregarEmail(txtAsunto.Text, txtContenido.Text, a, txtPara.Text);
                    //le.AgregarEmail(newEmail, a, destinatario);
                    sm.AgregarEmail(newEmail, a, destinatario);
                    Response.Redirect("~/AdminAlumno/home.aspx");
                }
            }
            catch (Exception ex)
            {
                lblInfo.Text = ex.Message;
            }
        }
 public void MoverEmail(Email e, Carpeta carpetaActual, Carpeta carpetaDestino) {
     this.Invoke("MoverEmail", new object[] {
                 e,
                 carpetaActual,
                 carpetaDestino});
 }
 /// <remarks/>
 public void MarcarEmailLeidoAsync(Email e, Carpeta c, object userState) {
     if ((this.MarcarEmailLeidoOperationCompleted == null)) {
         this.MarcarEmailLeidoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMarcarEmailLeidoOperationCompleted);
     }
     this.InvokeAsync("MarcarEmailLeido", new object[] {
                 e,
                 c}, this.MarcarEmailLeidoOperationCompleted, userState);
 }
 /// <remarks/>
 public void MarcarEmailLeidoAsync(Email e, Carpeta c) {
     this.MarcarEmailLeidoAsync(e, c, null);
 }
 public void MarcarEmailLeido(Email e, Carpeta c) {
     this.Invoke("MarcarEmailLeido", new object[] {
                 e,
                 c});
 }
 /// <remarks/>
 public void EliminarEmailAsync(Email e, Carpeta carpeta, object userState) {
     if ((this.EliminarEmailOperationCompleted == null)) {
         this.EliminarEmailOperationCompleted = new System.Threading.SendOrPostCallback(this.OnEliminarEmailOperationCompleted);
     }
     this.InvokeAsync("EliminarEmail", new object[] {
                 e,
                 carpeta}, this.EliminarEmailOperationCompleted, userState);
 }
 /// <remarks/>
 public void EliminarEmailAsync(Email e, Carpeta carpeta) {
     this.EliminarEmailAsync(e, carpeta, null);
 }
 /// <remarks/>
 public void GetEmailAsync(Email e, object userState) {
     if ((this.GetEmailOperationCompleted == null)) {
         this.GetEmailOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetEmailOperationCompleted);
     }
     this.InvokeAsync("GetEmail", new object[] {
                 e}, this.GetEmailOperationCompleted, userState);
 }
 /// <remarks/>
 public void GetEmailAsync(Email e) {
     this.GetEmailAsync(e, null);
 }
 public Email GetEmail(Email e) {
     object[] results = this.Invoke("GetEmail", new object[] {
                 e});
     return ((Email)(results[0]));
 }
 /// <remarks/>
 public void AgregarEmailAsync(Email newEmail, Alumno remitente, Alumno destinatario, object userState) {
     if ((this.AgregarEmailOperationCompleted == null)) {
         this.AgregarEmailOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAgregarEmailOperationCompleted);
     }
     this.InvokeAsync("AgregarEmail", new object[] {
                 newEmail,
                 remitente,
                 destinatario}, this.AgregarEmailOperationCompleted, userState);
 }
 /// <remarks/>
 public void AgregarEmailAsync(Email newEmail, Alumno remitente, Alumno destinatario) {
     this.AgregarEmailAsync(newEmail, remitente, destinatario, null);
 }
 public void AgregarEmail(Email newEmail, Alumno remitente, Alumno destinatario) {
     this.Invoke("AgregarEmail", new object[] {
                 newEmail,
                 remitente,
                 destinatario});
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    int emailId;
                    if (Int32.TryParse(Convert.ToString(Session["EmailId"]), out emailId))
                    {
                        txtFrom.Visible = true;
                        lblFrom.Visible = true;

                        //CARGAMOS LA INFORMACION DEL EMAIL PARA SER VISUALIZADA.
                        //-------------------------------------------------------
                        btnAceptar.Visible = false;
                        //ILogicaEmails le = FabricaLogica.getLogicaEmails();

                        //Entidades.Email email = le.GetEmail(emailId);
                        ServiceWebMail sm = new ServiceWebMail();
                        refServiceWebMail.Email email = new refServiceWebMail.Email {NUMERO_EMAIL = emailId};
                        //email = le.GetEmail(email);
                        email = sm.GetEmail(email);

                        if (email != null)
                        {
                            Header.HEADER_TEXT = "Email enviado " + email.FECHA.ToShortDateString() + " a las " +
                                                 email.FECHA.ToShortTimeString();

                            txtFrom.Text = email.CARPETA_REMITENTE.USUARIO.NOMBRE + " " +
                                           email.CARPETA_REMITENTE.USUARIO.APELLIDO;
                            txtPara.Text = email.CARPETA_DESTINATARIO.USUARIO.NOMBRE + " " +
                                           email.CARPETA_DESTINATARIO.USUARIO.APELLIDO;
                            txtAsunto.Text = email.ASUNTO;
                            txtContenido.Text = email.CUERPO;

                            //bindeamos las posibles carpetas de destino
                            // a mover
                            //ILogicaCarpetas lc = FabricaLogica.getLogicaCarpetas();
                            //ddlFolders.DataSource = lc.ListarCarpetas((Alumno)Session["Usuario"]);

                            ddlFolders.DataSource = sm.ListarCarpetas((Alumno) Session["Usuario"]);
                            ddlFolders.DataBind();
                            lblMover.Visible = true;
                            ddlFolders.Visible = true;
                        }
                        else
                        {
                            lblInfo.Text = "No se encontro la informacion del email";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblInfo.Text = ex.ToString();
            }
        }
 /// <remarks/>
 public void MoverEmailAsync(Email e, Carpeta carpetaActual, Carpeta carpetaDestino) {
     this.MoverEmailAsync(e, carpetaActual, carpetaDestino, null);
 }
 /// <remarks/>
 public void MoverEmailAsync(Email e, Carpeta carpetaActual, Carpeta carpetaDestino, object userState) {
     if ((this.MoverEmailOperationCompleted == null)) {
         this.MoverEmailOperationCompleted = new System.Threading.SendOrPostCallback(this.OnMoverEmailOperationCompleted);
     }
     this.InvokeAsync("MoverEmail", new object[] {
                 e,
                 carpetaActual,
                 carpetaDestino}, this.MoverEmailOperationCompleted, userState);
 }
 public void EliminarEmail(Email e, Carpeta carpeta) {
     this.Invoke("EliminarEmail", new object[] {
                 e,
                 carpeta});
 }