Exemple #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            KahnoUser authuser = new KahnoUser();

            if (KahnLib.Login(TextBox1.Text, KahnLib.HashPass(TextBox2.Text), ref authuser))
            {
                Session["localuser"] = authuser;
                Session["UID"]       = authuser.userid;
                if (authuser.isowner == "y")
                {
                    Session["RID"] = authuser.restaurantno;

                    Response.Redirect("Admin.aspx");
                }

                else
                {
                    Response.Redirect("UserHome.aspx");
                }
                //Label5.Text = authuser.ToString();
            }
            else
            {
                Label4.Visible = true;
            }
        }
        protected void Register_Click(object sender, EventArgs e)
        {
            double longitude = 0;
            double latitude  = 0;

            if (!double.TryParse(TextBox7.Text, out latitude))
            {
                latitude = 0;
            }

            if (!double.TryParse(TextBox8.Text, out longitude))
            {
                longitude = 0;
            }

            if (KahnLib.NewUser(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, KahnLib.HashPass(TextBox5.Text), latitude, longitude))
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                Label8.Visible = true;
            }
        }