public EMailNotification(DBNotification notification)
            : base(notification)
        {
            using (DB db = new DB()) {
                using (IDbCommand cmd = db.CreateCommand()) {
                    cmd.CommandText = "SELECT * FROM EmailIdentity WHERE id = @id;";
                    DB.CreateParameter(cmd, "id", notification.emailidentity_id.Value);
                    using (IDataReader reader = cmd.ExecuteReader()) {
                        if (!reader.Read())
                        {
                            throw new ApplicationException(string.Format("Could not find the email identity {0}", notification.emailidentity_id.Value));
                        }
                        identity = new DBEmailIdentity(reader);
                    }
                }
            }

            emails = string.IsNullOrWhiteSpace(identity.email) ? new string[0] : identity.email.Split(',');
        }
    protected void lnkEmailAdd_Click(object sender, EventArgs e)
    {
        WebServiceResponse response;

        DBEmailIdentity email_identity = new DBEmailIdentity();

        email_identity.name     = txtEmailName.Text;
        email_identity.email    = txtEmailEmail.Text;
        email_identity.password = txtEmailPassword.Text;

        try {
            if (string.IsNullOrEmpty(email_identity.name))
            {
                throw new ValidationException("You need to specify the name of the email identity");
            }
            if (string.IsNullOrEmpty(email_identity.email))
            {
                throw new ValidationException("You need to specify the email for the email identity");
            }
            if (string.IsNullOrEmpty(email_identity.password))
            {
                throw new ValidationException("You need to specify the password for the email identity");
            }
        } catch (ValidationException ex) {
            lblMessage.Text = ex.Message;
            return;
        }

        response = Utils.LocalWebService.EditIdentity(Master.WebServiceLogin, null, email_identity);

        if (response.Exception != null)
        {
            lblMessage.Text = response.Exception.Message;
        }
        else
        {
            Response.Redirect("Identities.aspx", false);
        }
    }