Beispiel #1
0
        /// <summary>
        ///  获取实体列表
        /// </summary>
        /// <param name="showFields">显示字段</param>
        /// <param name="reader">IDataReader</param>
        /// <returns>返回Admin实体列表</returns>
        public static List<AdminModel> GetList(List<AdminFields> showFields, IDataReader reader)
        {
            List< AdminModel> list = new List< AdminModel>();
            while ( reader.Read() )
            {
                 AdminModel admin= new AdminModel();
                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.AId)) && reader["AId"] !=DBNull.Value)
                {
                   admin.AId = Convert.ToInt32(reader["AId"]);
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.AName)) && reader["AName"] !=DBNull.Value)
                {
                   admin.AName = reader["AName"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.APassword)) && reader["APassword"] !=DBNull.Value)
                {
                   admin.APassword = reader["APassword"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.AEmail)) && reader["AEmail"] !=DBNull.Value)
                {
                   admin.AEmail = reader["AEmail"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.ATelephone)) && reader["ATelephone"] !=DBNull.Value)
                {
                   admin.ATelephone = reader["ATelephone"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.ARowValid)) && reader["ARowValid"] !=DBNull.Value)
                {
                   admin.ARowValid = Convert.ToByte(reader["ARowValid"]);
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.ACreateTime)) && reader["ACreateTime"] !=DBNull.Value)
                {
                   admin.ACreateTime = Convert.ToDateTime(reader["ACreateTime"]);
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.AScenicId)) && reader["AScenicId"] !=DBNull.Value)
                {
                   admin.AScenicId = reader["AScenicId"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.AUserId)) && reader["AUserId"] !=DBNull.Value)
                {
                   admin.AUserId = reader["AUserId"].ToString();
                }

                if ( (( showFields == null || showFields.Count == 0 ) || IsExistField(showFields, AdminFields.AUserLimit)) && reader["AUserLimit"] !=DBNull.Value)
                {
                   admin.AUserLimit = Convert.ToByte(reader["AUserLimit"]);
                }

                  list.Add(admin);
            }
            reader.Close();
            return list;
        }
Beispiel #2
0
 /// <summary>
 /// Admin 添加操作返回主键的编号
 /// </summary>
 /// <param name="admin">Admin实体类</param>
 /// <param name="transaction">事务</param>
 /// <returns>执行成功返回true,否则为false</returns>
 public int AddByIdentity(AdminModel admin,DbTransaction transaction)
 {
     string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:Admin表增加操作/File:AdminAccess.cs/Fun:AddByIdentity*/";
        StringBuilder sql = new StringBuilder();
        sql.Append(sqlDescription);
        sql.Append("insert ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[Admin] (AName,APassword,AEmail,ATelephone,ARowValid,ACreateTime,AScenicId,AUserId,AUserLimit) values(@AName,@APassword,@AEmail,@ATelephone,@ARowValid,@ACreateTime,@AScenicId,@AUserId,@AUserLimit)");
        SqlParameterWrapperCollection Collection = new SqlParameterWrapperCollection();
        Collection.Add(new SqlParameterWrapper("@AName", admin.AName,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@APassword", admin.APassword,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@AEmail", admin.AEmail,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@ATelephone", admin.ATelephone,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@ARowValid", admin.ARowValid,SqlDbType.TinyInt));
        Collection.Add(new SqlParameterWrapper("@ACreateTime", admin.ACreateTime,SqlDbType.DateTime));
        Collection.Add(new SqlParameterWrapper("@AScenicId", admin.AScenicId,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@AUserId", admin.AUserId,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@AUserLimit", admin.AUserLimit,SqlDbType.TinyInt));
        return SqlHelper.ExecuteIdentity(DatabaseFactory.GetWriteDatabase(DatabaseManager.Db_JQEBookingConfig),sql.ToString(),Collection,transaction);
 }
Beispiel #3
0
 /// <summary>
 /// Admin修改操作
 /// </summary>
 /// <param name="aId">景区用户Id</param>
 /// <param name="updateModel">要修改Admin实体类</param>
 /// <param name="transaction">事务</param>
 /// <returns>执行成功返回true,否则为false</returns>
 public bool Update(int aId,AdminModel updateModel,DbTransaction transaction)
 {
     string sqlDescription = "/*" + DatabaseManager.SqlDescription + "/Author:TCSmartFrameWork自动生成/For:Admin表更新操作/File:AdminAccess.cs/Fun:Update*/";
     StringBuilder sql = new StringBuilder();
     sql.Append(sqlDescription);
        sql.Append("update ["+ DatabaseManager.Db_JQEBookingDataBase+"].[dbo].[Admin] set APassword=@APassword,AEmail=@AEmail,ATelephone=@ATelephone,ARowValid=@ARowValid,ACreateTime=@ACreateTime,AScenicId=@AScenicId,AUserLimit=@AUserLimit where AId=@AId");
        SqlParameterWrapperCollection Collection = new SqlParameterWrapperCollection();
        Collection.Add(new SqlParameterWrapper("@APassword", updateModel.APassword,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@AEmail", updateModel.AEmail,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@ATelephone", updateModel.ATelephone,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@ARowValid", updateModel.ARowValid,SqlDbType.TinyInt));
        Collection.Add(new SqlParameterWrapper("@ACreateTime", updateModel.ACreateTime,SqlDbType.DateTime));
        Collection.Add(new SqlParameterWrapper("@AScenicId", updateModel.AScenicId,SqlDbType.NVarChar));
        Collection.Add(new SqlParameterWrapper("@AUserLimit", updateModel.AUserLimit,SqlDbType.TinyInt));
        Collection.Add(new SqlParameterWrapper("@AId", aId,SqlDbType.Int));
        return SqlHelper.ExecuteNonQuery(DatabaseFactory.GetWriteDatabase(DatabaseManager.Db_JQEBookingConfig),sql.ToString(),Collection,transaction) > 0;
 }
Beispiel #4
0
 /// <summary>
 /// Admin 添加操作返回主键的编号
 /// </summary>
 /// <param name="admin">Admin实体类</param>
 /// <returns>执行成功返回true,否则为false</returns>
 public int AddByIdentity(AdminModel admin)
 {
     return dataAccess.AddByIdentity(admin);
 }
Beispiel #5
0
 /// <summary>
 /// Admin修改操作
 /// </summary>
 /// <param name="aId">景区用户Id</param>
 /// <param name="updateModel">要修改Admin实体类</param>
 /// <returns>执行成功返回true,否则为false</returns>
 public bool Update(int aId,AdminModel updateModel)
 {
     return dataAccess.Update(aId,updateModel);
 }
Beispiel #6
0
 /// <summary>
 ///Admin 添加操作
 /// </summary>
 /// <param name="admin">Admin实体类</param>
 /// <returns>执行成功返回true,否则为false</returns>
 public bool Add(AdminModel admin)
 {
     return dataAccess.Add(admin);
 }