public Anket FillAnket(IDataReader reader) { nesne = new Anket(); nesne.Id=(Int32)reader["ID"]; nesne.OrganizasyonId=(Int32)reader["ORGANIZASYON_ID"]; nesne.Aciklama=(String)reader["ACIKLAMA"]; return nesne; }
public int Delete(int id,DbTransaction dbTransaction,Database db) { sqlText="DELETE ANKET where ID=@id "; dbComm = db.GetSqlStringCommand(sqlText); db.AddInParameter(dbComm, "@id", DbType.Int32, id); Anket nesne = new Anket(); nesne.Id = id; return base.Delete(nesne, dbComm, dbTransaction, db); }
public int DeleteByOrganizasyonId(Int32 organizasyonId,DbTransaction dbTransaction,Database db) { sqlText="DELETE ANKET where ORGANIZASYON_ID=@organizasyonId "; dbComm = db.GetSqlStringCommand(sqlText); db.AddInParameter(dbComm, "@organizasyonId", DbType.Int32, organizasyonId); Anket nesne=new Anket(); nesne.Id=-1; nesne.OrganizasyonId=organizasyonId; return base.Delete(nesne, dbComm, dbTransaction, db); }
public int Update(Anket nesne,DbTransaction dbTransaction,Database db) { sqlText=" UPDATE ANKET set ORGANIZASYON_ID = @organizasyonId , ACIKLAMA = @aciklama WHERE ID = @id "; dbComm = db.GetSqlStringCommand(sqlText); db.AddInParameter(dbComm, "@id", DbType.Int32, nesne.Id==null?(object)DBNull.Value:nesne.Id); db.AddInParameter(dbComm, "@organizasyonId", DbType.Int32, nesne.OrganizasyonId==null?(object)DBNull.Value:nesne.OrganizasyonId); db.AddInParameter(dbComm, "@aciklama", DbType.String, nesne.Aciklama==null?(object)DBNull.Value:nesne.Aciklama); return base.Update(nesne, dbComm, dbTransaction, db); }
public int Insert(Anket nesne,DbTransaction dbTransaction,Database db) { sqlText="INSERT INTO ANKET (ORGANIZASYON_ID,ACIKLAMA)VALUES(@organizasyonId,@aciklama)SELECT @@IDENTITY"; dbComm = db.GetSqlStringCommand(sqlText); db.AddInParameter(dbComm, "@organizasyonId", DbType.Int32, nesne.OrganizasyonId==null?(object)DBNull.Value:nesne.OrganizasyonId); db.AddInParameter(dbComm, "@aciklama", DbType.String, nesne.Aciklama==null?(object)DBNull.Value:nesne.Aciklama); return base.Insert(nesne, dbComm, dbTransaction, db); }
public Anket GetById(int id,Database db) { nesne = new Anket(); sqlText="Select ID,ORGANIZASYON_ID,ACIKLAMA from ANKET where ID=@id "; dbComm = db.GetSqlStringCommand(sqlText); db.AddInParameter(dbComm, "@id", DbType.Int32, id); using (IDataReader reader = db.ExecuteReader(dbComm)){ if(reader.Read()){ nesne = FillAnket(reader); }else nesne=null; } return nesne; }