Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ColoPay.Model.SysManage.TaskQueue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SA_TaskQueue set ");
            strSql.Append("TaskId=@TaskId,");
            strSql.Append("Status=@Status,");
            strSql.Append("RunDate=@RunDate");
            strSql.Append(" where ID=@ID and Type=@Type ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskId",  SqlDbType.Int,       4),
                new SqlParameter("@Status",  SqlDbType.Int,       4),
                new SqlParameter("@RunDate", SqlDbType.DateTime),
                new SqlParameter("@ID",      SqlDbType.Int,       4),
                new SqlParameter("@Type",    SqlDbType.Int, 4)
            };
            parameters[0].Value = model.TaskId;
            parameters[1].Value = model.Status;
            parameters[2].Value = model.RunDate;
            parameters[3].Value = model.ID;
            parameters[4].Value = model.Type;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(ColoPay.Model.SysManage.TaskQueue model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SA_TaskQueue(");
            strSql.Append("ID,Type,TaskId,Status,RunDate)");
            strSql.Append(" values (");
            strSql.Append("@ID,@Type,@TaskId,@Status,@RunDate)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",      SqlDbType.Int, 4),
                new SqlParameter("@Type",    SqlDbType.Int, 4),
                new SqlParameter("@TaskId",  SqlDbType.Int, 4),
                new SqlParameter("@Status",  SqlDbType.Int, 4),
                new SqlParameter("@RunDate", SqlDbType.DateTime)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.Type;
            parameters[2].Value = model.TaskId;
            parameters[3].Value = model.Status;
            parameters[4].Value = model.RunDate;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public ColoPay.Model.SysManage.TaskQueue DataRowToModel(DataRow row)
 {
     ColoPay.Model.SysManage.TaskQueue model = new ColoPay.Model.SysManage.TaskQueue();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["Type"] != null && row["Type"].ToString() != "")
         {
             model.Type = int.Parse(row["Type"].ToString());
         }
         if (row["TaskId"] != null && row["TaskId"].ToString() != "")
         {
             model.TaskId = int.Parse(row["TaskId"].ToString());
         }
         if (row["Status"] != null && row["Status"].ToString() != "")
         {
             model.Status = int.Parse(row["Status"].ToString());
         }
         if (row["RunDate"] != null && row["RunDate"].ToString() != "")
         {
             model.RunDate = DateTime.Parse(row["RunDate"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ColoPay.Model.SysManage.TaskQueue GetModel(int ID, int Type)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,Type,TaskId,Status,RunDate from SA_TaskQueue ");
            strSql.Append(" where ID=@ID and Type=@Type ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",   SqlDbType.Int, 4),
                new SqlParameter("@Type", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;
            parameters[1].Value = Type;

            ColoPay.Model.SysManage.TaskQueue model = new ColoPay.Model.SysManage.TaskQueue();
            DataSet ds = DBHelper.DefaultDBHelper.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        public ColoPay.Model.SysManage.TaskQueue GetLastModel(int type)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,Type,TaskId,Status,RunDate from SA_TaskQueue ");
            strSql.Append(" where type=" + type + " and Status=1 order by ID desc ");

            ColoPay.Model.SysManage.TaskQueue model = new ColoPay.Model.SysManage.TaskQueue();
            DataSet ds = DBHelper.DefaultDBHelper.Query(strSql.ToString());

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