/// <summary> /// 更新一条数据 /// </summary> public bool Update(VipSoft.Model.XExtensionValue model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update XExtensionValue set "); strSql.Append("ParentID=@ParentID,"); strSql.Append("RecordID=@RecordID,"); strSql.Append("ExtValue0=@ExtValue0"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ParentID", SqlDbType.Int, 4), new SqlParameter("@RecordID", SqlDbType.Int, 4), new SqlParameter("@ExtValue0", SqlDbType.VarChar, 255), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.ParentID; parameters[1].Value = model.RecordID; parameters[2].Value = model.ExtValue0; parameters[3].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(VipSoft.Model.XExtensionValue model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into XExtensionValue("); strSql.Append("ParentID,RecordID,ExtValue0)"); strSql.Append(" values ("); strSql.Append("@ParentID,@RecordID,@ExtValue0)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@ParentID", SqlDbType.Int, 4), new SqlParameter("@RecordID", SqlDbType.Int, 4), new SqlParameter("@ExtValue0", SqlDbType.VarChar, 255) }; parameters[0].Value = model.ParentID; parameters[1].Value = model.RecordID; parameters[2].Value = model.ExtValue0; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public VipSoft.Model.XExtensionValue DataRowToModel(DataRow row) { VipSoft.Model.XExtensionValue model = new VipSoft.Model.XExtensionValue(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["ParentID"] != null && row["ParentID"].ToString() != "") { model.ParentID = int.Parse(row["ParentID"].ToString()); } if (row["RecordID"] != null && row["RecordID"].ToString() != "") { model.RecordID = int.Parse(row["RecordID"].ToString()); } if (row["ExtValue0"] != null) { model.ExtValue0 = row["ExtValue0"].ToString(); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public VipSoft.Model.XExtensionValue GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,ParentID,RecordID,ExtValue0 from XExtensionValue "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; VipSoft.Model.XExtensionValue model = new VipSoft.Model.XExtensionValue(); 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 VipSoft.Model.XExtensionValue DataRowToModel(DataRow row) { VipSoft.Model.XExtensionValue model=new VipSoft.Model.XExtensionValue(); if (row != null) { if(row["ID"]!=null && row["ID"].ToString()!="") { model.ID=int.Parse(row["ID"].ToString()); } if(row["ParentID"]!=null && row["ParentID"].ToString()!="") { model.ParentID=int.Parse(row["ParentID"].ToString()); } if(row["RecordID"]!=null && row["RecordID"].ToString()!="") { model.RecordID=int.Parse(row["RecordID"].ToString()); } if(row["ExtValue0"]!=null) { model.ExtValue0=row["ExtValue0"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public VipSoft.Model.XExtensionValue GetModel(int ID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ID,ParentID,RecordID,ExtValue0 from XExtensionValue "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int,4) }; parameters[0].Value = ID; VipSoft.Model.XExtensionValue model=new VipSoft.Model.XExtensionValue(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }