コード例 #1
0
        public UserList SelectRows(DbTransaction pTran, System.Int32?Id, System.String userName, System.String fullName, System.DateTime?createDate)
        {
            UserList  UserList  = new UserList();
            Exception exception = null;

            DbParameter[] Parameters = new DbParameter[4];
            Parameters[0] = _getIdParameter(Id, ParameterDirection.Input);
            Parameters[1] = _getuserNameParameter(userName, ParameterDirection.Input);
            Parameters[2] = _getfullNameParameter(fullName, ParameterDirection.Input);
            Parameters[3] = _getcreateDateParameter(createDate, ParameterDirection.Input);

            DbDataReader Dr = ExecuteReader(pTran, "[Lookups].[SelectUser]", Parameters);

            try
            {
                if (Dr != null)
                {
                    while (Dr.Read())
                    {
                        User User = new User();
                        if (Dr["Id"] != DBNull.Value)
                        {
                            User.Id = (System.Int32)Dr["Id"];
                        }
                        if (Dr["userName"] != DBNull.Value)
                        {
                            User.userName = (System.String)Dr["userName"];
                        }
                        if (Dr["fullName"] != DBNull.Value)
                        {
                            User.fullName = (System.String)Dr["fullName"];
                        }
                        if (Dr["Password"] != DBNull.Value)
                        {
                            User.Password = (System.String)Dr["Password"];
                        }
                        if (Dr["status"] != DBNull.Value)
                        {
                            User.status = (System.Boolean?)Dr["status"];
                        }
                        if (Dr["createDate"] != DBNull.Value)
                        {
                            User.createDate = (System.DateTime?)Dr["createDate"];
                        }
                        UserList.FillRow(User);
                        User = null;
                    }
                }
            }
            catch (Exception Ex)
            {
                exception = Ex;
            }
            finally
            {
                if (Dr != null)
                {
                    if (Dr.IsClosed == false)
                    {
                        Dr.Close();
                    }
                    Dr = null;
                }
            }
            return(UserList);
        }