Esempio n. 1
0
        protected override void onSaving()
        {
            try
            {
                DataTable table = this.DataTable.GetChanges();

                if (table != null)
                {
                    UserPrivilegeTableAdapter userPrivilegeTableAdapter = (UserPrivilegeTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterUserPrivilege);
                    AuthenService             authenService             = new AuthenService();

                    foreach (DataRow row in table.Rows)
                    {
                        UserRow userRow = (UserRow)row;
                        authenService.UpdateUserPrivileges(userPrivilegeTableAdapter, userRow.UserId, (List <int>)userRow.UserPrivileges);
                    }

                    this.DataAdapter.Update(table);
                    this.DataTable.Merge(table);
                }

                this.DataTable.AcceptChanges();
            }
            catch (Exception ex)
            {
                this.onSavingError(ex);
            }

            FormMainFacade.SetStatusCaption(this.FormKey, StatusCaptions.SavedCaption);
        }
Esempio n. 2
0
 public void SetAuthenticatedUser(UserRow user, UserPrivilegeDataTable table)
 {
     StaticDataFacade.Remove(StaticDataKeys.AuthenticatedData);
     StaticDataFacade.Add(StaticDataKeys.AuthenticatedData, new AuthenticatedEntity(user, table));
 }
Esempio n. 3
0
 public AuthenticatedEntity(UserRow user, UserPrivilegeDataTable table)
 {
     this.User = user;
     this.UserPrivilegeTable = table;
 }