示例#1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            #region Condition
            if (string.IsNullOrWhiteSpace(TextBox1.Text) ||
                string.IsNullOrWhiteSpace(TextBox2.Text))
            {
                Response.Write("<script>alert('Please Fill All The Field')</script>");
                return;
            }
            #endregion
            try
            {
                var           res1           = client.Get(@"Doctors/");
                MyAppointment ResAppointment = res1.ResultAs <MyAppointment>();
                if (ResAppointment != null)
                {
                    counter = ResAppointment.counter;
                }
                for (int i = 1; counter > i; i++)
                {
                    FirebaseResponse res     = client.Get(@"Doctors/" + i);
                    MyAppointment    ResUser = res.ResultAs <MyAppointment>(); //database result
                    MyAppointment    CurUser = new MyAppointment()             //USER GIVEN INFO
                    {
                        Username = TextBox1.Text,
                        Password = TextBox2.Text
                    };

                    if (MyAppointment.IsEqual(ResUser, CurUser))
                    {
                        Response.Write("<script>alert('Successfully login!')</script>");
                        Response.Redirect("WebForm7.aspx");
                    }
                }
                Response.Write("<script>alert('Username and Password does not match!')</script>");
            }
            catch
            {
                Response.Write("<script>alert('User does not exist!')</script>");
            }
        }
示例#2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            #region Condition
            if (string.IsNullOrWhiteSpace(txtusername.Text) ||
                string.IsNullOrWhiteSpace(txtpassword.Text))
            {
                Response.Write("<script>alert('Please Fill All The Field')</script>");
                return;
            }
            #endregion
            try
            {
                FirebaseResponse res      = client.Get(@"Admin/" + txtusername.Text);
                MyAppointment    ResAdmin = res.ResultAs <MyAppointment>(); //database result

                MyAppointment CurAdmin = new MyAppointment()                //USER GIVEN INFO
                {
                    Username = txtusername.Text,
                    Password = txtpassword.Text
                };

                if (MyAppointment.IsEqual(ResAdmin, CurAdmin))
                {
                    Response.Write("<script>alert('Successfully login!')</script>");
                    Response.Redirect("WebForm5.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Username and password does not match!')</script>");
                }
            }
            catch
            {
                Response.Write("<script>alert('User does not exist!')</script>");
            }
        }