private void btnVerifyUser_Click(object sender, RoutedEventArgs e)
        {

            string id = txtID.Text;
            Method obj = new Method();
            string msg = "";


            var user = obj.getRegisterUser(id);

            if(user == null)
            {

                msg = "please check your id number ";
                messageBox(msg);
            }
            else
            {
                idNum = txtID.Text;
                txtID.IsEnabled = false;
                btnUpdate.IsEnabled = true;
                txtEmail.IsEnabled = true;
                txtSurname.IsEnabled = true;
                txtCellNumber.IsEnabled = true;
                txtHomeAddress.IsEnabled = true;
             
                lblDisplayName.Text = user.Name;
                txtSurname.Text = user.Surname;
                txtEmail.Text = user.Email;
                //txtCellNumber.Text = user.CellNum;
            }


        }
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {

            string surname, email, cellNumber, homeAddress, province;

            surname = txtSurname.Text;
            email = txtEmail.Text;
            cellNumber = txtCellNumber.Text;
            homeAddress = txtHomeAddress.Text;
            province = "Guateng";

            Method obj = new Method();
            if(surname.Trim() != "" && email.Trim() != "" && cellNumber.Trim() != "" )
            {
                obj.updateDetails(surname, cellNumber, email, homeAddress, idNum);
                messageBox("Your details has been updated");
            }
            else
            {

                messageBox("fill all the field with data");
            }


        }
        private void btnReset_Click(object sender, RoutedEventArgs e)
        {
            string id, password, rePassword;
            string msg = "";
            validation objValidate = new validation();
            Method obj = new Method();


            id = txtID.Text;
            password = txtPassword.Password;
            rePassword = txtReEnterPassword.Password;
            try
            {
                if (objValidate.validatePassword(password,rePassword) != "")
                {
                    msg = "MAke sure your password match re- enter again";
                    messageBox(msg);
                }else
                {
                    msg = "Your password have been reset";
                    messageBox(msg);
                    this.Frame.Navigate(typeof(MainPage));
                }

            }
            catch(Exception ex)
            {
                messageBox(msg + ex.Message);
            }

            



        }
示例#4
0
        private void btnLogIn_Click(object sender, RoutedEventArgs e)
        {

            
           // this.Frame.Navigate(typeof(HomePage));
            string email, password;

            Method objM = new Method();

            email = txtEmail.Text;
            password = txtPassword.Password;

            var valid = objM.getLogIN(email, password);
            if(email.Trim() == "" && password.Trim() == "")
            {
                messageBox("please enter yuor email and password");
            }else
                {
                if (valid != null)
                    {
                        this.Frame.Navigate(typeof(HomePage));
                    }
                else
                {
                    messageBox("you passsword and email dont match please rectify");
                }
            }

        }
示例#5
0
        public HomePage()
        {
            Method obj = new Method();
            this.InitializeComponent();

            string locationName;

            lblDisplayName.Text = "wisani";
        }
示例#6
0
        private async void btnSendRequest_Click(object sender, RoutedEventArgs e)
        {
            Method obj = new Method();

            Geolocator geolocator = new Geolocator();
            Geoposition currentPosition = await geolocator.GetGeopositionAsync();
            string address = "pretoria";
            MapLocationFinderResult result = await MapLocationFinder.FindLocationsAsync(
            address, currentPosition.Coordinate.Point, 5);
            myMap.Center = currentPosition.Coordinate.Point;
            getLocationAddress();




        }
        private void btnResetPassword_Click(object sender, RoutedEventArgs e)
        {
            Method obj = new Method();
            string id = txtID.Text;
            string msg = "";

            
            var vali = obj.getRegisterUser(id);



            if(vali == null)
            {
                msg = "the is no user with that id number please verify if id is correct";
                messageBox(msg);
            }else
            {
                this.Frame.Navigate(typeof(ResetPasswordPage));
            }
          


        }
        private void btnComment_Click(object sender, RoutedEventArgs e)
        {
            var objCom = new Method();

            string name, surname, email, comment, id, comOrcompl, date;
            int complainID = 0;


            try
            {
                email = txtEmail.Text;
                name = txtName.Text;
                surname = txtSurname.Text;
                comment = txtComments.Text;
                comOrcompl = "complains";
                date = DateTime.Now.ToString();

                var valid = objCom.getRegUser(name);
                if (valid != null)
                {
                    id = valid.ID;
                    objCom.setComplains(complainID, id, name, surname, email, comment, comOrcompl);

                }
                else
                {
                    messageBox("ID not found");
                }
                
            }
            catch (Exception ex)
            {
                messageBox("error " + ex.Message);
            }


            /*var objCom = new Method();
           var objValidate = new validation();
           string msg = "";

            string name,surname, email,comment, id,comOrcompl, date;
            int complainID = 0;


            email = txtEmail.Text;
            name = txtName.Text;
            surname = txtSurname.Text;
            comment = txtComments.Text;
            comOrcompl = "complains";
            date = DateTime.Now.ToString();

            //this valid variable will have access to get the id number of a user

            var valid = objCom.getRegUser(name);
            
          

            // validadate all variable and set the comment in table comment
            /*try
            {
                    msg = objValidate.validateString(name);
                    msg +=  objValidate.validateString(surname);
                    msg +=  objValidate.validateEmail(email);
               if (msg == "") 
               {
                    id = valid.ID;
                    if(id== null)
                    {
                         messageBox("Please name sure that you enter your correct name");
                    }
                   else
                   { 
                      objCom.setComplains(complainID, id, name, surname, email, comment, comOrcompl);
                       messageBox("Thanks you for commenting, your input will make us improve our service" + id);
                            //this.Frame.Navigate(typeof(MainPage));
                    }
                }
               else
               {
                   messageBox(msg);
               }
            }
            catch(Exception ex)
            {
                messageBox(ex.Message);
            }
             */
   }        
        private void btnRegister_Click(object sender, RoutedEventArgs e)
        {   
         
           var objvalidate = new validation();
           var objReg = new Method();
           var objRegister = new tblRegister();

            String IDnum,cell, name, surname, homeAddress, email, password, repassword, gender;
            string msg = "";
           // string n = "/n";
            int age;
            IDnum = txtID.Text;
            name = txtName.Text;
            homeAddress = txtHomeAddress.Text;
            email = txtEmail.Text;
            password = txtPassword.Password;
            repassword = txtRe_password.Password;
            surname = txtSurname.Text;
            cell = txtCellnumber.Text;

            
          

            try
            {
                if (IDnum == "" && name == "" && password == "" && surname == "" && cell == "" && email == "")
              {
                  messageBox("all field must be fill with yuor correct details");
              }
             
                   msg += objvalidate.IDValidation(IDnum); 
                   msg += objvalidate.validatePassword(password, repassword);
                     



                 
                       if (objReg.getRegisterUser(IDnum) == null)
                       {
                           gender = objvalidate.getGender(IDnum);
                           age = objvalidate.getAge(IDnum);
                           objReg.setRegister(IDnum, name, surname, email, cell, gender, age, password);

                           messageBox("Thanks you for registering for Emergency Medical Servise");

                           this.Frame.Navigate(typeof(MainPage));
                       }
                       else
                           {
                               messageBox("user already registerd in the system");
                           }
                
            }
            catch (Exception ex)
            {
                messageBox(ex.Message);
            }
            
            
           
        }
        private void btnView_Click(object sender, RoutedEventArgs e)
        {

            getComment();
            string msg = "";
           


            Method obj = new Method();
            int comID = 0;
            var objCom = obj.getComment(comID);


            if (objCom == null)
            {
                msg = "No record was found in the data base, you didnt make any comment about our servince ";
                messageBox(msg);
            }
            else
            {
                while (objCom != null)
                {
                    lstViewPreComm.Items.Add(objCom.Name + "  " + objCom.Comment);
                    comID = comID + 1;
                    objCom = obj.getComment(comID);
                }
            }
            

        }