/// <summary> /// 增加一条数据 /// </summary> public void Add(CardCenter.Entity.Para_JobNeedFileType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Para_JobNeedFileType("); strSql.Append("JobType,FileType)"); strSql.Append(" values ("); strSql.Append("@JobType,@FileType)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@JobType", SqlDbType.NVarChar, 8), new SqlParameter("@FileType", SqlDbType.NVarChar, 8) }; parameters[0].Value = model.JobType; parameters[1].Value = model.FileType; TranHelper.AddTran(strSql, parameters); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(CardCenter.Entity.Para_JobNeedFileType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Para_JobNeedFileType set "); strSql.Append("JobType=@JobType,"); strSql.Append("FileType=@FileType"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@JobType", SqlDbType.NVarChar, 8), new SqlParameter("@FileType", SqlDbType.NVarChar, 8), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.JobType; parameters[1].Value = model.FileType; parameters[2].Value = model.ID; TranHelper.AddTran(strSql, parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public CardCenter.Entity.Para_JobNeedFileType DataRowToModel(DataRow row) { CardCenter.Entity.Para_JobNeedFileType model = new CardCenter.Entity.Para_JobNeedFileType(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["JobType"] != null) { model.JobType = row["JobType"].ToString(); } if (row["FileType"] != null) { model.FileType = row["FileType"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public CardCenter.Entity.Para_JobNeedFileType GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,JobType,FileType from Para_JobNeedFileType "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; CardCenter.Entity.Para_JobNeedFileType model = new CardCenter.Entity.Para_JobNeedFileType(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }