/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_TaskRelatedItems model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_TaskRelatedItems("); strSql.Append("n_TaskID,s_Type,n_LinkID)"); strSql.Append(" values ("); strSql.Append("@n_TaskID,@s_Type,@n_LinkID)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@n_TaskID", SqlDbType.Int, 4), new SqlParameter("@s_Type", SqlDbType.NVarChar, 1), new SqlParameter("@n_LinkID", SqlDbType.Int, 4) }; parameters[0].Value = model.n_TaskID; parameters[1].Value = model.s_Type; parameters[2].Value = model.n_LinkID; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.T_TaskRelatedItems model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_TaskRelatedItems set "); strSql.Append("s_Type=@s_Type,"); strSql.Append("n_LinkID=@n_LinkID"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@s_Type", SqlDbType.NVarChar, 1), new SqlParameter("@n_LinkID", SqlDbType.Int, 4), new SqlParameter("@n_ID", SqlDbType.Int, 4), new SqlParameter("@n_TaskID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_Type; parameters[1].Value = model.n_LinkID; parameters[2].Value = model.n_ID; parameters[3].Value = model.n_TaskID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_TaskRelatedItems DataRowToModel(DataRow row) { IPSP.Model.T_TaskRelatedItems model = new IPSP.Model.T_TaskRelatedItems(); if (row != null) { if (row["n_ID"] != null && row["n_ID"].ToString() != "") { model.n_ID = int.Parse(row["n_ID"].ToString()); } if (row["n_TaskID"] != null && row["n_TaskID"].ToString() != "") { model.n_TaskID = int.Parse(row["n_TaskID"].ToString()); } if (row["s_Type"] != null) { model.s_Type = row["s_Type"].ToString(); } if (row["n_LinkID"] != null && row["n_LinkID"].ToString() != "") { model.n_LinkID = int.Parse(row["n_LinkID"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_TaskRelatedItems GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,n_TaskID,s_Type,n_LinkID from T_TaskRelatedItems "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.T_TaskRelatedItems model = new IPSP.Model.T_TaskRelatedItems(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.T_TaskRelatedItems model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_TaskRelatedItems model) { return(dal.Add(model)); }