Exemplo n.º 1
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        try
        {
            CommunityAssistEntities2 ca = new CommunityAssistEntities2();
            PassCodeGenerator        pg = new PassCodeGenerator();
            int          passcode       = pg.GetPassCode();
            PasswordHash ph             = new PasswordHash();
            Person       p = new Person();
            p.PersonFirstName     = txtfirst.Text;
            p.PersonLastName      = txtlast.Text;
            p.PersonUsername      = txtemail.Text;
            p.PersonPlainPassword = txtpassword.Text;
            p.Personpasskey       = passcode;
            p.PersonUserPassword  = ph.HashIt(txtconfirm.Text, passcode.ToString());


            ca.People.Add(p);
            ca.SaveChanges();

            Response.Redirect("Default.aspx");
        }
        catch (Exception ex)
        {
            lblerror.Text = ex.Message;
        }
    }
Exemplo n.º 2
0
    private void GetCustomerInfo()
    {
        CommunityAssistEntities2 ca = new CommunityAssistEntities2();
        int pk    = (int)Session["personkey"];
        var thisP = from p in ca.People
                    where p.PersonKey == pk
                    join g in ca.ServiceGrants on p.PersonKey equals g.PersonKey
                    select new { p.PersonLastName, p.PersonFirstName, p.PersonUsername, g.GrantAllocation };

        GridView1.DataSource = thisP.ToList();
        GridView1.DataBind();
    }
Exemplo n.º 3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            CommunityAssistEntities2 ca = new CommunityAssistEntities2();

            Donation d   = new Donation();
            DateTime now = DateTime.Now;
            decimal  amt = decimal.Parse(txtamt.Text);
            d.DonationAmount = amt;
            d.DonationDate   = now;
            ca.Donations.Add(d);
            ca.SaveChanges();

            Response.Redirect("ThankYou.aspx");
        }
        catch (Exception ex)
        {
            lblerror.Text = ex.Message;
        }
    }
Exemplo n.º 4
0
    protected void btnGrant_Click(object sender, EventArgs e)
    {
        try
        {
            CommunityAssistEntities2 ca = new CommunityAssistEntities2();

            ServiceGrant g   = new ServiceGrant();
            DateTime     now = DateTime.Now;
            decimal      amt = decimal.Parse(txtgamt.Text);
            g.GrantAmount = amt;

            g.GrantDate = now;
            ca.ServiceGrants.Add(g);
            ca.SaveChanges();

            Response.Redirect("ThankYou.aspx");
        }
        catch (Exception ex)
        {
            lblerror.Text = ex.Message;
        }
    }