Beispiel #1
0
        ///<summary>
        /// Sayfa Data Select
        ///</summary>
        public static SayfaCollection GetSelect(byte yerlesim, byte limit)
        {
            SayfaCollection rvSayfa = new SayfaCollection();

            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 sayfa where aktif=1 and yerlesim=5 or aktif=1 and yerlesim=?yerlesim limit " + limit, conneciton))
                {
                    cmd.Parameters.Add("yerlesim", yerlesim, MSqlDbType.SmallInt);
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        while (IDR.Read())
                        {
                            rvSayfa.Add(new Sayfa(MConvert.NullToInt16(IDR["id"]), MConvert.NullToGuidString(IDR["hesapid"]), MConvert.NullToString(IDR["baslik"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["dil"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToByte(IDR["yerlesim"]), MConvert.NullToBool(IDR["aktif"])));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvSayfa);
        }
Beispiel #2
0
        public static List <jSonObject> GetSayfalar(byte yerlesim, byte limit)
        {
            List <jSonObject> rv = new List <jSonObject>();

            if (limit > 10)
            {
                return(rv);
            }
            using (SayfaCollection m = SayfaMethods.GetSelect(yerlesim, limit))
            {
                foreach (Sayfa item in m)
                {
                    rv.Add(new jSonObject {
                        Link = Core.CreateLink("sayfa", item.ID, item.Baslik), Baslik = item.Baslik
                    });
                }
            }
            return(rv);
        }
Beispiel #3
0
        /// <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.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())
                        {
                            rvSayfa.Add(new Sayfa(MConvert.NullToInt16(IDR["id"]), MConvert.NullToGuidString(IDR["hesapid"]), MConvert.NullToString(IDR["baslik"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["dil"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToByte(IDR["yerlesim"]), MConvert.NullToBool(IDR["aktif"])));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvSayfa);
        }