Пример #1
0
    public void invite_Click(object sender, EventArgs e)
    {
        List <string>       invitations = new List <string>();
        List <string>       failures    = new List <string>();
        ExceptionCollection exceptions  = new ExceptionCollection();

        foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray()))
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim()))
            {
                continue;
            }

            try
            {
                TransitAccount existing = SessionManager.AccountService.FindByEmail(
                    SessionManager.Ticket, email);

                exceptions.Add(new Exception(string.Format(
                                                 "<a href='AccountView.aspx?id={0}'>{2} &lt;{3}&gt;</a> is a member! " +
                                                 "<a href='AccountFriendRequestEdit.aspx?pid={0}&ReturnUrl={1}'>&#187; Add to Friends</a>",
                                                 existing.Id, Request.Url.PathAndQuery, existing.Name, email)));

                continue;
            }
            catch
            {
            }

            try
            {
                MailAddress address = new MailAddress(email);
                TransitAccountInvitation invitation = new TransitAccountInvitation();
                invitation.Code      = Guid.NewGuid().ToString();
                invitation.Email     = email;
                invitation.Message   = inputMessage.Text;
                invitation.AccountId = SessionManager.AccountId;
                SessionManager.CreateOrUpdate <TransitAccountInvitation>(
                    invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation);
                invitations.Add(email);
            }
            catch (Exception ex)
            {
                failures.Add(email);
                exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex));
            }
        }

        if (invitations.Count > 0)
        {
            noticeManage.Info = string.Format("{0} invitation{1} sent",
                                              invitations.Count, invitations.Count == 1 ? string.Empty : "s");
        }

        GetData(sender, e);
        inputEmailAddress.Text = string.Join("\n", failures.ToArray());
        exceptions.Throw();
    }
Пример #2
0
    protected void files_FilesPosted(object sender, FilesPostedEventArgs e)
    {
        try
        {
            if (e.PostedFiles.Count == 0)
            {
                return;
            }

            ExceptionCollection exceptions = new ExceptionCollection();
            foreach (HttpPostedFile file in e.PostedFiles)
            {
                try
                {
                    TransitAccountPicture p = new TransitAccountPicture();

                    ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream);
                    p.Bitmap      = t.Bitmap;
                    p.Name        = Path.GetFileName(file.FileName);
                    p.Description = string.Empty;
                    p.Hidden      = true;

                    int id = SessionManager.CreateOrUpdate <TransitAccountPicture>(
                        p, SessionManager.AccountService.CreateOrUpdateAccountPicture);

                    Size size = t.GetNewSize(new Size(200, 200));

                    inputBody.Content = string.Format("<a href=AccountPictureView.aspx?id={2}><img border=0 width={0} height={1} src=AccountPicture.aspx?id={2}></a>\n{3}",
                                                      size.Width, size.Height, id, inputBody.Content);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                                                               Renderer.Render(file.FileName), ex.Message), ex));
                }

                exceptions.Throw();
            }
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
Пример #3
0
    protected void files_FilesPosted(object sender, FilesPostedEventArgs e)
    {
        try
        {
            if (e.PostedFiles.Count == 0)
            {
                return;
            }

            ExceptionCollection exceptions = new ExceptionCollection();
            foreach (HttpPostedFile file in e.PostedFiles)
            {
                try
                {
                    TransitAccountEventPicture p = new TransitAccountEventPicture();
                    ThumbnailBitmap            t = new ThumbnailBitmap(file.InputStream);
                    p.Picture        = t.Bitmap;
                    p.Name           = Path.GetFileName(file.FileName);
                    p.Description    = string.Empty;
                    p.AccountEventId = RequestId;
                    SessionManager.CreateOrUpdate <TransitAccountEventPicture>(
                        p, SessionManager.EventService.CreateOrUpdateAccountEventPicture);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                                                               Renderer.Render(file.FileName), ex.Message), ex));
                }
            }

            gridManage.CurrentPageIndex = 0;
            gridManage_OnGetDataSource(sender, e);
            gridManage.DataBind();
            exceptions.Throw();

            Redirect(string.Format("AccountEventView.aspx?id={0}", RequestId));
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
Пример #4
0
    public void send_Click(object Sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(inputEmailAddress.Text))
        {
            throw new Exception("Missing E-Mail");
        }

        TransitAccountEmailMessage message = new TransitAccountEmailMessage();

        message.Body       = GetContent();
        message.Subject    = inputSubject.Text;
        message.DeleteSent = true;
        ExceptionCollection exceptions    = new ExceptionCollection();
        List <string>       invalidemails = new List <string>();

        foreach (string address in inputEmailAddress.Text.Split("\n".ToCharArray()))
        {
            if (string.IsNullOrEmpty(address) || string.IsNullOrEmpty(address.Trim()))
            {
                continue;
            }

            try
            {
                message.MailTo = new MailAddress(address.Trim()).ToString();
                SessionManager.AccountService.CreateOrUpdateAccountEmailMessage(
                    SessionManager.Ticket, message);
            }
            catch (Exception ex)
            {
                invalidemails.Add(address);
                exceptions.Add(new Exception(string.Format("Error sending message to \"{0}\".\n{1}",
                                                           address.Trim(), ex.Message), ex));
            }
        }

        inputEmailAddress.Text = string.Join("\n", invalidemails.ToArray());
        exceptions.Throw();
        Redirect(Url);
    }
Пример #5
0
    protected void files_FilesPosted(object sender, FilesPostedEventArgs e)
    {
        try
        {
            if (e.PostedFiles.Count == 0)
            {
                return;
            }

            ExceptionCollection exceptions = new ExceptionCollection();
            foreach (HttpPostedFile file in e.PostedFiles)
            {
                try
                {
                    TransitAccountPicture p = new TransitAccountPicture();

                    ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream);
                    p.Bitmap      = t.Bitmap;
                    p.Name        = Path.GetFileName(file.FileName);
                    p.Description = string.Empty;
                    p.Hidden      = false;

                    SessionManager.CreateOrUpdate <TransitAccountPicture>(
                        p, SessionManager.AccountService.CreateOrUpdateAccountPicture);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                                                               Renderer.Render(file.FileName), ex.Message), ex));
                }
            }

            GetData(sender, e);
            exceptions.Throw();
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
    public void invite_Click(object sender, EventArgs e)
    {
        List<string> invitations = new List<string>();
        List<string> failures = new List<string>();
        ExceptionCollection exceptions = new ExceptionCollection();

        foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray()))
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim()))
                continue;

            try
            {
                TransitAccount existing = SessionManager.AccountService.FindByEmail(
                    SessionManager.Ticket, email);

                exceptions.Add(new Exception(string.Format(
                        "<a href='AccountView.aspx?id={0}'>{2} &lt;{3}&gt;</a> is a member! " +
                        "<a href='AccountFriendRequestEdit.aspx?pid={0}&ReturnUrl={1}'>&#187; Add to Friends</a>",
                        existing.Id, Request.Url.PathAndQuery, existing.Name, email)));

                continue;
            }
            catch
            {

            }

            try
            {
                MailAddress address = new MailAddress(email);
                TransitAccountInvitation invitation = new TransitAccountInvitation();
                invitation.Code = Guid.NewGuid().ToString();
                invitation.Email = email;
                invitation.Message = inputMessage.Text;
                invitation.AccountId = SessionManager.AccountId;
                SessionManager.CreateOrUpdate<TransitAccountInvitation>(
                    invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation);
                invitations.Add(email);
            }
            catch (Exception ex)
            {
                failures.Add(email);
                exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex));
            }
        }

        if (invitations.Count > 0)
        {
            noticeManage.Info = string.Format("{0} invitation{1} sent",
                invitations.Count, invitations.Count == 1 ? string.Empty : "s");
        }

        GetData(sender, e);
        inputEmailAddress.Text = string.Join("\n", failures.ToArray());
        exceptions.Throw();
    }
Пример #7
0
    public void invite_Click(object sender, EventArgs e)
    {
        List <string>       invitations = new List <string>();
        List <string>       failures    = new List <string>();
        ExceptionCollection exceptions  = new ExceptionCollection();

        foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray()))
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim()))
            {
                continue;
            }

            try
            {
                // account is a member

                TransitAccount existing = SessionManager.AccountService.FindByEmail(
                    SessionManager.Ticket, email);

                TransitAccountGroupAccountInvitation t_instance = new TransitAccountGroupAccountInvitation();
                t_instance.AccountId      = existing.Id;
                t_instance.AccountGroupId = GroupId;
                t_instance.Message        = inputMessage.Text;
                t_instance.RequesterId    = SessionManager.Account.Id;
                SessionManager.GroupService.CreateOrUpdateAccountGroupAccountInvitation(
                    SessionManager.Ticket, t_instance);
                continue;
            }
            catch
            {
            }

            try
            {
                MailAddress address = new MailAddress(email);
                TransitAccountInvitation invitation = new TransitAccountInvitation();
                invitation.Code           = Guid.NewGuid().ToString();
                invitation.Email          = email;
                invitation.Message        = inputMessage.Text;
                invitation.AccountId      = SessionManager.AccountId;
                invitation.AccountGroupId = GroupId;
                SessionManager.CreateOrUpdate <TransitAccountInvitation>(
                    invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation);
                invitations.Add(email);
            }
            catch (Exception ex)
            {
                failures.Add(email);
                exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex));
            }
        }

        if (invitations.Count > 0)
        {
            ReportInfo(string.Format("{0} invitation{1} sent",
                                     invitations.Count, invitations.Count == 1 ? string.Empty : "s"));
        }

        inputEmailAddress.Text = string.Join("\n", failures.ToArray());
        exceptions.Throw();
    }
    protected void files_FilesPosted(object sender, FilesPostedEventArgs e)
    {
        try
        {
            if (e.PostedFiles.Count == 0)
                return;

            ExceptionCollection exceptions = new ExceptionCollection();
            foreach (HttpPostedFile file in e.PostedFiles)
            {
                try
                {
                    TransitAccountStoryPicture p = new TransitAccountStoryPicture();
                    ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream);
                    p.Picture = t.Bitmap;
                    p.Name = Path.GetFileName(file.FileName);
                    p.AccountStoryId = RequestId;
                    SessionManager.CreateOrUpdate<TransitAccountStoryPicture>(
                        p, SessionManager.StoryService.CreateOrUpdateAccountStoryPicture);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                        Renderer.Render(file.FileName), ex.Message), ex));
                }
            }

            GetData(sender, e);
            exceptions.Throw();
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
Пример #9
0
    protected void files_FilesPosted(object sender, FilesPostedEventArgs e)
    {
        try
        {
            if (e.PostedFiles.Count == 0)
                return;

            ExceptionCollection exceptions = new ExceptionCollection();
            foreach (HttpPostedFile file in e.PostedFiles)
            {
                try
                {
                    TransitAccountPicture p = new TransitAccountPicture();

                    ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream);
                    p.Bitmap = t.Bitmap;
                    p.Name = Path.GetFileName(file.FileName);
                    p.Description = string.Empty;
                    p.Hidden = true;

                    int id = SessionManager.CreateOrUpdate<TransitAccountPicture>(
                        p, SessionManager.AccountService.CreateOrUpdateAccountPicture);

                    Size size = t.GetNewSize(new Size(200, 200));

                    inputBody.Content = string.Format("<a href=AccountPictureView.aspx?id={2}><img border=0 width={0} height={1} src=AccountPicture.aspx?id={2}></a>\n{3}",
                        size.Width, size.Height, id, inputBody.Content);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                        Renderer.Render(file.FileName), ex.Message), ex));
                }
            }
            exceptions.Throw();
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
    protected void files_FilesPosted(object sender, FilesPostedEventArgs e)
    {
        try
        {
            if (e.PostedFiles.Count == 0)
                return;

            ExceptionCollection exceptions = new ExceptionCollection();
            foreach (HttpPostedFile file in e.PostedFiles)
            {
                try
                {
                    TransitAccountGroupPicture p = new TransitAccountGroupPicture();
                    ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream);
                    p.Bitmap = t.Bitmap;
                    p.Name = Path.GetFileName(file.FileName);
                    p.Description = string.Empty;
                    p.AccountGroupId = RequestId;
                    SessionManager.CreateOrUpdate<TransitAccountGroupPicture>(
                        p, SessionManager.GroupService.CreateOrUpdateAccountGroupPicture);
                }
                catch (Exception ex)
                {
                    exceptions.Add(new Exception(string.Format("Error processing {0}: {1}",
                        Renderer.Render(file.FileName), ex.Message), ex));
                }
            }

            gridManage.CurrentPageIndex = 0;
            gridManage_OnGetDataSource(sender, e);
            gridManage.DataBind();
            exceptions.Throw();

            Redirect(string.Format("AccountGroupView.aspx?id={0}", RequestId));
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
Пример #11
0
    public void send_Click(object Sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(inputEmailAddress.Text))
        {
            throw new Exception("Missing E-Mail");
        }

        TransitAccountEmailMessage message = new TransitAccountEmailMessage();
        message.Body = GetContent();
        message.Subject = inputSubject.Text;
        message.DeleteSent = true;
        ExceptionCollection exceptions = new ExceptionCollection();
        List<string> invalidemails = new List<string>();
        foreach (string address in inputEmailAddress.Text.Split("\n".ToCharArray()))
        {
            if (string.IsNullOrEmpty(address) || string.IsNullOrEmpty(address.Trim()))
                continue;

            try
            {
                message.MailTo = new MailAddress(address.Trim()).ToString();
                SessionManager.AccountService.CreateOrUpdateAccountEmailMessage(
                    SessionManager.Ticket, message);
            }
            catch (Exception ex)
            {
                invalidemails.Add(address);
                exceptions.Add(new Exception(string.Format("Error sending message to \"{0}\".\n{1}",
                    address.Trim(), ex.Message), ex));
            }
        }

        inputEmailAddress.Text = string.Join("\n", invalidemails.ToArray());
        exceptions.Throw();
        Redirect(Url);
    }
    public void invite_Click(object sender, EventArgs e)
    {
        List<string> invitations = new List<string>();
        List<string> failures = new List<string>();
        ExceptionCollection exceptions = new ExceptionCollection();

        foreach (string email in inputEmailAddress.Text.Split(";,\n\r".ToCharArray()))
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim()))
                continue;

            try
            {
                // account is a member

                TransitAccount existing = SessionManager.AccountService.FindByEmail(
                    SessionManager.Ticket, email);

                TransitAccountGroupAccountInvitation t_instance = new TransitAccountGroupAccountInvitation();
                t_instance.AccountId = existing.Id;
                t_instance.AccountGroupId = GroupId;
                t_instance.Message = inputMessage.Text;
                t_instance.RequesterId = SessionManager.Account.Id;
                SessionManager.GroupService.CreateOrUpdateAccountGroupAccountInvitation(
                    SessionManager.Ticket, t_instance);
                continue;
            }
            catch
            {

            }

            try
            {
                MailAddress address = new MailAddress(email);
                TransitAccountInvitation invitation = new TransitAccountInvitation();
                invitation.Code = Guid.NewGuid().ToString();
                invitation.Email = email;
                invitation.Message = inputMessage.Text;
                invitation.AccountId = SessionManager.AccountId;
                invitation.AccountGroupId = GroupId;
                SessionManager.CreateOrUpdate<TransitAccountInvitation>(
                    invitation, SessionManager.AccountService.CreateOrUpdateAccountInvitation);
                invitations.Add(email);
            }
            catch (Exception ex)
            {
                failures.Add(email);
                exceptions.Add(new Exception(string.Format("Error inviting {0}: {1}", email, ex.Message), ex));
            }
        }

        if (invitations.Count > 0)
        {
            ReportInfo(string.Format("{0} invitation{1} sent",
                invitations.Count, invitations.Count == 1 ? string.Empty : "s"));
        }

        inputEmailAddress.Text = string.Join("\n", failures.ToArray());
        exceptions.Throw();
    }