void LoadUserTable() { DatabaseSet.使用者DataTable table = 使用者TableAdapter.Instance.GetDataExcludeDefault(); table.Columns.Add(new DataColumn("身分", typeof(string))); this.Table = table; UpdateIdentities(); }
public static User GetUser(string username, string password) { DatabaseSet.使用者DataTable datatable = _adapter.GetByUsername_Password(username, password); if (datatable.Rows.Count > 0) { User user = new User(); user.DataRow = datatable.Rows[0] as DatabaseSet.使用者Row; return(user); } else { throw new SWLHMSException("帳號或密碼錯誤,請檢查後重新輸入"); } }
public virtual DatabaseSet.使用者DataTable GetDataExcludeDefault() { this.Adapter.SelectCommand = this.CommandCollection[3]; DatabaseSet.使用者DataTable dataTable = new DatabaseSet.使用者DataTable(); this.Adapter.Fill(dataTable); return dataTable; }
public virtual DatabaseSet.使用者DataTable GetByUsername_Password(string 帳號, string 密碼) { this.Adapter.SelectCommand = this.CommandCollection[2]; if ((帳號 == null)) { throw new global::System.ArgumentNullException("帳號"); } else { this.Adapter.SelectCommand.Parameters[0].Value = ((string)(帳號)); } if ((密碼 == null)) { this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = ((string)(密碼)); } DatabaseSet.使用者DataTable dataTable = new DatabaseSet.使用者DataTable(); this.Adapter.Fill(dataTable); return dataTable; }