예제 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(abc.Model.Model.MemberBooking model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update MemberBooking set ");
            strSql.Append("BookingNo=SQL2012BookingNo,");
            strSql.Append("PlanId=SQL2012PlanId,");
            strSql.Append("OldBookingId=SQL2012OldBookingId,");
            strSql.Append("BookingType=SQL2012BookingType,");
            strSql.Append("ClassTime=SQL2012ClassTime,");
            strSql.Append("BookingTime=SQL2012BookingTime,");
            strSql.Append("BeginTime=SQL2012BeginTime,");
            strSql.Append("EndTime=SQL2012EndTime");
            strSql.Append(" where BookingId=SQL2012BookingId");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012BookingNo",    SqlDbType.VarChar,    255),
                new SqlParameter("SQL2012PlanId",       SqlDbType.Int,          4),
                new SqlParameter("SQL2012OldBookingId", SqlDbType.VarChar,   4000),
                new SqlParameter("SQL2012BookingType",  SqlDbType.Int,          4),
                new SqlParameter("SQL2012ClassTime",    SqlDbType.DateTime),
                new SqlParameter("SQL2012BookingTime",  SqlDbType.DateTime),
                new SqlParameter("SQL2012BeginTime",    SqlDbType.DateTime),
                new SqlParameter("SQL2012EndTime",      SqlDbType.DateTime),
                new SqlParameter("SQL2012BookingId",    SqlDbType.Int,          4),
                new SqlParameter("SQL2012MemberId",     SqlDbType.Int, 4)
            };
            parameters[0].Value = model.BookingNo;
            parameters[1].Value = model.PlanId;
            parameters[2].Value = model.OldBookingId;
            parameters[3].Value = model.BookingType;
            parameters[4].Value = model.ClassTime;
            parameters[5].Value = model.BookingTime;
            parameters[6].Value = model.BeginTime;
            parameters[7].Value = model.EndTime;
            parameters[8].Value = model.BookingId;
            parameters[9].Value = model.MemberId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public abc.Model.Model.MemberBooking DataRowToModel(DataRow row)
 {
     abc.Model.Model.MemberBooking model = new abc.Model.Model.MemberBooking();
     if (row != null)
     {
         if (row["BookingId"] != null && row["BookingId"].ToString() != "")
         {
             model.BookingId = int.Parse(row["BookingId"].ToString());
         }
         if (row["BookingNo"] != null)
         {
             model.BookingNo = row["BookingNo"].ToString();
         }
         if (row["PlanId"] != null && row["PlanId"].ToString() != "")
         {
             model.PlanId = int.Parse(row["PlanId"].ToString());
         }
         if (row["MemberId"] != null && row["MemberId"].ToString() != "")
         {
             model.MemberId = int.Parse(row["MemberId"].ToString());
         }
         if (row["OldBookingId"] != null)
         {
             model.OldBookingId = row["OldBookingId"].ToString();
         }
         if (row["BookingType"] != null && row["BookingType"].ToString() != "")
         {
             model.BookingType = int.Parse(row["BookingType"].ToString());
         }
         if (row["ClassTime"] != null && row["ClassTime"].ToString() != "")
         {
             model.ClassTime = DateTime.Parse(row["ClassTime"].ToString());
         }
         if (row["BookingTime"] != null && row["BookingTime"].ToString() != "")
         {
             model.BookingTime = DateTime.Parse(row["BookingTime"].ToString());
         }
         if (row["BeginTime"] != null && row["BeginTime"].ToString() != "")
         {
             model.BeginTime = DateTime.Parse(row["BeginTime"].ToString());
         }
         if (row["EndTime"] != null && row["EndTime"].ToString() != "")
         {
             model.EndTime = DateTime.Parse(row["EndTime"].ToString());
         }
     }
     return(model);
 }
예제 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(abc.Model.Model.MemberBooking model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into MemberBooking(");
            strSql.Append("BookingNo,PlanId,MemberId,OldBookingId,BookingType,ClassTime,BookingTime,BeginTime,EndTime)");
            strSql.Append(" values (");
            strSql.Append("SQL2012BookingNo,SQL2012PlanId,SQL2012MemberId,SQL2012OldBookingId,SQL2012BookingType,SQL2012ClassTime,SQL2012BookingTime,SQL2012BeginTime,SQL2012EndTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012BookingNo",    SqlDbType.VarChar,    255),
                new SqlParameter("SQL2012PlanId",       SqlDbType.Int,          4),
                new SqlParameter("SQL2012MemberId",     SqlDbType.Int,          4),
                new SqlParameter("SQL2012OldBookingId", SqlDbType.VarChar,   4000),
                new SqlParameter("SQL2012BookingType",  SqlDbType.Int,          4),
                new SqlParameter("SQL2012ClassTime",    SqlDbType.DateTime),
                new SqlParameter("SQL2012BookingTime",  SqlDbType.DateTime),
                new SqlParameter("SQL2012BeginTime",    SqlDbType.DateTime),
                new SqlParameter("SQL2012EndTime",      SqlDbType.DateTime)
            };
            parameters[0].Value = model.BookingNo;
            parameters[1].Value = model.PlanId;
            parameters[2].Value = model.MemberId;
            parameters[3].Value = model.OldBookingId;
            parameters[4].Value = model.BookingType;
            parameters[5].Value = model.ClassTime;
            parameters[6].Value = model.BookingTime;
            parameters[7].Value = model.BeginTime;
            parameters[8].Value = model.EndTime;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public abc.Model.Model.MemberBooking GetModel(int BookingId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 BookingId,BookingNo,PlanId,MemberId,OldBookingId,BookingType,ClassTime,BookingTime,BeginTime,EndTime from MemberBooking ");
            strSql.Append(" where BookingId=SQL2012BookingId");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012BookingId", SqlDbType.Int, 4)
            };
            parameters[0].Value = BookingId;

            abc.Model.Model.MemberBooking model = new abc.Model.Model.MemberBooking();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }