Пример #1
0
        ///<summary>
        /// ResmiIlan Data Delete
        ///</summary>
        public static int Delete(ResmiIlan 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 resmiilan 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);
        }
Пример #2
0
        ///<summary>
        /// ResmiIlan Data Update
        ///</summary>
        public static int Update(ResmiIlan 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 resmiilan set baslik=?baslik,icerik=?icerik,sehir=?sehir,kayittarihi=?kayittarihi,aktif=?aktif where id=?id", conneciton))
                {
                    cmd.Parameters.Add("id", p.ID, MSqlDbType.BigInt);
                    cmd.Parameters.Add("baslik", p.Baslik, MSqlDbType.VarChar);
                    cmd.Parameters.Add("icerik", p.Icerik, MSqlDbType.LongText);
                    cmd.Parameters.Add("sehir", p.Sehir, MSqlDbType.VarChar);
                    cmd.Parameters.Add("kayittarihi", p.KayitTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("aktif", p.Aktif, MSqlDbType.Boolean);
                    rowsAffected = cmd.ExecuteNonQuery();
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Пример #3
0
        ///<summary>
        /// ResmiIlan Data Insert
        ///</summary>
        public static Int64 Insert(ResmiIlan 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 resmiilan (baslik,icerik,sehir,kayittarihi,aktif) values(?baslik,?icerik,?sehir,?kayittarihi,?aktif); select last_insert_id();", conneciton))
                {
                    cmd.Parameters.Add("baslik", p.Baslik, MSqlDbType.VarChar);
                    cmd.Parameters.Add("icerik", p.Icerik, MSqlDbType.LongText);
                    cmd.Parameters.Add("sehir", p.Sehir, MSqlDbType.VarChar);
                    cmd.Parameters.Add("kayittarihi", p.KayitTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("aktif", p.Aktif, MSqlDbType.Boolean);
                    rowsAffected = MConvert.NullToInt64(cmd.ExecuteScalar());
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Пример #4
0
        ///<summary>
        /// ResmiIlan Data PrimaryKey
        ///</summary>
        public static ResmiIlan GetResmiIlan(Int64 pid)
        {
            ResmiIlan rvResmiIlan = new ResmiIlan();

            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 where id=?id limit 1", conneciton))
                {
                    cmd.Parameters.Add("id", pid, MSqlDbType.BigInt);
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        while (IDR.Read())
                        {
                            rvResmiIlan = 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);
        }
Пример #5
0
        /// <summary>
        /// ResmiIlan Getir
        /// </summary>
        public static ResmiIlan GetResmiIlan(CommandType cmdType, string sqlQuery, MParameterCollection parameters)
        {
            ResmiIlan rvResmiIlan = new ResmiIlan();

            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 = 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);
        }
Пример #6
0
 public void Remove(ResmiIlan obj)
 {
     this.List.Remove(obj);
 }
Пример #7
0
 public int IndexOf(ResmiIlan obj)
 {
     return(this.List.IndexOf(obj));
 }
Пример #8
0
 public bool Contains(ResmiIlan obj)
 {
     return(this.List.Contains(obj));
 }
Пример #9
0
 public void Insert(int index, ResmiIlan obj)
 {
     this.List.Insert(index, obj);
 }
Пример #10
0
 public int Add(ResmiIlan obj)
 {
     return(this.List.Add(obj));
 }