Exemple #1
0
        ///<summary>
        /// Anket Data Delete
        ///</summary>
        public static int Delete(Anket p)
        {
            int rowsAffected = 0;

            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, "delete from anket where id=?id", conneciton))
                {
                    cmd.Parameters.Add("id", p.ID, MSqlDbType.BigInt);
                    rowsAffected = cmd.ExecuteNonQuery();
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Exemple #2
0
        ///<summary>
        /// Anket Data Update
        ///</summary>
        public static int Update(Anket p)
        {
            int rowsAffected = 0;

            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, "update anket set anketid=?anketid,adi=?adi,kayittarihi=?kayittarihi,aktif=?aktif,resimurl=?resimurl,grup=?grup,yatay=?yatay where id=?id", conneciton))
                {
                    cmd.Parameters.Add("id", p.ID, MSqlDbType.BigInt);
                    cmd.Parameters.Add("anketid", p.AnketID, MSqlDbType.BigInt);
                    cmd.Parameters.Add("adi", p.Adi, MSqlDbType.VarChar);
                    cmd.Parameters.Add("kayittarihi", p.KayitTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("aktif", p.Aktif, MSqlDbType.Boolean);
                    cmd.Parameters.Add("resimurl", p.ResimUrl, MSqlDbType.VarChar);
                    cmd.Parameters.Add("grup", p.Grup, MSqlDbType.VarChar);
                    cmd.Parameters.Add("yatay", p.Yatay, MSqlDbType.Boolean);
                    rowsAffected = cmd.ExecuteNonQuery();
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Exemple #3
0
        ///<summary>
        /// Anket Data Insert
        ///</summary>
        public static Int64 Insert(Anket p)
        {
            Int64 rowsAffected = 0;

            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, "insert into anket (anketid,adi,kayittarihi,aktif,resimurl,grup,yatay) values(?anketid,?adi,?kayittarihi,?aktif,?resimurl,?grup,?yatay); select last_insert_id();", conneciton))
                {
                    cmd.Parameters.Add("anketid", p.AnketID, MSqlDbType.BigInt);
                    cmd.Parameters.Add("adi", p.Adi, MSqlDbType.VarChar);
                    cmd.Parameters.Add("kayittarihi", p.KayitTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("aktif", p.Aktif, MSqlDbType.Boolean);
                    cmd.Parameters.Add("resimurl", p.ResimUrl, MSqlDbType.VarChar);
                    cmd.Parameters.Add("grup", p.Grup, MSqlDbType.VarChar);
                    cmd.Parameters.Add("yatay", p.Yatay, MSqlDbType.Boolean);
                    rowsAffected = MConvert.NullToInt64(cmd.ExecuteScalar());
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Exemple #4
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);
        }
Exemple #5
0
        ///<summary>
        /// Anket Data PrimaryKey
        ///</summary>
        public static Anket GetAnket(Int64 pid)
        {
            Anket rvAnket = new Anket();

            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 id=?id limit 1", conneciton))
                {
                    cmd.Parameters.Add("id", pid, MSqlDbType.BigInt);
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        while (IDR.Read())
                        {
                            rvAnket = 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);
        }
Exemple #6
0
        /// <summary>
        /// Anket Getir
        /// </summary>
        public static Anket GetAnket(CommandType cmdType, string sqlQuery, MParameterCollection parameters)
        {
            Anket rvAnket = new Anket();

            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 = 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);
        }
Exemple #7
0
 public void Remove(Anket obj)
 {
     this.List.Remove(obj);
 }
Exemple #8
0
 public int IndexOf(Anket obj)
 {
     return(this.List.IndexOf(obj));
 }
Exemple #9
0
 public bool Contains(Anket obj)
 {
     return(this.List.Contains(obj));
 }
Exemple #10
0
 public void Insert(int index, Anket obj)
 {
     this.List.Insert(index, obj);
 }
Exemple #11
0
 public int Add(Anket obj)
 {
     return(this.List.Add(obj));
 }