示例#1
0
        private void KullaniciBilgileri()
        {
            if ((BusinessLayer.WebUser)Session["WebUser"] != null)
            {
                _user = (BusinessLayer.WebUser)Session["WebUser"];
                int KullaniciID = Convert.ToInt32(_user.KULLANICI_ID);

                lblAdSoyad.Text = _user.KULLANICI_ADI + " " + _user.KULLANICI_SOYADI;

                using (admaticEntities con = new admaticEntities())
                {
                    var result = (from t0 in con.Kullanici_Sayfa_Matrix
                                  join t1 in con.Sayfalar on t0.Sayfa_ID equals t1.ID
                                  where t0.Kullanici_ID == KullaniciID && t1.INUSE == true
                                  orderby t1.ID ascending
                                  select new
                    {
                        t1.ID,
                        t1.Sayfa_Adi,
                        t1.Sayfa_Url
                    }).ToList();
                    if (result != null)
                    {
                        rptMenu.DataSource = result;
                        rptMenu.DataBind();
                    }

                    string linkGelenSayfaİsmi = Request.Path.ToString().Replace("/", "");
                }
            }
            else
            {
                Response.Redirect("login.aspx");
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            dvWarningMessage.InnerHtml = "";
            string HashedPassword = Helper.PwHash(txtPassword.Text.Trim());
            string EMail          = txtEmail.Text.Trim();

            using (admaticEntities con = new admaticEntities())
            {
                try
                {
                    RemoveInfoMessage("Hata oluştu");

                    Kullanicilar myKullanicilar = new Kullanicilar();
                    myKullanicilar = con.Kullanicilar.Where(x => x.Sifre == HashedPassword && x.Mail == EMail && x.INUSE == true).FirstOrDefault();

                    if (myKullanicilar != null)
                    {
                        RemoveInfoMessage("Hatalı kullanıcı adı veya şifre");

                        _user = new BusinessLayer.WebUser();
                        _user.KULLANICI_ADI      = myKullanicilar.Ad;
                        _user.KULLANICI_AKTIF    = myKullanicilar.INUSE;
                        _user.KULLANICI_ID       = myKullanicilar.ID;
                        _user.KULLANICI_MAIL     = myKullanicilar.Mail;
                        _user.KULLANICI_SIFRE    = myKullanicilar.Sifre;
                        _user.KULLANICI_SOYADI   = myKullanicilar.Soyad;
                        _user.OLUSTURULMA_TARIHI = myKullanicilar.OlusturulmaTarihi;

                        Session["WebUser"] = _user;

                        Response.Redirect("Firmalar.aspx", false);
                    }
                    else
                    {
                        AddInfoMessage("Hatalı kullanıcı adı veya şifre");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    //Sistem Hatası
                    AddInfoMessage("Hata oluştu");

                    return;
                }
            }
        }