///<summary> /// Galeri Data Select ///</summary> public static GaleriCollection GetSelect(Int64 palbumid) { GaleriCollection rvGaleri = new GaleriCollection(); 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 galeri where albumid=?albumid", conneciton)) { cmd.Parameters.Add("albumid", palbumid, MSqlDbType.BigInt); using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvGaleri.Add(new Galeri(MConvert.NullToGuidString(IDR["id"]), MConvert.NullToInt64(IDR["albumid"]), MConvert.NullToString(IDR["resimurl"]), MConvert.NullToString(IDR["aciklama"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToBool(IDR["kapak"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvGaleri); }
/// <summary> /// Galeri Liste Getir /// </summary> public static GaleriCollection GetList(CommandType cmdType, string sqlQuery, MParameterCollection parameters) { GaleriCollection rvGaleri = new GaleriCollection(); 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()) { rvGaleri.Add(new Galeri(MConvert.NullToGuidString(IDR["id"]), MConvert.NullToInt64(IDR["albumid"]), MConvert.NullToString(IDR["resimurl"]), MConvert.NullToString(IDR["aciklama"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToBool(IDR["kapak"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvGaleri); }