/// <summary> /// 得到一个对象实体 /// </summary> public DTcms.Model.CurriculumCRelationshipStyle GetModel(int CurriculumCRelationshipStyleId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select CurriculumCRelationshipStyleId, StartDate, EndDate, Remark, SourceCurricularStyleCurriculumId, TargetCurricularStyleCurriculumId, CRelationshipStyleId, DeleteMark, Enable "); strSql.Append(" from " + databaseprefix + "CurriculumCRelationshipStyle "); strSql.Append(" where CurriculumCRelationshipStyleId=@CurriculumCRelationshipStyleId"); SqlParameter[] parameters = { new SqlParameter("@CurriculumCRelationshipStyleId", SqlDbType.Int, 4) }; parameters[0].Value = CurriculumCRelationshipStyleId; DTcms.Model.CurriculumCRelationshipStyle model = new DTcms.Model.CurriculumCRelationshipStyle(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["CurriculumCRelationshipStyleId"].ToString() != "") { model.CurriculumCRelationshipStyleId = int.Parse(ds.Tables[0].Rows[0]["CurriculumCRelationshipStyleId"].ToString()); } if (ds.Tables[0].Rows[0]["StartDate"].ToString() != "") { model.StartDate = DateTime.Parse(ds.Tables[0].Rows[0]["StartDate"].ToString()); } if (ds.Tables[0].Rows[0]["EndDate"].ToString() != "") { model.EndDate = DateTime.Parse(ds.Tables[0].Rows[0]["EndDate"].ToString()); } model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString(); if (ds.Tables[0].Rows[0]["SourceCurricularStyleCurriculumId"].ToString() != "") { model.SourceCurricularStyleCurriculumId = int.Parse(ds.Tables[0].Rows[0]["SourceCurricularStyleCurriculumId"].ToString()); } if (ds.Tables[0].Rows[0]["TargetCurricularStyleCurriculumId"].ToString() != "") { model.TargetCurricularStyleCurriculumId = int.Parse(ds.Tables[0].Rows[0]["TargetCurricularStyleCurriculumId"].ToString()); } if (ds.Tables[0].Rows[0]["CRelationshipStyleId"].ToString() != "") { model.CRelationshipStyleId = int.Parse(ds.Tables[0].Rows[0]["CRelationshipStyleId"].ToString()); } if (ds.Tables[0].Rows[0]["DeleteMark"].ToString() != "") { model.DeleteMark = int.Parse(ds.Tables[0].Rows[0]["DeleteMark"].ToString()); } if (ds.Tables[0].Rows[0]["Enable"].ToString() != "") { model.Enable = int.Parse(ds.Tables[0].Rows[0]["Enable"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 获得数据列表 /// </summary> public List <DTcms.Model.CurriculumCRelationshipStyle> DataTableToList(DataTable dt) { List <DTcms.Model.CurriculumCRelationshipStyle> modelList = new List <DTcms.Model.CurriculumCRelationshipStyle>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { DTcms.Model.CurriculumCRelationshipStyle model; for (int n = 0; n < rowsCount; n++) { model = new DTcms.Model.CurriculumCRelationshipStyle(); if (dt.Rows[n]["CurriculumCRelationshipStyleId"].ToString() != "") { model.CurriculumCRelationshipStyleId = int.Parse(dt.Rows[n]["CurriculumCRelationshipStyleId"].ToString()); } if (dt.Rows[n]["StartDate"].ToString() != "") { model.StartDate = DateTime.Parse(dt.Rows[n]["StartDate"].ToString()); } if (dt.Rows[n]["EndDate"].ToString() != "") { model.EndDate = DateTime.Parse(dt.Rows[n]["EndDate"].ToString()); } model.Remark = dt.Rows[n]["Remark"].ToString(); if (dt.Rows[n]["SourceCurricularStyleCurriculumId"].ToString() != "") { model.SourceCurricularStyleCurriculumId = int.Parse(dt.Rows[n]["SourceCurricularStyleCurriculumId"].ToString()); } if (dt.Rows[n]["TargetCurricularStyleCurriculumId"].ToString() != "") { model.TargetCurricularStyleCurriculumId = int.Parse(dt.Rows[n]["TargetCurricularStyleCurriculumId"].ToString()); } if (dt.Rows[n]["CRelationshipStyleId"].ToString() != "") { model.CRelationshipStyleId = int.Parse(dt.Rows[n]["CRelationshipStyleId"].ToString()); } if (dt.Rows[n]["DeleteMark"].ToString() != "") { model.DeleteMark = int.Parse(dt.Rows[n]["DeleteMark"].ToString()); } if (dt.Rows[n]["Enable"].ToString() != "") { model.Enable = int.Parse(dt.Rows[n]["Enable"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DTcms.Model.CurriculumCRelationshipStyle model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update " + databaseprefix + "CurriculumCRelationshipStyle set "); strSql.Append(" StartDate = @StartDate , "); strSql.Append(" EndDate = @EndDate , "); strSql.Append(" Remark = @Remark , "); strSql.Append(" SourceCurricularStyleCurriculumId = @SourceCurricularStyleCurriculumId , "); strSql.Append(" TargetCurricularStyleCurriculumId = @TargetCurricularStyleCurriculumId , "); strSql.Append(" CRelationshipStyleId = @CRelationshipStyleId , "); strSql.Append(" DeleteMark = @DeleteMark , "); strSql.Append(" Enable = @Enable "); strSql.Append(" where CurriculumCRelationshipStyleId=@CurriculumCRelationshipStyleId "); SqlParameter[] parameters = { new SqlParameter("@CurriculumCRelationshipStyleId", SqlDbType.Int, 4), new SqlParameter("@StartDate", SqlDbType.DateTime), new SqlParameter("@EndDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.VarChar, 200), new SqlParameter("@SourceCurricularStyleCurriculumId", SqlDbType.Int, 4), new SqlParameter("@TargetCurricularStyleCurriculumId", SqlDbType.Int, 4), new SqlParameter("@CRelationshipStyleId", SqlDbType.Int, 4), new SqlParameter("@DeleteMark", SqlDbType.Int, 4), new SqlParameter("@Enable", SqlDbType.Int, 4) }; parameters[0].Value = model.CurriculumCRelationshipStyleId; parameters[1].Value = model.StartDate; parameters[2].Value = model.EndDate; parameters[3].Value = model.Remark; parameters[4].Value = model.SourceCurricularStyleCurriculumId; parameters[5].Value = model.TargetCurricularStyleCurriculumId; parameters[6].Value = model.CRelationshipStyleId; parameters[7].Value = model.DeleteMark; parameters[8].Value = model.Enable; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DTcms.Model.CurriculumCRelationshipStyle model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into " + databaseprefix + "CurriculumCRelationshipStyle("); strSql.Append("StartDate,EndDate,Remark,SourceCurricularStyleCurriculumId,TargetCurricularStyleCurriculumId,CRelationshipStyleId,DeleteMark,Enable"); strSql.Append(") values ("); strSql.Append("@StartDate,@EndDate,@Remark,@SourceCurricularStyleCurriculumId,@TargetCurricularStyleCurriculumId,@CRelationshipStyleId,@DeleteMark,@Enable"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@StartDate", SqlDbType.DateTime), new SqlParameter("@EndDate", SqlDbType.DateTime), new SqlParameter("@Remark", SqlDbType.VarChar, 200), new SqlParameter("@SourceCurricularStyleCurriculumId", SqlDbType.Int, 4), new SqlParameter("@TargetCurricularStyleCurriculumId", SqlDbType.Int, 4), new SqlParameter("@CRelationshipStyleId", SqlDbType.Int, 4), new SqlParameter("@DeleteMark", SqlDbType.Int, 4), new SqlParameter("@Enable", SqlDbType.Int, 4) }; parameters[0].Value = model.StartDate; parameters[1].Value = model.EndDate; parameters[2].Value = model.Remark; parameters[3].Value = model.SourceCurricularStyleCurriculumId; parameters[4].Value = model.TargetCurricularStyleCurriculumId; parameters[5].Value = model.CRelationshipStyleId; parameters[6].Value = model.DeleteMark; parameters[7].Value = model.Enable; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DTcms.Model.CurriculumCRelationshipStyle model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DTcms.Model.CurriculumCRelationshipStyle model) { return(dal.Add(model)); }