Esempio 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());
 }
Esempio n. 2
0
 ////默认路径数据库
 //public DBDataController()
 //{
 //    dbPath = Environment.CurrentDirectory + "\\Stock.db";
 //    user = "******";
 //    DBE = Check();
 //    delegateController = new DBDelegateBridge(this);
 //}
 ////指定用户名
 //public DBDataController(string name)
 //{
 //    dbPath = Environment.CurrentDirectory + "\\Stock.db";
 //    user = name;
 //    DBE = Check();
 //    delegateController = new DBDelegateBridge(this);
 //}
 //指定路径
 public DBDataController(string name,string path)
 {
     dbPath = path;
     user = name;
     money.name = name;
     DBE = Check();
     delegateController = new DBDelegateBridge(this);
 }
Esempio n. 3
0
 ////默认路径数据库
 //public DBDataController()
 //{
 //    dbPath = Environment.CurrentDirectory + "\\Stock.db";
 //    user = "******";
 //    DBE = Check();
 //    delegateController = new DBDelegateBridge(this);
 //}
 ////指定用户名
 //public DBDataController(string name)
 //{
 //    dbPath = Environment.CurrentDirectory + "\\Stock.db";
 //    user = name;
 //    DBE = Check();
 //    delegateController = new DBDelegateBridge(this);
 //}
 //指定路径
 public DBDataController(string name, string path)
 {
     dbPath             = path;
     user               = name;
     money.name         = name;
     DBE                = Check();
     delegateController = new DBDelegateBridge(this);
 }
Esempio n. 4
0
 public static UserPanelController Create(ref DBDelegateBridge.UIMoney uim, ref DBDelegateBridge.UIStockHold uis, ref InfoDelegate.SetWin setWin)
 {
     if (UPC == null)
     {
         UPC = new UserPanelController(ref uim, ref uis, ref setWin);
         return UPC;
     }
     else
         return UPC;
 }