/// <summary> /// 增加一条数据 /// </summary> public bool Add(KryptonAccessController.AccessDataBase.Model.EventCodeInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into EventCodeInfo("); strSql.Append("EventCodeID,EventCodeType,EventCodeName,EventCodePictureID,EventUpLoadPriority)"); strSql.Append(" values ("); strSql.Append("@EventCodeID,@EventCodeType,@EventCodeName,@EventCodePictureID,@EventUpLoadPriority)"); SqlParameter[] parameters = { new SqlParameter("@EventCodeID", SqlDbType.Int, 4), new SqlParameter("@EventCodeType", SqlDbType.Int, 4), new SqlParameter("@EventCodeName", SqlDbType.NVarChar, 50), new SqlParameter("@EventCodePictureID", SqlDbType.Int, 4), new SqlParameter("@EventUpLoadPriority", SqlDbType.Int, 4) }; parameters[0].Value = model.EventCodeID; parameters[1].Value = model.EventCodeType; parameters[2].Value = model.EventCodeName; parameters[3].Value = model.EventCodePictureID; parameters[4].Value = model.EventUpLoadPriority; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.EventCodeInfo DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.EventCodeInfo model = new KryptonAccessController.AccessDataBase.Model.EventCodeInfo(); if (row != null) { if (row["EventCodeID"] != null && row["EventCodeID"].ToString() != "") { model.EventCodeID = int.Parse(row["EventCodeID"].ToString()); } if (row["EventCodeType"] != null && row["EventCodeType"].ToString() != "") { model.EventCodeType = int.Parse(row["EventCodeType"].ToString()); } if (row["EventCodeName"] != null) { model.EventCodeName = row["EventCodeName"].ToString(); } if (row["EventCodePictureID"] != null && row["EventCodePictureID"].ToString() != "") { model.EventCodePictureID = int.Parse(row["EventCodePictureID"].ToString()); } if (row["EventUpLoadPriority"] != null && row["EventUpLoadPriority"].ToString() != "") { model.EventUpLoadPriority = int.Parse(row["EventUpLoadPriority"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.EventCodeInfo GetModel(int EventCodeID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 EventCodeID,EventCodeType,EventCodeName,EventCodePictureID,EventUpLoadPriority from EventCodeInfo "); strSql.Append(" where EventCodeID=@EventCodeID "); SqlParameter[] parameters = { new SqlParameter("@EventCodeID", SqlDbType.Int, 4) }; parameters[0].Value = EventCodeID; KryptonAccessController.AccessDataBase.Model.EventCodeInfo model = new KryptonAccessController.AccessDataBase.Model.EventCodeInfo(); 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 KryptonAccessController.AccessDataBase.Model.EventCodeInfo DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.EventCodeInfo model=new KryptonAccessController.AccessDataBase.Model.EventCodeInfo(); if (row != null) { if(row["EventCodeID"]!=null && row["EventCodeID"].ToString()!="") { model.EventCodeID=int.Parse(row["EventCodeID"].ToString()); } if(row["EventCodeType"]!=null && row["EventCodeType"].ToString()!="") { model.EventCodeType=int.Parse(row["EventCodeType"].ToString()); } if(row["EventCodeName"]!=null) { model.EventCodeName=row["EventCodeName"].ToString(); } if(row["EventCodePictureID"]!=null && row["EventCodePictureID"].ToString()!="") { model.EventCodePictureID=int.Parse(row["EventCodePictureID"].ToString()); } if(row["EventUpLoadPriority"]!=null && row["EventUpLoadPriority"].ToString()!="") { model.EventUpLoadPriority=int.Parse(row["EventUpLoadPriority"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.EventCodeInfo GetModel(int EventCodeID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 EventCodeID,EventCodeType,EventCodeName,EventCodePictureID,EventUpLoadPriority from EventCodeInfo "); strSql.Append(" where EventCodeID=@EventCodeID "); SqlParameter[] parameters = { new SqlParameter("@EventCodeID", SqlDbType.Int,4) }; parameters[0].Value = EventCodeID; KryptonAccessController.AccessDataBase.Model.EventCodeInfo model=new KryptonAccessController.AccessDataBase.Model.EventCodeInfo(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }