///<summary> /// Makale Data Select ///</summary> public static MakaleCollection GetSelect(string phesapid, int top) { MakaleCollection rvMakale = new MakaleCollection(); using (MConnection conneciton = new MConnection(MClientProvider.MySQL)) { switch (conneciton.State) { case System.Data.ConnectionState.Closed: conneciton.Open(); break; } using (MCommand cmd = new MCommand(CommandType.Text, "select * from makale where hesapid=?hesapid and yoneticionay=1 and aktif=1 order by guncellemetarihi desc limit " + top, conneciton)) { cmd.Parameters.Add("hesapid", phesapid, MSqlDbType.VarChar); using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvMakale.Add(new Makale(MConvert.NullToInt64(IDR["id"]), MConvert.NullToGuidString(IDR["hesapid"]), MConvert.NullToString(IDR["kategoriid"]), MConvert.NullToString(IDR["resimurl"]), MConvert.NullToString(IDR["baslik"]), MConvert.NullToString(IDR["ozet"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["etiket"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToDateTime(IDR["guncellemetarihi"]), MConvert.NullToBool(IDR["gosterimsayi"]), MConvert.NullToBool(IDR["uye"]), MConvert.NullToBool(IDR["yorum"]), MConvert.NullToBool(IDR["yoneticionay"]), MConvert.NullToBool(IDR["aktif"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvMakale); }
/// <summary> /// Makale Liste Getir /// </summary> public static MakaleCollection GetList(CommandType cmdType, string sqlQuery, MParameterCollection parameters) { MakaleCollection rvMakale = new MakaleCollection(); using (MConnection conneciton = new MConnection(MClientProvider.MySQL)) { switch (conneciton.State) { case System.Data.ConnectionState.Closed: conneciton.Open(); break; } using (MCommand cmd = new MCommand(cmdType, sqlQuery, conneciton)) { if (parameters != null) { foreach (MParameter item in parameters) { cmd.Parameters.Add(item); } } using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvMakale.Add(new Makale(MConvert.NullToInt64(IDR["id"]), MConvert.NullToGuidString(IDR["hesapid"]), MConvert.NullToString(IDR["kategoriid"]), MConvert.NullToString(IDR["resimurl"]), MConvert.NullToString(IDR["baslik"]), MConvert.NullToString(IDR["ozet"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["etiket"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToDateTime(IDR["guncellemetarihi"]), MConvert.NullToBool(IDR["gosterimsayi"]), MConvert.NullToBool(IDR["uye"]), MConvert.NullToBool(IDR["yorum"]), MConvert.NullToBool(IDR["yoneticionay"]), MConvert.NullToBool(IDR["aktif"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvMakale); }