Esempio n. 1
0
        protected void Add(object sender, EventArgs e)
        {
            membership m = new membership { FirstName = tb_fname.Text, LastName = tb_lname.Text,
                MembershipClass = tb_memtype.Text, VerificationCode = tb_vcode.Text };
            members.memberships.AddObject(m);
            members.SaveChanges();

            //can't reuse Search() method, so lets just dump the important stuff here
            var search = from emp in this.members.memberships
                         where
                             (emp.FirstName == tb_fname.Text) ||
                             (emp.LastName == tb_lname.Text) ||
                             (emp.MembershipClass == tb_memtype.Text) ||
                             (emp.VerificationCode == tb_vcode.Text)
                         select emp;

            GridView1.DataSource = search;
            DataBind();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the memberships EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTomemberships(membership membership)
 {
     base.AddObject("memberships", membership);
 }
 /// <summary>
 /// Create a new membership object.
 /// </summary>
 /// <param name="membershipId">Initial value of the MembershipId property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="membershipClass">Initial value of the MembershipClass property.</param>
 /// <param name="verificationCode">Initial value of the VerificationCode property.</param>
 public static membership Createmembership(global::System.Int32 membershipId, global::System.String firstName, global::System.String lastName, global::System.String membershipClass, global::System.String verificationCode)
 {
     membership membership = new membership();
     membership.MembershipId = membershipId;
     membership.FirstName = firstName;
     membership.LastName = lastName;
     membership.MembershipClass = membershipClass;
     membership.VerificationCode = verificationCode;
     return membership;
 }