Ejemplo n.º 1
0
        private UserPanelController(ref DBDelegateBridge.UIMoney uim, ref DBDelegateBridge.UIStockHold uis, ref InfoDelegate.SetWin setWin)
        {
            this.uim        = uim;
            this.uis        = uis;
            this.setWin     = setWin;
            usersController = new UsersController();
            DB_ERROR DBE = usersController.GetLastError();

            if (DBE == DB_ERROR.DB_DATA_NOT_EXISTS)
            {
                InputMoney dlg = new InputMoney();
                dlg.ShowDialog();
                if (dlg.m == 0)
                {
                    Application.Current.Shutdown();
                    return;
                }
                usersController.AddNewUser(dlg.n, dlg.m);
            }
            else if (DBE != DB_ERROR.DB_OK)
            {
                Adapter.ErrorAdapter.Show(DBE);
                Application.Current.Shutdown();
                return;
            }
            List <string> users = usersController.GetUserList();

            UserBoxController.Handler().setEventHandler(UserChange);
            foreach (string name in users)
            {
                //选择
                UserBoxController.Handler().Add(name, usersController.GetUserControler(name).PrincipalRead());
            }
            UserChange(users.First());
        }
Ejemplo n.º 2
0
        public void AddUser(string name, double m)
        {
            usersController.AddNewUser(name, m);
            ComboBoxItem cbi = new ComboBoxItem();

            cbi.Content = name;
            UserBoxController.Handler().Add(name, m);
        }
Ejemplo n.º 3
0
 public void DelUser(string name)
 {
     if (usersController.GetUserList().Count == 1)
     {
         MessageBox.Show("不能删除最后一个账户!");
         return;
     }
     usersController.DelUser(name);
     UserBoxController.Handler().Remove(name);
     CanvasDict.Remove(name);
     NetDict.Remove(name);
     InfoSwitch.Remove(name);
     UserChange(usersController.GetUserList().First());
 }