public List <ozellik> ozellikGetirTum() { List <ozellik> ozellikler = new List <ozellik>(); try { SqlCommand com = new SqlCommand("select o.OzellikId, o.OzellikTipId,OzellikAd,OzellikTipAd from Ozellik o , OzellikTip ozt where o.OzellikTipId = ozt.OzellikTipId order by OzellikTipId", con); com.CommandType = CommandType.Text; con.Open(); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { ozellik o = new ozellik(); o.OzellikAd = dr["OzellikAd"].ToString(); o.OzellikId = Convert.ToInt32(dr["OzellikId"]); o.OzellikTipId = Convert.ToInt32(dr["OzellikTipId"]); o.OzellikTipAd = dr["OzellikTipAd"].ToString(); ozellikler.Add(o); } dr.Close(); } catch (Exception ex) { } finally { con.Close(); } return(ozellikler); }
public ozellik ozellikGetirId(int ozellikId) { ozellik o = new ozellik(); try { SqlCommand com = new SqlCommand("select o.OzellikId, o.OzellikTipId,OzellikAd,OzellikTipAd from Ozellik o , OzellikTip ozt where o.OzellikTipId = ozt.OzellikTipId and OzellikId = @ozlId", con); com.Parameters.AddWithValue("@ozlId", ozellikId); com.CommandType = CommandType.Text; con.Open(); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { o.OzellikAd = dr["OzellikAd"].ToString(); o.OzellikId = Convert.ToInt32(dr["OzellikId"]); o.OzellikTipId = Convert.ToInt32(dr["OzellikTipId"]); o.OzellikTipAd = dr["OzellikTipAd"].ToString(); } dr.Close(); } catch (Exception ex) { } finally { con.Close(); } return(o); }
public List <ozellik> emlakOzellikGetirId(int emlakId) { List <ozellik> ozellikler = new List <ozellik>(); try { SqlCommand com = new SqlCommand("select OzellikAd, O.OzellikId from Ozellik o , EmlakOzellik eo where o.OzellikId = eo.OzellikId and EmlakId = @emlakId", con); com.CommandType = CommandType.Text; com.Parameters.AddWithValue("@emlakId", emlakId); con.Open(); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { ozellik o = new ozellik(); o.OzellikAd = dr["OzellikAd"].ToString(); o.OzellikId = Convert.ToInt32(dr["OzellikId"]); ozellikler.Add(o); } dr.Close(); } catch (Exception ex) { } finally { con.Close(); } return(ozellikler); }