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