Ejemplo n.º 1
0
        protected void ButtonLoginSubmit_Click(object sender, EventArgs e)
        {
            string phone    = this.TextboxLoginMobile.Text;
            string password = this.TextboxLoginPassword.Text;

            WebApplication1.scripts.doctorDAO dao = new scripts.doctorDAO();
            WebApplication1.scripts.doctor    acc = new scripts.doctor();
            int id = dao.getAccountByPhone(phone).getID();

            if (id == -1)
            {
                //not regestierd
                ClientScriptManager cs = Page.ClientScript;
                Type cstype            = this.GetType();

                String alert = "alert('this phone number is not registered');";
                cs.RegisterStartupScript(cstype, "PopupScript", alert, true);
            }
            else
            {
                //phone number exist
                acc = dao.getAccountByPhone(phone);
                if (acc.getPassword() != password)
                {
                    //wrong password
                    ClientScriptManager cs = Page.ClientScript;
                    Type cstype            = this.GetType();

                    String alert = "alert('wrong password');";
                    cs.RegisterStartupScript(cstype, "PopupScript", alert, true);
                }
                else
                {
                    //access granted
                    Session["dID"] = id;
                    Response.Redirect(Page.ResolveClientUrl("/doctor/reservations/reservations.aspx"));
                }
            }
        }
Ejemplo n.º 2
0
        protected void ButtonSignupSubmit_Click(object sender, EventArgs e)
        {
            string fName    = this.TextboxSignupFirstname.Text;
            string lName    = this.TextboxSignupLastname.Text;
            string email    = this.TextboxSignupEmail.Text;
            string password = this.TextboxSignupPassword.Text;
            string phone    = this.TextboxSignupMobile.Text;
            int    fees     = Convert.ToInt32(this.TextboxFees.Text);

            WebApplication1.scripts.doctor acc = new scripts.doctor();
            acc.setFname(fName);
            acc.setLname(lName);
            acc.setEmail(email);
            acc.setPassword(password);
            acc.setPNumber(phone);
            acc.setFees(fees);
            WebApplication1.scripts.doctorDAO dao = new scripts.doctorDAO();
            if (dao.getAccountByPhone(phone).getID() == -1)
            {
                dao.insertData(acc);

                ClientScriptManager cs = Page.ClientScript;
                Type cstype            = this.GetType();

                String alert = "alert('registeration completed');";
                cs.RegisterStartupScript(cstype, "PopupScript", alert, true);
                Response.Redirect(Page.ResolveClientUrl("/doctor/account/login.aspx"));
            }
            else
            {
                ClientScriptManager cs = Page.ClientScript;
                Type cstype            = this.GetType();

                String alert = "alert('this phone number is already registered ');";
                cs.RegisterStartupScript(cstype, "PopupScript", alert, true);
            }
        }