/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TFCode_WorkItemInCodeTaskMap model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TFCode_WorkItemInCodeTaskMap set "); strSql.Append("g_ID=@g_ID,"); strSql.Append("g_CodeTaskGuid=@g_CodeTaskGuid,"); strSql.Append("n_CodeWorkItemID=@n_CodeWorkItemID,"); strSql.Append("s_Description=@s_Description"); strSql.Append(" where "); SqlParameter[] parameters = { new SqlParameter("@g_ID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@g_CodeTaskGuid", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@n_CodeWorkItemID", SqlDbType.Int, 4), new SqlParameter("@s_Description", SqlDbType.NVarChar, 1000) }; parameters[0].Value = model.g_ID; parameters[1].Value = model.g_CodeTaskGuid; parameters[2].Value = model.n_CodeWorkItemID; parameters[3].Value = model.s_Description; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(IPSP.Model.TFCode_WorkItemInCodeTaskMap model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TFCode_WorkItemInCodeTaskMap("); strSql.Append("g_ID,g_CodeTaskGuid,n_CodeWorkItemID,s_Description)"); strSql.Append(" values ("); strSql.Append("@g_ID,@g_CodeTaskGuid,@n_CodeWorkItemID,@s_Description)"); SqlParameter[] parameters = { new SqlParameter("@g_ID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@g_CodeTaskGuid", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@n_CodeWorkItemID", SqlDbType.Int, 4), new SqlParameter("@s_Description", SqlDbType.NVarChar, 1000) }; parameters[0].Value = Guid.NewGuid(); parameters[1].Value = Guid.NewGuid(); parameters[2].Value = model.n_CodeWorkItemID; parameters[3].Value = model.s_Description; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.TFCode_WorkItemInCodeTaskMap GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 g_ID,g_CodeTaskGuid,n_CodeWorkItemID,s_Description from TFCode_WorkItemInCodeTaskMap "); strSql.Append(" where "); SqlParameter[] parameters = { }; IPSP.Model.TFCode_WorkItemInCodeTaskMap model = new IPSP.Model.TFCode_WorkItemInCodeTaskMap(); 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 IPSP.Model.TFCode_WorkItemInCodeTaskMap DataRowToModel(DataRow row) { IPSP.Model.TFCode_WorkItemInCodeTaskMap model = new IPSP.Model.TFCode_WorkItemInCodeTaskMap(); if (row != null) { if (row["g_ID"] != null && row["g_ID"].ToString() != "") { model.g_ID = new Guid(row["g_ID"].ToString()); } if (row["g_CodeTaskGuid"] != null && row["g_CodeTaskGuid"].ToString() != "") { model.g_CodeTaskGuid = new Guid(row["g_CodeTaskGuid"].ToString()); } if (row["n_CodeWorkItemID"] != null && row["n_CodeWorkItemID"].ToString() != "") { model.n_CodeWorkItemID = int.Parse(row["n_CodeWorkItemID"].ToString()); } if (row["s_Description"] != null) { model.s_Description = row["s_Description"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.TFCode_WorkItemInCodeTaskMap model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(IPSP.Model.TFCode_WorkItemInCodeTaskMap model) { return(dal.Add(model)); }