Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.tTaskSave model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tTaskSave set ");
            strSql.Append("TaskId=@TaskId,");
            strSql.Append("SavaDpt=@SavaDpt,");
            strSql.Append("SaveContent=@SaveContent,");
            strSql.Append("SaveTime=@SaveTime,");
            strSql.Append("SavePeo=@SavePeo,");
            strSql.Append("isCheck=@isCheck,");
            strSql.Append("isCheckPeo=@isCheckPeo,");
            strSql.Append("isCheckTime=@isCheckTime");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskId",      SqlDbType.Int,        4),
                new SqlParameter("@SavaDpt",     SqlDbType.Int,        4),
                new SqlParameter("@SaveContent", SqlDbType.VarChar,   -1),
                new SqlParameter("@SaveTime",    SqlDbType.DateTime),
                new SqlParameter("@SavePeo",     SqlDbType.VarChar,   50),
                new SqlParameter("@isCheck",     SqlDbType.VarChar,   50),
                new SqlParameter("@isCheckPeo",  SqlDbType.VarChar,   50),
                new SqlParameter("@isCheckTime", SqlDbType.DateTime),
                new SqlParameter("@Id",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.TaskId;
            parameters[1].Value = model.SavaDpt;
            parameters[2].Value = model.SaveContent;
            parameters[3].Value = model.SaveTime;
            parameters[4].Value = model.SavePeo;
            parameters[5].Value = model.isCheck;
            parameters[6].Value = model.isCheckPeo;
            parameters[7].Value = model.isCheckTime;
            parameters[8].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.tTaskSave DataRowToModel(DataRow row)
 {
     Maticsoft.Model.tTaskSave model = new Maticsoft.Model.tTaskSave();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["TaskId"] != null && row["TaskId"].ToString() != "")
         {
             model.TaskId = int.Parse(row["TaskId"].ToString());
         }
         if (row["SavaDpt"] != null && row["SavaDpt"].ToString() != "")
         {
             model.SavaDpt = int.Parse(row["SavaDpt"].ToString());
         }
         if (row["SaveContent"] != null)
         {
             model.SaveContent = row["SaveContent"].ToString();
         }
         if (row["SaveTime"] != null && row["SaveTime"].ToString() != "")
         {
             model.SaveTime = DateTime.Parse(row["SaveTime"].ToString());
         }
         if (row["SavePeo"] != null)
         {
             model.SavePeo = row["SavePeo"].ToString();
         }
         if (row["isCheck"] != null)
         {
             model.isCheck = row["isCheck"].ToString();
         }
         if (row["isCheckPeo"] != null)
         {
             model.isCheckPeo = row["isCheckPeo"].ToString();
         }
         if (row["isCheckTime"] != null && row["isCheckTime"].ToString() != "")
         {
             model.isCheckTime = DateTime.Parse(row["isCheckTime"].ToString());
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.tTaskSave model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tTaskSave(");
            strSql.Append("TaskId,SavaDpt,SaveContent,SaveTime,SavePeo,isCheck,isCheckPeo,isCheckTime)");
            strSql.Append(" values (");
            strSql.Append("@TaskId,@SavaDpt,@SaveContent,@SaveTime,@SavePeo,@isCheck,@isCheckPeo,@isCheckTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskId",      SqlDbType.Int,        4),
                new SqlParameter("@SavaDpt",     SqlDbType.Int,        4),
                new SqlParameter("@SaveContent", SqlDbType.VarChar,   -1),
                new SqlParameter("@SaveTime",    SqlDbType.DateTime),
                new SqlParameter("@SavePeo",     SqlDbType.VarChar,   50),
                new SqlParameter("@isCheck",     SqlDbType.VarChar,   50),
                new SqlParameter("@isCheckPeo",  SqlDbType.VarChar,   50),
                new SqlParameter("@isCheckTime", SqlDbType.DateTime)
            };
            parameters[0].Value = model.TaskId;
            parameters[1].Value = model.SavaDpt;
            parameters[2].Value = model.SaveContent;
            parameters[3].Value = model.SaveTime;
            parameters[4].Value = model.SavePeo;
            parameters[5].Value = model.isCheck;
            parameters[6].Value = model.isCheckPeo;
            parameters[7].Value = model.isCheckTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.tTaskSave GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,TaskId,SavaDpt,SaveContent,SaveTime,SavePeo,isCheck,isCheckPeo,isCheckTime from tTaskSave ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

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