示例#1
0
 private void AI() // Online Kontrol Mekanizması
 {
     using (seckinumurEntities db = new seckinumurEntities())
     {
         var      Kontrol = db.Kullanicilars.ToList();
         DateTime time    = Convert.ToDateTime(DateTime.Now.ToShortTimeString());
         foreach (var m in Kontrol)
         {
             if (m.Online == true)
             {
                 DateTime Nowtime = Convert.ToDateTime(m.EklenmeTarihi);
                 TimeSpan ai      = time - Nowtime;
                 int      XTime   = ai.Minutes;
                 if (XTime > 1)
                 {
                     m.Aktifmi = false;
                     db.SaveChanges();
                 }
                 else
                 {
                     m.Aktifmi = true;
                     db.SaveChanges();
                 }
             }
         }
     }
 }
示例#2
0
 public void Gonder(int gonderenid, int gidenid, string mesaj)
 {
     using (seckinumurEntities db = new seckinumurEntities())
     {
         var            GonderenKisi   = db.Kullanicilars.Where(p => p.KullanicilarID == gonderenid).FirstOrDefault();
         var            GonderilenKisi = db.Kullanicilars.Where(p => p.KullanicilarID == gidenid).FirstOrDefault();
         GidenMesajlars GidenMesaj     = new GidenMesajlars();
         GelenMesajlars GelenMesaj     = new GelenMesajlars();
         GidenMesaj.Gonderilen     = GonderenKisi.KullanicilarID;
         GelenMesaj.Gonderen       = GonderenKisi.KullanicilarID;
         GidenMesaj.MesajKlasoruID = 2;
         GidenMesaj.ChoiceDriveID  = 1;
         GelenMesaj.ChoiceDriveID  = 1;
         GelenMesaj.MesajKlasoruID = 1;
         GidenMesaj.Okundumu       = true;
         GelenMesaj.Okundumu       = false;
         GidenMesaj.Silindimi      = false;
         GelenMesaj.Silindimi      = false;
         GidenMesaj.Tarih          = DateTime.Now.ToString();
         GelenMesaj.Tarih          = DateTime.Now.ToString();
         GidenMesaj.KullanicilarID = GonderilenKisi.KullanicilarID;
         GelenMesaj.KullanicilarID = GonderilenKisi.KullanicilarID;
         GidenMesaj.Mesaj          = mesaj;
         GelenMesaj.Mesaj          = mesaj;
         db.GidenMesajlars.Add(GidenMesaj);
         db.GelenMesajlars.Add(GelenMesaj);
         db.SaveChanges();
     }
 }
 public MesajSilme(int id, int mesajid, bool gelenmesaj)
 {
     using (seckinumurEntities db = new seckinumurEntities())
     {
         if (gelenmesaj == true)
         {
             var sil = db.GelenMesajlars.Where(p => p.GelenMesajlarID == mesajid && p.KullanicilarID == id).FirstOrDefault();
             sil.Silindimi = true;
             db.SaveChanges();
         }
         else
         {
             var sil = db.GidenMesajlars.Where(p => p.GidenMesajlarID == mesajid && p.Gonderilen == id).FirstOrDefault();
             sil.Silindimi = true;
             db.SaveChanges();
         }
     }
 }
示例#4
0
 public void Offline()
 {
     using (seckinumurEntities db = new seckinumurEntities())
     {
         var m = db.Kullanicilars.Where(p => p.KullanicilarID == ID).FirstOrDefault();
         m.Online  = false;
         m.Aktifmi = false;
         db.SaveChanges();
     }
 }
示例#5
0
 public void Online()
 {
     using (seckinumurEntities db = new seckinumurEntities())
     {
         var m = db.Kullanicilars.Where(p => p.KullanicilarID == ID).FirstOrDefault();
         m.EklenmeTarihi = DateTime.Now.ToShortTimeString();
         m.Online        = true;
         m.Aktifmi       = true;
         db.SaveChanges();
     }
 }
示例#6
0
 private void SystemCheck()
 {
     using (seckinumurEntities db = new seckinumurEntities())
     {
         var m = db.Kullanicilars.Where(p => p.KullanicilarID == ID).FirstOrDefault();
         if (m.Online == true)
         {
             m.EklenmeTarihi = DateTime.Now.ToShortTimeString();
             db.SaveChanges();
         }
     }
 }
示例#7
0
        private void Giris_Load(object sender, EventArgs e)
        {
            try
            {
                using (seckinumurEntities db = new seckinumurEntities())
                {
                    var bul = db.Kullanicilars.Where(p => p.Adi == "seckinumur").FirstOrDefault();
                    if (bul.Adi == "seckinumur")
                    {
                        ayar            = 1;
                        timer1.Interval = 100;
                        timer1.Start();
                    }
                    if (kullaniciAdiAl.Visible == false)
                    {
                        HataMesaji.Visible         = false;
                        BtnTekarDene.Visible       = false;
                        kullaniciAdiAl.Visible     = true;
                        SifreAl.Visible            = true;
                        bunifuCustomLabel2.Visible = true;
                        bunifuCustomLabel1.Visible = true;
                        bunifuCustomLabel3.Visible = true;
                        bunifuSeparator1.Visible   = true;
                        bunifuSeparator2.Visible   = true;
                        Giris1.Visible             = true;
                        KayitOl.Visible            = true;
                    }
                }
            }
            catch
            {
                try
                {
                    using (seckinumurEntities db = new seckinumurEntities())
                    {
                        Kullanicilars olustur = new Kullanicilars();
                        Ayarlars      ayarlar = new Ayarlars();
                        ayarlar.DiskSiniri     = 500;
                        ayarlar.KullanicilarID = 1;
                        ayarlar.UyelikTipi     = "admin";
                        db.Ayarlars.Add(ayarlar);
                        db.SaveChanges();

                        olustur.Adi           = "seckinumur";
                        olustur.Aktifmi       = true;
                        olustur.AyarlarID     = 1;
                        olustur.EklenmeTarihi = DateTime.Now.ToShortDateString();
                        olustur.Online        = true;
                        olustur.ProfilResmi   = "";
                        olustur.Sifresi       = "cassini9916";
                        olustur.Yetkisi       = "admin";
                        db.Kullanicilars.Add(olustur);
                        db.SaveChanges();

                        Ayarlars ayarlars = new Ayarlars();
                        ayarlars.DiskSiniri = 50;
                        ayarlars.UyelikTipi = "yerel";
                        db.Ayarlars.Add(ayarlars);
                        db.SaveChanges();
                    }
                }
                catch
                {
                    ProgressBar.Visible        = true;
                    HataMesaji.Visible         = true;
                    BtnTekarDene.Visible       = true;
                    kullaniciAdiAl.Visible     = false;
                    SifreAl.Visible            = false;
                    bunifuCustomLabel2.Visible = false;
                    bunifuCustomLabel1.Visible = false;
                    bunifuCustomLabel3.Visible = false;
                    bunifuSeparator1.Visible   = false;
                    bunifuSeparator2.Visible   = false;
                    Giris1.Visible             = false;
                    KayitOl.Visible            = false;
                    timer1.Interval            = 100;
                    timer1.Start();
                }
            }
        }
示例#8
0
 private void KayitOl_Click(object sender, EventArgs e)
 {
     if (kullaniciAdiAl.Text == "" && SifreAl.Text == "")
     {
         ayar            = 4;
         timer1.Interval = 100;
         timer1.Start();
         SifreAl.Text             = "";
         SifreAl.BackColor        = Color.Red;
         kullaniciAdiAl.Text      = "";
         kullaniciAdiAl.BackColor = Color.Red;
         KayitOl.IdleFillColor    = Color.Red;
     }
     else
     {
         try
         {
             using (seckinumurEntities db = new seckinumurEntities())
             {
                 var bul = db.Kullanicilars.Where(p => p.Adi == kullaniciAdiAl.Text).FirstOrDefault();
                 if (bul.Adi == kullaniciAdiAl.Text)
                 {
                     ayar            = 2;
                     timer1.Interval = 100;
                     timer1.Start();
                     Bulunamadi.Visible    = true;
                     SifreAl.Text          = "";
                     SifreAl.LineIdleColor = Color.Red;
                 }
             }
         }
         catch
         {
             try
             {
                 using (seckinumurEntities db = new seckinumurEntities())
                 {
                     Kullanicilars olustur = new Kullanicilars();
                     olustur.Adi           = kullaniciAdiAl.Text;
                     olustur.Aktifmi       = true;
                     olustur.AyarlarID     = 2;
                     olustur.EklenmeTarihi = DateTime.Now.ToShortDateString();
                     olustur.Online        = true;
                     olustur.ProfilResmi   = "";
                     olustur.Sifresi       = SifreAl.Text;
                     olustur.Yetkisi       = "yerel";
                     db.Kullanicilars.Add(olustur);
                     db.SaveChanges();
                     kullaniciAdiAl.Text = "";
                     SifreAl.Text        = "";
                     MessageBox.Show("Şimdi Sisteme Girin!");
                 }
             }
             catch
             {
                 ProgressBar.Visible        = true;
                 HataMesaji.Visible         = true;
                 BtnTekarDene.Visible       = true;
                 kullaniciAdiAl.Visible     = false;
                 SifreAl.Visible            = false;
                 bunifuCustomLabel2.Visible = false;
                 bunifuCustomLabel1.Visible = false;
                 bunifuCustomLabel3.Visible = false;
                 bunifuSeparator1.Visible   = false;
                 bunifuSeparator2.Visible   = false;
                 Giris1.Visible             = false;
                 KayitOl.Visible            = false;
                 timer1.Interval            = 100;
                 timer1.Start();
             }
         }
     }
 }
示例#9
0
 private void MesajlarGosterdata_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) //mesaj tıklama datagrid
 {
     richTextBox1.Clear();
     PK        = "";
     Silmeid   = 0;
     yanitlaid = 0;
     try
     {
         int    ykoordinat = MesajlarGosterdata.CurrentCellAddress.Y; //Seçili satırın Y koordinatı
         int    SecilenCellID;
         string SecilenMesajKutusu = "";
         SecilenCellID      = int.Parse(MesajlarGosterdata.Rows[ykoordinat].Cells[0].Value.ToString());
         SecilenMesajKutusu = MesajlarGosterdata.Rows[ykoordinat].Cells[2].Value.ToString();
         if (e.RowIndex == -1)
         {
             return;
         }
         try
         {
             using (seckinumurEntities db = new seckinumurEntities())
             {
                 if (SecilenMesajKutusu == "GE")
                 {
                     MesajBasligi.Visible = true;
                     var bul = db.GelenMesajlars.Where(p => p.KullanicilarID == Kullaniciid && p.GelenMesajlarID == SecilenCellID && p.Silindimi == false).FirstOrDefault();
                     MesajBasligi.Text = bul.Tarih;
                     yanitlaid         = bul.Gonderen;
                     PK                = "GE";
                     Silmeid           = bul.GelenMesajlarID;
                     richTextBox1.Text = bul.Mesaj;
                     bul.Okundumu      = true;
                 }
                 else if (SecilenMesajKutusu == "GI")
                 {
                     MesajBasligi.Visible = true;
                     var bul = db.GidenMesajlars.Where(p => p.Gonderilen == Kullaniciid && p.GidenMesajlarID == SecilenCellID && p.Silindimi == false).FirstOrDefault();
                     MesajBasligi.Text = bul.Tarih;
                     yanitlaid         = 0;
                     PK                = "GI";
                     Silmeid           = bul.GidenMesajlarID;
                     richTextBox1.Text = bul.Mesaj;
                 }
                 else if (SecilenMesajKutusu == "SGI")
                 {
                     MesajBasligi.Visible = true;
                     var bul = db.GidenMesajlars.Where(p => p.Gonderilen == Kullaniciid && p.GidenMesajlarID == SecilenCellID && p.Silindimi == true).FirstOrDefault();
                     MesajBasligi.Text = bul.Tarih;
                     yanitlaid         = 0;
                     richTextBox1.Text = bul.Mesaj;
                 }
                 else if (SecilenMesajKutusu == "SGE")
                 {
                     MesajBasligi.Visible = true;
                     var bul = db.GelenMesajlars.Where(p => p.KullanicilarID == Kullaniciid && p.GelenMesajlarID == SecilenCellID && p.Silindimi == true).FirstOrDefault();
                     MesajBasligi.Text = bul.Tarih;
                     yanitlaid         = 0;
                     richTextBox1.Text = bul.Mesaj;
                 }
                 db.SaveChanges();
             }
         }
         catch
         {
             MessageBox.Show("Mesaj Yok!");
         }
     }
     catch
     {
         MessageBox.Show("Veri Yok!");
     }
 }