예제 #1
0
        public Staff Load(string string2)
        {
            DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this._dataProviderType, this._connectionString);

            dataAccessLayer.Open();
            string[]  string0   = new string[] { "select * from ", this._tableName, " where ID='", string2, "'" };
            DataTable dataTable = dataAccessLayer.ExecuteDataTable(string.Concat(string0));
            Staff     staff     = null;

            if (dataTable.Rows.Count > 0)
            {
                DataRow item = dataTable.Rows[0];
                staff = new Staff()
                {
                    StaffID   = Convert.ToString(item["ID"]),
                    LoginName = Convert.ToString(item["ID"]),
                    RealName  = Convert.ToString(item["NAME"]),
                    Password  = Regedit.DecryptTextNet(Convert.ToString(item["PASSWORD"]))
                };
            }
            dataAccessLayer.Close();
            return(staff);
        }
예제 #2
0
        public List <Staff> Load()
        {
            List <Staff>             staffs          = new List <Staff>();
            DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this._dataProviderType, this._connectionString);

            dataAccessLayer.Open();
            DataTable dataTable = dataAccessLayer.ExecuteDataTable(string.Concat("select * from ", this._tableName));

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                DataRow item  = dataTable.Rows[i];
                Staff   staff = new Staff()
                {
                    StaffID   = Convert.ToString(item["ID"]),
                    LoginName = Convert.ToString(item["ID"]),
                    RealName  = Convert.ToString(item["NAME"]),
                    Password  = Regedit.DecryptTextNet(Convert.ToString(item["PASSWORD"]))
                };
                staffs.Add(staff);
            }
            dataAccessLayer.Close();
            return(staffs);
        }