/// <summary> /// 建立新 member 物件。 /// </summary> /// <param name="id">id 屬性的初始值。</param> /// <param name="username">username 屬性的初始值。</param> /// <param name="password">password 屬性的初始值。</param> /// <param name="name">name 屬性的初始值。</param> /// <param name="sex">sex 屬性的初始值。</param> /// <param name="mail">mail 屬性的初始值。</param> /// <param name="isadmin">isadmin 屬性的初始值。</param> public static member Createmember(global::System.Int32 id, global::System.String username, global::System.String password, global::System.String name, global::System.String sex, global::System.String mail, global::System.Boolean isadmin) { member member = new member(); member.id = id; member.username = username; member.password = password; member.name = name; member.sex = sex; member.mail = mail; member.isadmin = isadmin; return(member); }
public bool register(member memstr) { string memAuthcode = authCode(); member mem = new member(); mem.username = memstr.username; mem.password = FormsAuthentication.HashPasswordForStoringInConfigFile(memstr.password, "MD5"); mem.name = memstr.name; mem.sex = memstr.sex; mem.mail = memstr.mail; mem.authcode = memAuthcode; mem.isadmin = false; string authUrl = "<a href=http://" + HttpContext.Current.Request.ServerVariables["HTTP_HOST"] + "/Member/auth?code=" + memAuthcode + ">連結</a>"; sendmail(memstr.mail, "myMember會員驗證信", "請點選以下連結進行會員認證:" + authUrl); db.member.AddObject(mem); db.SaveChanges(); return(true); }
/// <summary> /// 將新物件加入 member EntitySet 的方法已被取代。請考慮改為使用關聯的 ObjectSet<T> 屬性的 .Add 方法。 /// </summary> public void AddTomember(member member) { base.AddObject("member", member); }