///<summary> /// Sayfa Data Select ///</summary> public static SayfaCollection GetSelect(System.Guid pHesapID) { SayfaCollection rvSayfa = new SayfaCollection(); using (MConnection conneciton = new MConnection(MClientProvider.MSSQL)) { switch (conneciton.State) { case System.Data.ConnectionState.Closed: conneciton.Open(); break; } using (MCommand cmd = new MCommand(CommandType.Text, "SELECT * FROM Sayfa WHERE HesapID=@HesapID", conneciton)) { cmd.Parameters.Add("HesapID", pHesapID, MSqlDbType.UniqueIdentifier); using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvSayfa.Add(new Sayfa(MConvert.NullToInt16(IDR["ID"]), MConvert.NullToGuid(IDR["HesapID"]), MConvert.NullToString(IDR["Baslik"]), MConvert.NullToString(IDR["Icerik"]), MConvert.NullToString(IDR["Dil"]), MConvert.NullToDateTime(IDR["KayitTarihi"]), MConvert.NullToByte(IDR["Tipi"]), MConvert.NullToBool(IDR["Aktif"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvSayfa); }
/// <summary> /// Sayfa Liste Getir /// </summary> public static SayfaCollection GetList(CommandType cmdType, string sqlQuery, MParameterCollection parameters) { SayfaCollection rvSayfa = new SayfaCollection(); using (MConnection conneciton = new MConnection(MClientProvider.MSSQL)) { 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()) { rvSayfa.Add(new Sayfa(MConvert.NullToInt16(IDR["ID"]), MConvert.NullToGuid(IDR["HesapID"]), MConvert.NullToString(IDR["Baslik"]), MConvert.NullToString(IDR["Icerik"]), MConvert.NullToString(IDR["Dil"]), MConvert.NullToDateTime(IDR["KayitTarihi"]), MConvert.NullToByte(IDR["Tipi"]), MConvert.NullToBool(IDR["Aktif"]))); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvSayfa); }