Ejemplo n.º 1
0
        ///<summary>
        /// Mesaj Data Delete
        ///</summary>
        public static int Delete(Mesaj 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 mesaj 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);
        }
Ejemplo n.º 2
0
        ///<summary>
        /// Mesaj Data PrimaryKey
        ///</summary>
        public static Mesaj GetMesaj(Int64 pid)
        {
            Mesaj rvMesaj = new Mesaj();

            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 mesaj where id=?id limit 1", conneciton))
                {
                    cmd.Parameters.Add("id", pid, MSqlDbType.BigInt);
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        while (IDR.Read())
                        {
                            rvMesaj = new Mesaj(MConvert.NullToInt64(IDR["id"]), MConvert.NullToGuidString(IDR["hesapid"]), MConvert.NullToString(IDR["ip"]), MConvert.NullToString(IDR["adi"]), MConvert.NullToString(IDR["mail"]), MConvert.NullToString(IDR["telefon"]), MConvert.NullToString(IDR["konu"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["yanit"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToDateTime(IDR["guncellemetarihi"]), MConvert.NullToByte(IDR["durum"]), MConvert.NullToBool(IDR["yoneticionay"]), MConvert.NullToBool(IDR["aktif"]));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvMesaj);
        }
Ejemplo n.º 3
0
        ///<summary>
        /// Mesaj Data Update
        ///</summary>
        public static int Update(Mesaj 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 mesaj set hesapid=?hesapid,ip=?ip,adi=?adi,mail=?mail,telefon=?telefon,konu=?konu,icerik=?icerik,yanit=?yanit,kayittarihi=?kayittarihi,guncellemetarihi=?guncellemetarihi,durum=?durum,yoneticionay=?yoneticionay,aktif=?aktif where id=?id", conneciton))
                {
                    cmd.Parameters.Add("id", p.ID, MSqlDbType.BigInt);
                    cmd.Parameters.Add("hesapid", p.HesapID, MSqlDbType.VarChar);
                    cmd.Parameters.Add("ip", p.IP, MSqlDbType.VarChar);
                    cmd.Parameters.Add("adi", p.Adi, MSqlDbType.VarChar);
                    cmd.Parameters.Add("mail", p.Mail, MSqlDbType.VarChar);
                    cmd.Parameters.Add("telefon", p.Telefon, MSqlDbType.VarChar);
                    cmd.Parameters.Add("konu", p.Konu, MSqlDbType.VarChar);
                    cmd.Parameters.Add("icerik", p.Icerik, MSqlDbType.VarChar);
                    cmd.Parameters.Add("yanit", p.Yanit, MSqlDbType.VarChar);
                    cmd.Parameters.Add("kayittarihi", p.KayitTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("guncellemetarihi", p.GuncellemeTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("durum", p.Durum, MSqlDbType.SmallInt);
                    cmd.Parameters.Add("yoneticionay", p.YoneticiOnay, MSqlDbType.Boolean);
                    cmd.Parameters.Add("aktif", p.Aktif, MSqlDbType.Boolean);
                    rowsAffected = cmd.ExecuteNonQuery();
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Mesaj Getir
        /// </summary>
        public static Mesaj GetMesaj(CommandType cmdType, string sqlQuery, MParameterCollection parameters)
        {
            Mesaj rvMesaj = new Mesaj();

            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())
                        {
                            rvMesaj = new Mesaj(MConvert.NullToInt64(IDR["id"]), MConvert.NullToGuidString(IDR["hesapid"]), MConvert.NullToString(IDR["ip"]), MConvert.NullToString(IDR["adi"]), MConvert.NullToString(IDR["mail"]), MConvert.NullToString(IDR["telefon"]), MConvert.NullToString(IDR["konu"]), MConvert.NullToString(IDR["icerik"]), MConvert.NullToString(IDR["yanit"]), MConvert.NullToDateTime(IDR["kayittarihi"]), MConvert.NullToDateTime(IDR["guncellemetarihi"]), MConvert.NullToByte(IDR["durum"]), MConvert.NullToBool(IDR["yoneticionay"]), MConvert.NullToBool(IDR["aktif"]));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvMesaj);
        }
Ejemplo n.º 5
0
        ///<summary>
        /// Mesaj Data Insert
        ///</summary>
        public static Int64 Insert(Mesaj 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 mesaj (hesapid,ip,adi,mail,telefon,konu,icerik,yanit,kayittarihi,guncellemetarihi,durum,yoneticionay,aktif) values(?hesapid,?ip,?adi,?mail,?telefon,?konu,?icerik,?yanit,?kayittarihi,?guncellemetarihi,?durum,?yoneticionay,?aktif); select last_insert_id();", conneciton))
                {
                    cmd.Parameters.Add("hesapid", p.HesapID, MSqlDbType.VarChar);
                    cmd.Parameters.Add("ip", p.IP, MSqlDbType.VarChar);
                    cmd.Parameters.Add("adi", p.Adi, MSqlDbType.VarChar);
                    cmd.Parameters.Add("mail", p.Mail, MSqlDbType.VarChar);
                    cmd.Parameters.Add("telefon", p.Telefon, MSqlDbType.VarChar);
                    cmd.Parameters.Add("konu", p.Konu, MSqlDbType.VarChar);
                    cmd.Parameters.Add("icerik", p.Icerik, MSqlDbType.VarChar);
                    cmd.Parameters.Add("yanit", p.Yanit, MSqlDbType.VarChar);
                    cmd.Parameters.Add("kayittarihi", p.KayitTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("guncellemetarihi", p.GuncellemeTarihi, MSqlDbType.DateTime);
                    cmd.Parameters.Add("durum", p.Durum, MSqlDbType.SmallInt);
                    cmd.Parameters.Add("yoneticionay", p.YoneticiOnay, MSqlDbType.Boolean);
                    cmd.Parameters.Add("aktif", p.Aktif, MSqlDbType.Boolean);
                    rowsAffected = MConvert.NullToInt(cmd.ExecuteScalar());
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Ejemplo n.º 6
0
 public void Remove(Mesaj obj)
 {
     this.List.Remove(obj);
 }
Ejemplo n.º 7
0
 public int IndexOf(Mesaj obj)
 {
     return(this.List.IndexOf(obj));
 }
Ejemplo n.º 8
0
 public bool Contains(Mesaj obj)
 {
     return(this.List.Contains(obj));
 }
Ejemplo n.º 9
0
 public void Insert(int index, Mesaj obj)
 {
     this.List.Insert(index, obj);
 }
Ejemplo n.º 10
0
 public int Add(Mesaj obj)
 {
     return(this.List.Add(obj));
 }