コード例 #1
0
		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(',');
		}
コード例 #2
0
		public WebServiceResponse EditIdentity (WebServiceLogin login, DBIrcIdentity irc_identity, DBEmailIdentity email_identity)
		{
			WebServiceResponse response = new WebServiceResponse ();

			using (DB db = new DB ()) {
				VerifyUserInRole (db, login, Roles.Administrator);

				if (irc_identity != null) {
					irc_identity.Save (db);
				}
				if (email_identity != null) {
					email_identity.Save (db);
				}
			}

			return response;
		}
コード例 #3
0
	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);
		}
	}