Example #1
0
        ///<summary>
        /// ResmiIlan Data Select
        ///</summary>
        public static ResmiIlanCollection GetSelect()
        {
            ResmiIlanCollection rvResmiIlan = new ResmiIlanCollection();

            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 resmiilan", conneciton))
                {
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        while (IDR.Read())
                        {
                            rvResmiIlan.Add(new ResmiIlan(MConvert.NullToInt64(IDR["id"]), MConvert.NullToString(IDR["baslik"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["sehir"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToBool(IDR["aktif"])));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvResmiIlan);
        }
Example #2
0
        /// <summary>
        /// ResmiIlan Liste Getir
        /// </summary>
        public static ResmiIlanCollection GetList(CommandType cmdType, string sqlQuery, MParameterCollection parameters)
        {
            ResmiIlanCollection rvResmiIlan = new ResmiIlanCollection();

            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())
                        {
                            rvResmiIlan.Add(new ResmiIlan(MConvert.NullToInt64(IDR["id"]), MConvert.NullToString(IDR["baslik"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["sehir"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToBool(IDR["aktif"])));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvResmiIlan);
        }