Пример #1
0
    protected void btnGiris_Click(object sender, EventArgs e)
    {
        TezDBEntities db = new TezDBEntities();

        hca = db.Hoca.Where(h => h.Id == AppKontrol.id).FirstOrDefault();
        string baslik = Request["Baslik"].Trim();
        string mesajT = Request["Mesaj"].Trim();

        if (mesajT == "" || baslik == "" || Alici.SelectedValue == "")
        {
            msgbilgi.Text = "Lütfen Boş Geçmeyiniz";
        }
        else
        {
            Mesaj mesaj = new Mesaj();
            mesaj.MsjBaslik = baslik;
            mesaj.MsjText   = mesajT;
            mesaj.Gid       = AppKontrol.id;
            mesaj.Aid       = Convert.ToInt32(Alici.SelectedValue);
            mesaj.Gadi      = hca.Ad;
            mesaj.Aadi      = Alici.SelectedItem.Text;
            mesaj.GDerece   = AppKontrol.derece;
            mesaj.ADerece   = 2;
            mesaj.Okundu    = false;
            mesaj.MsjTarih  = DateTime.Now;
            db.Mesaj.Add(mesaj);
            db.SaveChanges();
            msgbilgi.Text = "Mesajınız Gönderilmiştir.";
        }
    }
Пример #2
0
    protected void btnGiris_Click(object sender, EventArgs e)
    {
        TezDBEntities db = new TezDBEntities();

        string sifrem = Sifreleme.Sifrele(Request["Sifre"].Trim());
        string no     = Request["E-mail"].Trim();

        if (Request["Name"].Trim() == "" || Request["Sifre"].Trim() == "" || Request["E-mail"].Trim() == "" || Request["Ders"].Trim() == "")
        {
            LabelSignUP.Text = "Lütfen Boş Geçmeyiniz";
        }
        else
        {
            if (db.Hoca.Where(w => w.Mail == no).Any())
            {
                LabelSignUP.Text = "Bu Kullanıcı Sistemde Mevcut";
            }
            else
            {
                Hoca hoca = new Hoca();

                hoca.Ad     = Request["Name"].Trim();
                hoca.Sifre  = sifrem;
                hoca.Mail   = Request["E-mail"].Trim();
                hoca.Ders   = Request["Ders"].Trim();
                hoca.Derece = 1;
                db.Hoca.Add(hoca);
                db.SaveChanges();
                Response.Redirect(@"~/Default.aspx");
            }
        }
    }
Пример #3
0
        // GET: Hoca
        public ActionResult Index(int HocaNo)
        {
            Hoca tempHoca = new Hoca();

            tempHoca = Db.Hocalar.SingleOrDefault(I => I.HocaNo == HocaNo);
            List <Ders> HocaninDersleri = new List <Ders>();

            HocaninDersleri = tempHoca.Dersler.ToList();

            return(View(HocaninDersleri));
        }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         hca = db.Hoca.Where(h => h.Id == AppKontrol.id).FirstOrDefault();
         var ogrenci = db.Ogrenci.Where(x => x.Hoca_ID == AppKontrol.id).Select(x => new { x.Ad, x.Id }).ToList();
         Alici.DataSource     = ogrenci;
         Alici.DataTextField  = "Ad";
         Alici.DataValueField = "Id";
         Alici.DataBind();
     }
 }
Пример #5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable     kullaniciTable = new DataTable();
            SqlConnection con            = new SqlConnection(@"Data Source=DESKTOP-U5J583K\SQL_2016;Initial Catalog=YeniOgrenciOtomasyon;Persist Security Info=True;User ID=sa;Password=123456789");
            con.Open();


            string sql = "update Hoca set Password=@Password";

            SqlCommand komut = new SqlCommand(sql, con);

            komut.Parameters.AddWithValue("@Password", tb_passs.Text);

            komut.ExecuteNonQuery();

            con.Close();
            string script = "alert(\"Password is updated!\");";
            ScriptManager.RegisterStartupScript(this, GetType(),
                                                "ServerControlScript", script, true);

            // create data adapter

            // this will query your database and return the result to your datatable

            if (kullaniciTable != null && kullaniciTable.Rows.Count > 0)
            {
                Hoca akitfKullanici = new Hoca();
                akitfKullanici.Password = kullaniciTable.Rows[0]["Password"].ToString();


                Session["AktifKullanici"] = akitfKullanici;
                Response.Redirect("Default.aspx", false);
            }
            else
            {
            }
            //con.Close();
        }

        catch (Exception ex)

        {
        }
    }
Пример #6
0
    protected override void OnInit(EventArgs e)
    {
        TezDBEntities db   = new TezDBEntities();
        var           Hoca = db.Hoca.ToList();

        if (Session["Id"] != null)
        {
            if ((int)Session["derece"] == 2) //2 veritabanında öğrenci demek
            {
                Response.Redirect(@"~/Forms/Ogrenci/index.aspx");
            }
            if ((int)Session["derece"] == 0)
            {
                Response.Redirect(@"~/Forms/Admin/index.aspx");
            }
        }

        else
        {
            if (Request.Cookies["MyCookie"] != null)
            {
                string No    = Request.Cookies["MyCookie"]["No"];
                string sifre = Request.Cookies["MyCookie"]["sifre"];
                Hoca   hoca  = db.Hoca.Where(u => u.Mail == No && u.Sifre == sifre).FirstOrDefault();
                if (hoca != null)
                {
                    AppKontrol.id     = hoca.Id;
                    AppKontrol.name   = hoca.Ad;
                    AppKontrol.derece = Convert.ToInt32(hoca.Derece);
                    Response.Redirect(@"~/Default.aspx");
                }
            }
            else
            {
                Response.Redirect(@"~/Default.aspx");
            }
        }
        base.OnInit(e);
    }
    protected void btnGirisYap_Click(object sender, EventArgs e)
    {
        try
        {
            DataTable kullaniciTable1 = new DataTable();
            string    query           = "SELECT * FROM Hoca WHERE Mail = '" + loguser.Text + "' AND Password= '******'";

            SqlCommand cmd = new SqlCommand(query, con);
            con.Open();

            // create data adapter
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            // this will query your database and return the result to your datatable
            da.Fill(kullaniciTable1);
            con.Close();
            da.Dispose();
            if (kullaniciTable1 != null && kullaniciTable1.Rows.Count > 0)
            {
                Hoca akitfKullanici = new Hoca();
                akitfKullanici.Id       = Convert.ToInt32(kullaniciTable1.Rows[0]["Id"].ToString());
                akitfKullanici.BolumID  = (kullaniciTable1.Rows[0]["BolumID"] != null && kullaniciTable1.Rows[0]["BolumID"] != System.DBNull.Value) ? Convert.ToInt32(kullaniciTable1.Rows[0]["BolumID"].ToString()) : 0;
                akitfKullanici.Adi      = kullaniciTable1.Rows[0]["Adi"].ToString();
                akitfKullanici.Mail     = kullaniciTable1.Rows[0]["Mail"].ToString();
                akitfKullanici.Password = kullaniciTable1.Rows[0]["Password"].ToString();
                akitfKullanici.Adress   = kullaniciTable1.Rows[0]["Adres"].ToString();
                akitfKullanici.KTarihi  = Convert.ToDateTime(kullaniciTable1.Rows[0]["KTarihi"].ToString());
                akitfKullanici.Statu    = Convert.ToBoolean(kullaniciTable1.Rows[0]["Statu"].ToString());

                Session["AktifKullanici"] = akitfKullanici;
                Response.Redirect("Aca_PersonalInfo.aspx", false);
            }
        }
        catch (Exception ex)
        {
        }
    }
Пример #8
0
    public void CheckUser(string UserName, string Password = null)
    {
        if (string.IsNullOrEmpty(UserName))
        {
            Label1.Text = "Lütfen Kullanıcı Adı Ve Şifre Giriniz!";
            return;
        }
        else
        {
            Password = Sifreleme.Sifrele(Password);
        }


        if (!UserName.Contains("@"))
        {
            Ogrenci user = db.Ogrenci.Where(w => w.No == UserName && w.Sifre == Password).FirstOrDefault();

            if (user != null)
            {
                if (user.durum == true)
                {
                    Response.Cookies.Add(cookie.Cookie(user.No, user.Sifre));
                    AuthenticateUser(user.Id, user.Derece, user.Ad, user.Sifre, "Ogrenci");
                }
                else
                {
                    Label1.Text = "Teziniz Bitmiştir. Sisteme Giriş Yetkiniz Bulunmamaktadır.";
                }
            }
            else
            {
                Label1.Text = "Kullanıcı Adı Veya Şifresi Hatalı!";
            }
        }
        else if (IsAdmin(UserName))
        {
            Admin user = db.Admin.Where(w => w.Mail == UserName && w.Sifre == Password).FirstOrDefault();

            if (user != null)
            {
                Response.Cookies.Add(cookie.Cookie(user.Mail, user.Sifre));
                AuthenticateUser(user.Id, user.Derece, user.KullanıcıAdi, user.Sifre, "Admin");
            }

            else
            {
                Label1.Text = "Kullanıcı Adı Veya Şifresi Hatalı!";
            }
        }
        else
        {
            Hoca user = db.Hoca.Where(w => w.Mail == UserName && w.Sifre == Password).FirstOrDefault();

            if (user != null)
            {
                Response.Cookies.Add(cookie.Cookie(user.Mail, user.Sifre));
                AuthenticateUser(user.Id, user.Derece, user.Ad, user.Sifre, "Hoca");
            }

            else
            {
                Label1.Text = "Kullanıcı Adı Veya Şifresi Hatalı!";
            }
        }
    }
Пример #9
0
        public ActionResult Giris(FormCollection bilgiler)
        {
            int key = 0;

            if (!string.IsNullOrEmpty(bilgiler["OgrenciNo"]))
            {
                string ogrno = bilgiler["OgrenciNo"];
                key = Convert.ToInt32(ogrno);
                string sifre = bilgiler["Sifre"];
                Session["UserId"]   = bilgiler["OgrenciNo"];
                Session["UserPass"] = bilgiler["Sifre"];

                Ogrenci tempOgrenci = new Ogrenci();
                tempOgrenci = Db.Ogrenciler.SingleOrDefault(I => (I.OgrenciNo == key) && (I.Sifre == sifre));

                if (tempOgrenci == null)
                {
                    Session["UserId"]   = null;
                    Session["UserPass"] = null;
                    return(View("HataliGiris"));
                }
                else
                {
                    return(View("OgrenciGirisi", tempOgrenci));
                }
            }
            if (!string.IsNullOrEmpty(bilgiler["HocaNo"]))
            {
                string ogrno = bilgiler["HocaNo"];
                key = Convert.ToInt32(ogrno);
                string sifre = bilgiler["Sifre"];
                Session["UserId"]   = bilgiler["HocaNo"];
                Session["UserPass"] = bilgiler["Sifre"];

                Hoca tempHoca = new Hoca();
                tempHoca = Db.Hocalar.SingleOrDefault(I => (I.HocaNo == key) && (I.Sifre == sifre));

                if (tempHoca == null)
                {
                    Session["UserId"]   = null;
                    Session["UserPass"] = null;
                    return(View("HataliGiris"));
                }
                else
                {
                    return(View("HocaGirisi", tempHoca));
                }
            }
            if (!string.IsNullOrEmpty(bilgiler["YoneticiNo"]))
            {
                string ogrno = bilgiler["YoneticiNo"];
                key = Convert.ToInt32(ogrno);
                string sifre = bilgiler["Sifre"];
                Session["UserId"]   = bilgiler["YoneticiNo"];
                Session["UserPass"] = bilgiler["Sifre"];

                Yonetici tempYonetici = new Yonetici();
                tempYonetici = Db.Yoneticiler.SingleOrDefault(I => (I.YoneticiNo == key) && (I.Sifre == sifre));

                if (tempYonetici == null)
                {
                    Session["UserId"]   = null;
                    Session["UserPass"] = null;
                    return(View("HataliGiris"));
                }
                else
                {
                    return(View("YoneticiGirisi", tempYonetici));
                }
            }
            return(View("Giris"));
        }