Ejemplo n.º 1
0
    protected void btnLogin_Click(object sender, EventArgs e)
    { // KULLANICI KAYDINI SORGULUYOR
        try
        {
            proxy = new ServiceReference1.ServiceClient();
            users currentuser = proxy.Login(TextBox1.Text, TextBox2.Text);

            if (currentuser == null) // KULLANICI YOKSA UYARI VERİYOR.
            {
                lblResult.Text = "Kullanıcı adı veya şifre hatalı.Lütfen tekrar deneyiniz.";
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyopenModal", "openModal();", true);


                proxy.WriteDebugLogError(DateTime.Now.ToString() + "     " + TextBox1.Text + "    mail adresi ile hatalı giriş yapılmıştır");
            }
            else if (currentuser.roleid == 1 || currentuser.roleid == 2 || currentuser.roleid == 3) //  KAYIT OLURKEN roleid GİRİLMİŞ Mİ DİYE KONTROL EDİYOR.
            {
                Session["UserID"] = currentuser.userid;
                Session["User"]   = currentuser.name.ToString() + "  " + currentuser.surname.ToString();

                if (currentuser.roleid == 1)
                {
                    Session["Role"]   = "Admin";
                    Session["RoleID"] = 1;
                }
                else if (currentuser.roleid == 2)
                {
                    Session["Role"]   = "Müşteri";
                    Session["RoleID"] = 2;
                }
                else
                {
                    Session["Role"]   = "Satıcı";
                    Session["RoleID"] = 3;
                }
                proxy.WriteDebugLogInfo(DateTime.Now.ToString() + "  userid = " + Session["UserID"].ToString() + " , oturum açtı.");
                if (Session["referer"] != null)
                {
                    Response.Redirect(Session["referer"].ToString());
                }
                Response.Redirect("HomePage.aspx");
            }
            else
            {
                Session["UserID"] = currentuser.userid;
                proxy.WriteDebugLogError(DateTime.Now.ToString() + "  userid = " + Session["UserID"].ToString() + " , rol atanmamıştır.");
            }
        }
        catch (Exception)
        {
            // throw ex;
        }
    }
Ejemplo n.º 2
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        ServiceReference1.ServiceClient sc =
            new ServiceReference1.ServiceClient();

        int result = sc.Login(EmailTextBox.Text, PasswordTextBox.Text);

        if (result != 0)
        {
            Session["userKey"] = result;
            ResultLabel.Text   = "Welcome" + result.ToString();
        }
        else
        {
            ResultLabel.Text = "Invalid Login";
        }
    }