protected void btnSubmit_Click(object sender, EventArgs e)
    {
        PassCodeGenerator pg = new PassCodeGenerator();
        int passcode         = pg.GetPasscode();

        Customer     c  = new Customer();
        Donation     d  = new Donation();
        PasswordHash ph = new PasswordHash();

        c.LastName  = txtLastName.Text;
        c.FirstName = txtFirstName.Text;
        c.Email     = txtEmail.Text;
        c.Password  = txtPassword.Text;
        //c.passcode = passcode;
        //c.PasswordHash = ph.HashIt(txtPassword.Text, passcode.ToString());


        try
        {
            ManagePerson mp = new ManagePerson(d, c);

            mp.WriteRegisteredCustomer();
            mp.WriteDonation();
            lblResult.Text      = "Thank you for registering!";
            LinkButton1.Visible = true;
        }
        catch (Exception ex)
        {
            lblResult.Text = ex.ToString();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        PassCodeGenerator pg = new PassCodeGenerator();
        int passcode = pg.GetPasscode();

        Customer c = new Customer();
        Donation d = new Donation();
        PasswordHash ph = new PasswordHash();

        c.LastName = txtLastName.Text;
        c.FirstName = txtFirstName.Text;
        c.Email = txtEmail.Text;
        c.Password = txtPassword.Text;
        //c.passcode = passcode;
        //c.PasswordHash = ph.HashIt(txtPassword.Text, passcode.ToString());

        try
        {
        ManagePerson mp = new ManagePerson(d, c);

        mp.WriteRegisteredCustomer();
        mp.WriteDonation();
        lblResult.Text = "Thank you for registering!";
        LinkButton1.Visible = true;
        }
        catch (Exception ex)
        {
            lblResult.Text = ex.ToString();
        }
    }
Example #3
0
        public async Task <IActionResult> Filter(string value)
        {
            var persons = ManagePerson.FilterPerson(value).Result;

            return(persons.Any()
            ? Ok(persons)
            : NotFound("No results"));
        }
Example #4
0
        //Event fired when Add is clicked on the Main Form
        public void AddPerson(object sender, EventArgs e)
        {
            using (newManageWindow = new ManagePerson(_addressBook))
            {
                newManageWindow.ShowDialog();

                if (!newManageWindow.Canceled)
                {
                    _view.DisableFindAgainButton();
                    RefreshAddressBook();
                }
            }
        }
Example #5
0
        public async Task <IActionResult> InsertPerson([FromBody] Person person)
        {
            var result = PersonVerify.Verify(person);

            if (result.ErrorCode == ErrorList.OK)
            {
                _ = ManagePerson.InsertPersonRep(person);
            }

            return(result.ErrorCode == ErrorList.OK
            ? Ok("User Inserted")
            : BadRequest(result.Description));
        }
Example #6
0
        public async Task <IActionResult> GetPerson(string id)
        {
            if (!await ManagePerson.IdExistAsyncRoute(id))
            {
                Ok($"user {id} doesn't exist");
            }
            if (Regex.IsMatch(id, @"[a-zA-Z]"))
            {
                return(BadRequest("id contains letters"));
            }

            return(Ok(await ManagePerson.GetPerson(id)));
        }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["personkey"] != null)
     {
         ManagePerson mp = new ManagePerson((int)Session["personkey"]);
         Customer     c  = mp.GetCustomer();
         lblFirst.Text = c.FirstName;
         lblLast.Text  = c.LastName;
         lblEmail.Text = c.email;
     }
     else
     {
         Response.Redirect("Default.aspx");
     }
 }
Example #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["personkey"] != null)
        {
            ManagePerson mp = new ManagePerson((int)Session["personkey"]);
            Customer c = mp.GetCustomer();
            lblFirst.Text = c.FirstName;
            lblLast.Text = c.LastName;
            lblEmail.Text = c.email;

        }
        else
        {
            Response.Redirect("Login.aspx");
        }
    }
Example #9
0
        //Event fired when Edit is clicked on the Main Form
        public void EditPerson(object sender, PersonInfoEventArgs e)
        {
            if (_addressBook.AddressBookList.Any())
            {
                (string firstName, string lastName) = cleanUpName(e.PersonName);
                Person person = _addressBook.getPerson(firstName, lastName);

                using (newManageWindow = new ManagePerson(_addressBook, person))
                {
                    newManageWindow.ShowDialog();

                    if (!newManageWindow.Canceled)
                    {
                        _view.DisableFindAgainButton();
                        RefreshAddressBook();
                    }

                    personIndex = findFocusIndex(person);
                    setListFocus(personIndex);
                }
            }
        }
Example #10
0
 public async Task <IActionResult> UpdatePersonParameter(UpdateClass update)
 {
     return(Ok(await ManagePerson.UpdatePerson(update)));
 }
Example #11
0
 public async Task <IActionResult> DeletePerson(string id)
 {
     return(ManagePerson.DeletePerson(id).Result
     ? NotFound($"Person ${id} was not found")
     : Ok($"Person ${id} was deleted"));
 }