public static void AddUser(User user) { using (AptekaDataDataContext con = new AptekaDataDataContext()) { con.Users.InsertOnSubmit(user); con.SubmitChanges(); } }
public static void DeleteUser(User user) { using (AptekaDataDataContext con = new AptekaDataDataContext()) { User us = (from u in con.Users where u.UsersId == user.UsersId select u).FirstOrDefault(); con.Users.DeleteOnSubmit(us); con.SubmitChanges(); } }
public static void EditUser(User user) { using (AptekaDataDataContext con = new AptekaDataDataContext()) { User us = (from u in con.Users where u.UsersId == user.UsersId select u).FirstOrDefault(); us.Nazwa_uzytkownika = user.Nazwa_uzytkownika; us.Haslo = user.Haslo; us.Prawo = user.Prawo; con.SubmitChanges(); } }
partial void DeleteUser(User instance);
partial void UpdateUser(User instance);
partial void InsertUser(User instance);
public User_add_edit() { InitializeComponent(); this.user = new User(); }
public User_add_edit(User user,int mode) { InitializeComponent(); this.user = user; this.mode = mode; }