Exemplo n.º 1
0
        /// <summary>
        /// ��ȡָ���û���֧����ʽ����
        /// </summary>
        /// <param name="uid">�û�ID</param>
        /// <returns></returns>
        public static List<PayMode> List(int uid)
        {
            /*
             [INV_PayModeList]
            @uid int
             */

            //[Id],[UserId],[Title],[Mode],[Details],[IsActive]

            List<PayMode> list = new List<PayMode>();
            PayMode pm;

            using (SqlDataReader reader = Database.ExecuteReader(CommandType.StoredProcedure, "INV_PayModeList",
                new SqlParameter[] { Database.MakeInParam("@uid", SqlDbType.Int, uid) }))
            {
                while (reader.Read())
                {
                    pm = new PayMode();
                    pm.id = reader.GetInt32(0);
                    pm.userId = reader.GetInt32(1);
                    pm.title = reader.GetString(2);
                    pm.mode = (PaymentModeEnum)(reader.GetInt16(3));
                    pm.InitDetails(reader.GetString(4));
                    pm.isActive = reader.GetBoolean(5);
                    list.Add(pm);
                }
                reader.Close();
            }

            return list;
        }
Exemplo n.º 2
0
        /// <summary>
        /// ��ȡ����ID��UserId��֧����ʽ
        /// </summary>
        /// <param name="uid">�û�ID</param>
        /// <param name="id">֧����ʽID</param>
        /// <returns></returns>
        public static PayMode Get(int uid,int id)
        {
            /*
             [INV_PayModeGet]
            @uid int=0,
            @id int
             */

            //[Id],[UserId],[Title],[Mode],[Details],[IsActive]

            PayMode pm = null;

            using (SqlDataReader reader = Database.ExecuteReader(CommandType.StoredProcedure, "INV_PayModeGet",
                new SqlParameter[] {
                    Database.MakeInParam("@uid",SqlDbType.Int,uid),
                    Database.MakeInParam("@id",SqlDbType.Int,id)
                }))
            {
                if (reader.Read())
                {
                    pm = new PayMode();
                    pm.id = reader.GetInt32(0);
                    pm.userId = reader.GetInt32(1);
                    pm.title = reader.GetString(2);
                    pm.mode = (PaymentModeEnum)(reader.GetInt16(3));
                    pm.InitDetails(reader.GetString(4));
                    pm.isActive = reader.GetBoolean(5);
                }
                reader.Close();
            }

            return pm;
        }