示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ManageTaskModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ManageTask set ");
            strSql.Append("TaskStatus=@TaskStatus,");
            strSql.Append("TaskTypeName=@TaskTypeName,");
            strSql.Append("TaskType=@TaskType,");
            strSql.Append("TaskCode=@TaskCode,");
            strSql.Append("TaskStartArea=@TaskStartArea,");
            strSql.Append("TaskStartPostion=@TaskStartPostion,");
            strSql.Append("TaskEndArea=@TaskEndArea,");
            strSql.Append("TaskEndPostion=@TaskEndPostion,");
            strSql.Append("TaskCreatePerson=@TaskCreatePerson,");
            strSql.Append("TaskCreateTime=@TaskCreateTime,");
            strSql.Append("TaskCompleteTime=@TaskCompleteTime,");
            strSql.Append("TaskParameter=@TaskParameter");
            strSql.Append(" where TaskID=@TaskID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskStatus",       SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskTypeName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskType",         SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskCode",         SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskStartArea",    SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskStartPostion", SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskEndArea",      SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskEndPostion",   SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskCreatePerson", SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskCreateTime",   SqlDbType.DateTime),
                new SqlParameter("@TaskCompleteTime", SqlDbType.DateTime),
                new SqlParameter("@TaskParameter",    SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskID",           SqlDbType.BigInt, 8)
            };
            parameters[0].Value  = model.TaskStatus;
            parameters[1].Value  = model.TaskTypeName;
            parameters[2].Value  = model.TaskType;
            parameters[3].Value  = model.TaskCode;
            parameters[4].Value  = model.TaskStartArea;
            parameters[5].Value  = model.TaskStartPostion;
            parameters[6].Value  = model.TaskEndArea;
            parameters[7].Value  = model.TaskEndPostion;
            parameters[8].Value  = model.TaskCreatePerson;
            parameters[9].Value  = model.TaskCreateTime;
            parameters[10].Value = model.TaskCompleteTime;
            parameters[11].Value = model.TaskParameter;
            parameters[12].Value = model.TaskID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(ManageTaskModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ManageTask(");
            strSql.Append("TaskStatus,TaskTypeName,TaskType,TaskCode,TaskStartArea,TaskStartPostion,TaskEndArea,TaskEndPostion,TaskCreatePerson,TaskCreateTime,TaskCompleteTime,TaskParameter)");
            strSql.Append(" values (");
            strSql.Append("@TaskStatus,@TaskTypeName,@TaskType,@TaskCode,@TaskStartArea,@TaskStartPostion,@TaskEndArea,@TaskEndPostion,@TaskCreatePerson,@TaskCreateTime,@TaskCompleteTime,@TaskParameter)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskStatus",       SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskTypeName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskType",         SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskCode",         SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskStartArea",    SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskStartPostion", SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskEndArea",      SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskEndPostion",   SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskCreatePerson", SqlDbType.NVarChar,  50),
                new SqlParameter("@TaskCreateTime",   SqlDbType.DateTime),
                new SqlParameter("@TaskCompleteTime", SqlDbType.DateTime),
                new SqlParameter("@TaskParameter",    SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.TaskStatus;
            parameters[1].Value  = model.TaskTypeName;
            parameters[2].Value  = model.TaskType;
            parameters[3].Value  = model.TaskCode;
            parameters[4].Value  = model.TaskStartArea;
            parameters[5].Value  = model.TaskStartPostion;
            parameters[6].Value  = model.TaskEndArea;
            parameters[7].Value  = model.TaskEndPostion;
            parameters[8].Value  = model.TaskCreatePerson;
            parameters[9].Value  = model.TaskCreateTime;
            parameters[10].Value = model.TaskCompleteTime;
            parameters[11].Value = model.TaskParameter;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
示例#3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ManageTaskModel GetModel(long TaskID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 TaskID,TaskStatus,TaskTypeName,TaskType,TaskCode,TaskStartArea,TaskStartPostion,TaskEndArea,TaskEndPostion,TaskCreatePerson,TaskCreateTime,TaskCompleteTime,TaskParameter from ManageTask ");
            strSql.Append(" where TaskID=@TaskID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskID", SqlDbType.BigInt)
            };
            parameters[0].Value = TaskID;

            ManageTaskModel model = new ManageTaskModel();
            DataSet         ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ManageTaskModel model)
 {
     return(dal.Update(model));
 }
示例#5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(ManageTaskModel model)
 {
     return(dal.Add(model));
 }
示例#6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ManageTaskModel DataRowToModel(DataRow row)
        {
            ManageTaskModel model = new ManageTaskModel();

            if (row != null)
            {
                if (row["TaskID"] != null && row["TaskID"].ToString() != "")
                {
                    model.TaskID = long.Parse(row["TaskID"].ToString());
                }
                if (row["TaskStatus"] != null)
                {
                    model.TaskStatus = row["TaskStatus"].ToString();
                }
                if (row["TaskTypeName"] != null)
                {
                    model.TaskTypeName = row["TaskTypeName"].ToString();
                }
                if (row["TaskType"] != null)
                {
                    model.TaskType = row["TaskType"].ToString();
                }
                if (row["TaskCode"] != null)
                {
                    model.TaskCode = row["TaskCode"].ToString();
                }
                if (row["TaskStartArea"] != null)
                {
                    model.TaskStartArea = row["TaskStartArea"].ToString();
                }
                if (row["TaskStartPostion"] != null)
                {
                    model.TaskStartPostion = row["TaskStartPostion"].ToString();
                }
                if (row["TaskEndArea"] != null)
                {
                    model.TaskEndArea = row["TaskEndArea"].ToString();
                }
                if (row["TaskEndPostion"] != null)
                {
                    model.TaskEndPostion = row["TaskEndPostion"].ToString();
                }
                if (row["TaskCreatePerson"] != null)
                {
                    model.TaskCreatePerson = row["TaskCreatePerson"].ToString();
                }
                if (row["TaskCreateTime"] != null && row["TaskCreateTime"].ToString() != "")
                {
                    model.TaskCreateTime = DateTime.Parse(row["TaskCreateTime"].ToString());
                }
                if (row["TaskCompleteTime"] != null && row["TaskCompleteTime"].ToString() != "")
                {
                    model.TaskCompleteTime = DateTime.Parse(row["TaskCompleteTime"].ToString());
                }
                if (row["TaskParameter"] != null)
                {
                    model.TaskParameter = row["TaskParameter"].ToString();
                }
            }
            return(model);
        }