/// <summary> /// 更新一条数据 /// </summary> public bool Update(ECAMSDataAccess.ManageTaskDetailModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ManageTaskDetail set "); strSql.Append("TaskDetailListID=@TaskDetailListID,"); strSql.Append("CoreCode=@CoreCode,"); strSql.Append("Remark=@Remark"); strSql.Append(" where TaskDetailID=@TaskDetailID "); SqlParameter[] parameters = { new SqlParameter("@TaskDetailListID", SqlDbType.BigInt, 8), new SqlParameter("@CoreCode", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.VarBinary, 100), new SqlParameter("@TaskDetailID", SqlDbType.BigInt, 8) }; parameters[0].Value = model.TaskDetailListID; parameters[1].Value = model.CoreCode; parameters[2].Value = model.Remark; parameters[3].Value = model.TaskDetailID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(ECAMSDataAccess.ManageTaskDetailModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into ManageTaskDetail("); strSql.Append("TaskDetailID,TaskDetailListID,CoreCode,Remark)"); strSql.Append(" values ("); strSql.Append("@TaskDetailID,@TaskDetailListID,@CoreCode,@Remark)"); SqlParameter[] parameters = { new SqlParameter("@TaskDetailID", SqlDbType.BigInt, 8), new SqlParameter("@TaskDetailListID", SqlDbType.BigInt, 8), new SqlParameter("@CoreCode", SqlDbType.NVarChar, 50), new SqlParameter("@Remark", SqlDbType.VarBinary, 100) }; parameters[0].Value = model.TaskDetailID; parameters[1].Value = model.TaskDetailListID; parameters[2].Value = model.CoreCode; parameters[3].Value = model.Remark; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ECAMSDataAccess.ManageTaskDetailModel DataRowToModel(DataRow row) { ECAMSDataAccess.ManageTaskDetailModel model = new ECAMSDataAccess.ManageTaskDetailModel(); if (row != null) { if (row["TaskDetailID"] != null && row["TaskDetailID"].ToString() != "") { model.TaskDetailID = long.Parse(row["TaskDetailID"].ToString()); } if (row["TaskDetailListID"] != null && row["TaskDetailListID"].ToString() != "") { model.TaskDetailListID = long.Parse(row["TaskDetailListID"].ToString()); } if (row["CoreCode"] != null) { model.CoreCode = row["CoreCode"].ToString(); } if (row["Remark"] != null && row["Remark"].ToString() != "") { model.Remark = (byte[])row["Remark"]; } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public ECAMSDataAccess.ManageTaskDetailModel GetModel(long TaskDetailID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 TaskDetailID,TaskDetailListID,CoreCode,Remark from ManageTaskDetail "); strSql.Append(" where TaskDetailID=@TaskDetailID "); SqlParameter[] parameters = { new SqlParameter("@TaskDetailID", SqlDbType.BigInt, 8) }; parameters[0].Value = TaskDetailID; ECAMSDataAccess.ManageTaskDetailModel model = new ECAMSDataAccess.ManageTaskDetailModel(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }