Example #1
0
        public M_MySubscription GetMySubscriptionById(int id)
        {
            string sql = "select * from ZL_MySubscription where id=@id";

            SqlParameter[] cmdParam = new SqlParameter[] {
                new SqlParameter("@id", SqlDbType.Int)
            };
            cmdParam[0].Value = id;
            M_MySubscription mysub = null;

            using (SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql, cmdParam))
            {
                if (reader.Read())
                {
                    mysub              = new M_MySubscription();
                    mysub.Id           = DataConverter.CLng(reader["id"]);
                    mysub.Reference_ID = DataConverter.CLng(reader["reference_ID"]);
                    mysub.Order_Time   = DataConverter.CDate(reader["order_Time"]);
                    mysub.Period       = DataConverter.CLng(reader["period"]);
                    mysub.Start_Date   = DataConverter.CDate(reader["start_Date"]);
                    mysub.Order_Type   = DataConverter.CLng(reader["order_Type"]);
                    mysub.User_Name    = reader["user_Name"].ToString();
                    mysub.Tel          = reader["tel"].ToString();
                    mysub.Email        = reader["email"].ToString();
                }
                reader.Close();
                reader.Dispose();
            }
            return(mysub);
        }
Example #2
0
        public int AddSubscription(M_MySubscription mysub)
        {
            int    num = 0;
            string sql = "insert into ZL_MySubscription(Reference_ID,Order_Time,Period,Start_Date,Order_Type,User_Name,Tel,Email) values(" + mysub.Reference_ID + ",'" + mysub.Order_Time + "'," + mysub.Period + ",'" + mysub.Start_Date + "'," + mysub.Order_Type + ",'" + mysub.User_Name + "','" + mysub.Tel + "','" + mysub.Email + "')";

            num = SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sql, null));
            return(num);
        }
Example #3
0
        /// <summary>
        /// 查询方法根据内容id和用户名
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public DataTable GetMySubscriptionName(string name)
        {
            string           sql   = "select * from ZL_MySubscription where User_Name=@User_Name and Order_Type=4 ";
            M_MySubscription mysub = new M_MySubscription();

            SqlParameter[] sp = new SqlParameter[1]
            {
                new SqlParameter("User_Name", SqlDbType.NVarChar)
            };
            sp[0].Value = name;
            return(SqlHelper.ExecuteTable(CommandType.Text, sql, sp));
        }
Example #4
0
        public bool UpdateOrderTyleName(M_MySubscription sub)
        {
            string sql = "update ZL_MySubscription set Order_Type=@Order_Type where Reference_ID=@Reference_ID and User_Name=@User_Name ";

            SqlParameter[] sp = new SqlParameter[3]
            {
                new SqlParameter("@Order_Type", SqlDbType.Int),
                new SqlParameter("@Reference_ID", SqlDbType.Int),
                new SqlParameter("@User_Name", SqlDbType.NVarChar)
            };
            sp[0].Value = sub.Order_Type;
            sp[1].Value = sub.Reference_ID;
            sp[2].Value = sub.User_Name;
            return(SqlHelper.ExecuteSql(sql, sp));
        }
Example #5
0
        public void UpdSubscription(M_MySubscription subscription)
        {
            string sql = "update ZL_MySubscription set Reference_ID=@Reference_ID,Period=@Period,Start_Date=@Start_Date,Order_Type=@Order_Type,User_Name=@User_Name,Tel=@Tel,Email=@Email where id=@id";

            SqlParameter[] sp = new SqlParameter[8] {
                new SqlParameter("@Reference_ID", SqlDbType.Int),
                new SqlParameter("@Period", SqlDbType.Int),
                new SqlParameter("@Start_Date ", SqlDbType.DateTime),
                new SqlParameter("@Order_Type", SqlDbType.BigInt),
                new SqlParameter("@User_Name", SqlDbType.NVarChar),
                new SqlParameter("@Tel", SqlDbType.NVarChar),
                new SqlParameter("@Email", SqlDbType.NVarChar),
                new SqlParameter("@id", SqlDbType.BigInt),
            };
            sp[0].Value = subscription.Reference_ID;
            sp[1].Value = subscription.Period;
            sp[2].Value = subscription.Start_Date;
            sp[3].Value = subscription.Order_Type;
            sp[4].Value = subscription.User_Name;
            sp[5].Value = subscription.Tel;
            sp[6].Value = subscription.Email;
            sp[7].Value = subscription.Id;
            SqlHelper.ExecuteSql(sql, sp);
        }
Example #6
0
 public int insert(M_MySubscription model)
 {
     return(Sql.insert(strTableName, model.GetParameters(model), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
 }
Example #7
0
 /// <summary>
 /// 根据ID更新
 /// </summary>
 public bool UpdateByID(M_MySubscription model)
 {
     return(Sql.UpdateByIDs(strTableName, PK, model.Id.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters(model)));
 }