Inheritance: INotifyPropertyChanging, INotifyPropertyChanged
コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: KyleeMacLean/SLApp
        private void saveUser_BTN_Click(object sender, RoutedEventArgs e)
        {
            Application_User userROW = users_DataGrid.SelectedItem as Application_User;
            if (userROW != null)
            {
                if (dbMethods.CheckDatabaseConnection())
                {
                    using (PubsDataContext db = new PubsDataContext())
                    {
                        var completionList = new List<Application_User>(from s in db.Application_Users
                                                                           where s.Username == userROW.Username
                                                                           select s);
                        if (completionList.Count > 0)
                        {

                            var completion = completionList.First();
                            completion.Username = userROW.Username;
                            completion.Password = userROW.Password;
                            completion.LastName = userROW.LastName;
                            completion.IsAdmin = userROW.IsAdmin;
                            completion.FirstName = userROW.FirstName;
                            completion.Birthdate = userROW.Birthdate; // Fixes the issue with saving birthdates

                            db.SubmitChanges();
                            LoadUsers(users_DataGrid);
                        }
                        else
                        {
                            Application_User exp = new Application_User();

                            exp.Username = userROW.Username;
                            exp.Password = userROW.Password;
                            exp.LastName = userROW.LastName;
                            exp.IsAdmin = userROW.IsAdmin;
                            exp.FirstName = userROW.FirstName;
                            exp.Birthdate = userROW.Birthdate; // Fixes the issue with saving birthdates

                            db.Application_Users.InsertOnSubmit(exp);
                            db.SubmitChanges();
                            LoadUsers(users_DataGrid);
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Pubs.designer.cs プロジェクト: JasonRenner24/SLApp
 partial void UpdateApplication_User(Application_User instance);
コード例 #3
0
ファイル: Pubs.designer.cs プロジェクト: JasonRenner24/SLApp
 partial void DeleteApplication_User(Application_User instance);
コード例 #4
0
ファイル: Pubs.designer.cs プロジェクト: JasonRenner24/SLApp
 partial void InsertApplication_User(Application_User instance);