Пример #1
0
        public static AnketCollection GetSelect(Anket p)
        {
            AnketCollection rvAnket = new AnketCollection();

            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 anket where anketid=?anketid order by " + (BAYMYO.UI.Converts.NullToBool(p.Grup) ? "grup asc," : "") + " id asc", conneciton))
                {
                    cmd.Parameters.Add("anketid", p.ID, MSqlDbType.BigInt);
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        while (IDR.Read())
                        {
                            rvAnket.Add(new Anket(MConvert.NullToInt64(IDR["id"]), MConvert.NullToInt64(IDR["anketid"]), MConvert.NullToString(IDR["adi"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToBool(IDR["aktif"]), MConvert.NullToString(IDR["resimurl"]), MConvert.NullToString(IDR["grup"]), MConvert.NullToBool(IDR["yatay"])));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvAnket);
        }
Пример #2
0
        /// <summary>
        /// Anket Liste Getir
        /// </summary>
        public static AnketCollection GetList(CommandType cmdType, string sqlQuery, MParameterCollection parameters)
        {
            AnketCollection rvAnket = new AnketCollection();

            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())
                        {
                            rvAnket.Add(new Anket(MConvert.NullToInt64(IDR["id"]), MConvert.NullToInt64(IDR["anketid"]), MConvert.NullToString(IDR["adi"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToBool(IDR["aktif"]), MConvert.NullToString(IDR["resimurl"]), MConvert.NullToString(IDR["grup"]), MConvert.NullToBool(IDR["yatay"])));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvAnket);
        }