Ejemplo n.º 1
0
        protected void btnAddMember_Click(object sender, EventArgs e)
        {
            // Users u = (Users)Session["Users"];
            // int familyID = u.FamilyID;

            int familyID = (int)Session["familyID"];

            Members m = new Members();

            m.FamilyID        = familyID;
            m.MemberFirst     = txtMemFName.Text;
            m.MemberLast      = txtMemLName.Text;
            m.MemberRole      = txtRole.Text;
            m.MemberBirthdate = Convert.ToDateTime(txtBirthdate.Text);
            try
            {
                bool exist = MembersDA.memberExists(m);

                if (exist == false)
                {
                    MembersDA.addMember(m);
                }
                else
                {
                    lblError.Text = "Family Member Already Exists";
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }


            Response.Redirect("~/Views/Manage.aspx");
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BindCalendar();
            try
            {
                Users u        = (Users)Session["Users"];
                int   familyID = (int)Session["familyID"];


                if (u != null)
                {
                    if (u.Permissions != "admin")
                    {
                        pnlManageMembers.Visible = false;
                        lblSubcLabel.Visible     = false;
                        lblSubscEnd.Visible      = false;
                    }
                    if (u.Permissions == "view")
                    {
                        pnlLinks.Visible      = false;
                        pnlManageCal1.Visible = false;
                    }

                    Family f = new Family();
                    f = FamilyDA.getFamilyByID(u.FamilyID);

                    lblFamID.Text    = Convert.ToString(f.FamilyID);
                    lblHOHLast.Text  = f.HOHLast;
                    lblSubscEnd.Text = f.SubscriptionEnd.ToShortDateString();

                    Session["Users"] = u;

                    List <Members> allMembers = MembersDA.getMembersFamilyID(f.FamilyID);

                    //txtFamMem.Text = "MemberID  First Name Last Name Birthdate Family Role \n";

                    foreach (Members m in allMembers)
                    {
                        txtFamMem.Text += (m.MemberFirst + " " + m.MemberLast + " " + m.MemberBirthdate.ToShortDateString() + " " + m.MemberRole + "\n");
                    }
                }
            }
            catch
            {
                Response.Redirect("~/Account/Login.aspx");
            }
        }
Ejemplo n.º 3
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int      familyID = (int)Session["familyID"];
            string   fname    = ddlFName.SelectedValue;
            DateTime bday     = Convert.ToDateTime(ddlBDay.SelectedValue);

            try
            {
                MembersDA.DeleteMember(familyID, fname, bday);
                lblError.Text = "Member Deleted Succesfully";
                ddlFName.DataBind();
                ddlBDay.DataBind();
            }
            catch
            {
                lblError.Text = "Invalid Name and Birthday Combination";
            }
        }