Ejemplo n.º 1
0
        private void AddRow(Admin model)
        {
            var rowIndex = dataGridView1.Rows.Add();

            var row = dataGridView1.Rows[rowIndex];
            row.Cells["Username"].Value = model.Username;
            row.Cells["Password"].Value = model.Password;
            row.Cells["Role"].Value = model.Role.ToString();

            dataGridView1.CurrentCell = row.Cells[0];
            dataGridView1.BeginEdit(false);
        }
Ejemplo n.º 2
0
        public static Admin Login(string username, string password)
        {
            var admins = DataManager.Instance.GetList<Admin>();
            if (admins.Count == 0)
            {
                _currentUser = new Admin { Username = "******", Password = "******", Role = Role.系统管理员 };
            }

            foreach (var e in admins)
            {
                if (e.Username.ToLower() == username.ToLower() && e.Password == password)
                {
                    _currentUser = e;
                }
            }
            return _currentUser;
        }
Ejemplo n.º 3
0
 public static void Logout()
 {
     _currentUser = null;
 }