private void update_Click(object sender, EventArgs e)
        {
            if (Firstname.Text != "" && Lastname.Text != "" && Middlename.Text != "" && bday.Text != "" && Address.Text != "" && Phonenum.Text != "" && Jobposition.Text != "" && Emailadd.Text != "")
            {
                sqlcon.Close();
                string         query = "Update quickpctbl Set Fname ='" + Firstname.Text.Trim() + "', Mname ='" + Middlename.Text.Trim() + "', Lname ='" + Lastname.Text.Trim() + "', Birthday ='" + bday.Text.Trim() + "', Address ='" + Address.Text.Trim() + "', PhoneNumber ='" + Phonenum.Text.Trim() + "', JobPosition ='" + Jobposition.Text.Trim() + "', EmailAddress ='" + Emailadd.Text.Trim() + "' where IdNumber = '" + idnum.Text.Trim() + "'";
                SqlDataAdapter sda   = new SqlDataAdapter(query, sqlcon);
                DataTable      dtbl  = new DataTable();
                sda.Fill(dtbl);

                MessageBox.Show("Successfuly Update!");
            }
            else
            {
                MessageBox.Show("Please Input!");
            }
            idnum.Clear();
            Firstname.Clear();
            Middlename.Clear();
            Lastname.Clear();
            bday.Text = String.Empty;
            Address.Clear();
            Phonenum.Clear();
            Jobposition.Text = String.Empty;
            Emailadd.Clear();
        }
Ejemplo n.º 2
0
        internal void ProfileAdd()
        {
            // Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ProfilePage");

            GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, By.XPath("(//i[@class='dropdown icon'])[2]"));
            //Click Profilename
            ProfileName.Click();

            //Enter Firstname
            Firstname.Clear();
            Firstname.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Firstname"));

            //Enter Lastname
            Lastname.Clear();
            Lastname.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Lastname"));

            //Save profilename
            SaveProfileName.Click();
            var fname = GlobalDefinitions.ExcelLib.ReadData(2, "Firstname");
            var Lname = GlobalDefinitions.ExcelLib.ReadData(2, "Lastname");
            var title = fname + " " + Lname;

            GlobalDefinitions.wait(40);
            Assert.AreEqual(Titlename.Text, title);
        }
Ejemplo n.º 3
0
        internal void Account()
        {
            User.Click();
            MyAcc.Click();
            Namechange.Click();
            ExcelLib.PopulateInCollection(Base.ExcelPath, "MyAccount");
            Firstname.Clear();
            Thread.Sleep(3000);
            Firstname.SendKeys(ExcelLib.ReadData(2, "Firstname"));
            Driver.wait(5);
            Lastname.Clear();
            Lastname.SendKeys(ExcelLib.ReadData(2, "Lastname"));
            Submitname.Click();


            ChangeRegion.Click();
            //select a region from dropdown
            Driver.wait(5);
            SelectElement reg       = new SelectElement(Region);
            string        regionval = ExcelLib.ReadData(2, "Region");

            reg.SelectByText(regionval);
            //Region.SendKeys(ExcelLib.ReadData(2, " Region"));
            // Global.Driver.WaitForElement(Driver.driver, By.XPath("html/body/div[8]"), 10);
            // Region.SendKeys(Keys.ArrowDown);
            //Region.SendKeys(Keys.Enter);


            Thread.Sleep(3000);
            SubmitRegion.Click();
            ValidateMyAcc();
        }
Ejemplo n.º 4
0
 public StudentInfoWindow()
 {
     InitializeComponent();
     Firstname.Clear();
     Lastname.Clear();
     Group.Clear();
     BookNum.Clear();
 }
 private void resetlist_Click(object sender, EventArgs e)
 {
     ID_Student.Clear();
     Firstname.Clear();
     Lastname.Clear();
     PhoneNumber.Clear();
     Address.Clear();
     picturestudent.Image = null;
     RadioMale.Checked    = false;
     RadioFemale.Checked  = false;
 }
Ejemplo n.º 6
0
        private async void Delete_OnClick(object sender, RoutedEventArgs e)
        {
            var selected = ContactsList.SelectedItem as Person;

            if (selected != null)
            {
                AddressList.Items.Clear();
                ContactsList.Items.Remove(selected);
                await _personManager.Delete(selected);

                Firstname.Clear();
                Lastname.Clear();
                Phone.Clear();
                Address.Clear();
            }
        }
Ejemplo n.º 7
0
 /**
  * Clear button to remove entries from all text boxes
  * Also sets the date back to the default in the DateTimePicker
  * Repopulates the Proof of Purchase listbox with Yes/No values
  *
  * */
 private void Clear_Click(object sender, EventArgs e)
 {
     FirstName.Clear();
     Middleinitial.Clear();
     Lastname.Clear();
     AddLine1.Clear();
     AddLine2.Clear();
     City.Clear();
     State.Clear();
     Zip.Clear();
     Email.Clear();
     Phone.Clear();
     date.Value = DateTime.Today;
     Proof.Items.Clear();
     Proof.Items.Add("Yes");
     Proof.Items.Add("No");
     StartText.Clear();
     EndText.Clear();
     modifyFlag = false;                   //Reset flag if data is cleared and can no longer be used to add modified entry
 }
        /// <summary>
        /// Admin lägger till bilmekaniker
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddMechanic_Click(object sender, RoutedEventArgs e)
        {
            if (Firstname.Text == "" || Lastname.Text == "" || DOB.SelectedDate == null)
            {
                MessageBox.Show("Fyll i alla fälten");
                return;
            }

            string   firstName = Firstname.Text;
            string   lastName  = Lastname.Text;
            DateTime dob       = DOB.DisplayDate;


            var _mechanic = _mechanicService.AddMechanic(firstName, lastName, dob);



            MessageBox.Show($"Bilmekaniker {Firstname.Text} {Lastname.Text} har lagts till");
            Firstname.Clear();
            Lastname.Clear();
        }
 private void newaccount_Click(object sender, EventArgs e)
 {
     if (Firstname.Text != "" && Lastname.Text != "" && Middlename.Text != "" && bday.Text != "" && Address.Text != "" && Phonenum.Text != "" && Jobposition.Text != "" && Emailadd.Text != "")
     {
         string         query = "Insert into quickpctbl VALUES('" + idnum.Text.Trim() + "','" + Firstname.Text.Trim() + "','" + Middlename.Text.Trim() + "','" + Lastname.Text.Trim() + "','" + bday.Text.Trim() + "','" + Address.Text.Trim() + "','" + Phonenum.Text.Trim() + "','" + Jobposition.Text.Trim() + "','" + Emailadd.Text.Trim() + "')";
         SqlDataAdapter sda   = new SqlDataAdapter(query, sqlcon);
         DataTable      dtbl  = new DataTable();
         sda.Fill(dtbl);
         MessageBox.Show("Successfuly Added!");
         idnum.Clear();
         Firstname.Clear();
         Middlename.Clear();
         Lastname.Clear();
         bday.Text = String.Empty;
         Address.Clear();
         Phonenum.Clear();
         Jobposition.Text = String.Empty;
         Emailadd.Clear();
     }
     else
     {
         MessageBox.Show("Please Input!");
     }
 }
Ejemplo n.º 10
0
        //SignUp Button
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                bool x = true;
                TheClasses.NewClient objNewClient = new TheClasses.NewClient();
                TextInfo             textInfo     = new CultureInfo("en-US", false).TextInfo;

                #region Firstname

                //objNewClient.NullCheck(Firstname);
                //Firstname.Text = Firstname.Text.ToLower();
                //objNewClient.NumberCheck(Firstname);
                //objNewClient.UnicodeCheck(Firstname, 0);
                //objNewClient.FName += objNewClient.CapitalizeFirstLetter(Firstname.Text);

                if (objNewClient.NullCheck(Firstname.Text) == false)
                {
                    Firstname.Clear();
                    throw new Exception("Please insert your '" + Firstname.Name + "' !");
                }

                if (objNewClient.NumberCheck(Firstname.Text) == false)
                {
                    Firstname.Clear();
                    throw new Exception("Please insert a correct '" + Firstname.Name + "' !");
                }

                if (objNewClient.UnicodeCheck(Firstname.Text, 0) == false)
                {
                    Firstname.Clear();
                    throw new Exception("Please insert a correct '" + Firstname.Name + "' !");
                }

                objNewClient.FName += textInfo.ToTitleCase(Firstname.Text);

                #endregion

                #region Lastname

                //objNewClient.NullCheck(Lastname);
                //Lastname.Text = Lastname.Text.ToLower();
                //objNewClient.NumberCheck(Lastname);
                //objNewClient.UnicodeCheck(Lastname, 1);

                if (objNewClient.NullCheck(Lastname.Text) == false)
                {
                    Lastname.Clear();
                    throw new Exception("Please insert your '" + Lastname.Name + "' !");
                }

                if (objNewClient.NumberCheck(Lastname.Text) == false)
                {
                    Lastname.Clear();
                    throw new Exception("Please insert a correct '" + Lastname.Name + "' !");
                }

                if (objNewClient.UnicodeCheck(Lastname.Text, 1) == false)
                {
                    Lastname.Clear();
                    throw new Exception("Please insert a correct '" + Lastname.Name + "' !");
                }

                objNewClient.LName += textInfo.ToTitleCase(Lastname.Text);

                #endregion

                #region Email

                //objNewClient.NullCheck(Email);
                //Email.Text = Email.Text.ToLower();
                //objNewClient.EmailCheck(Email);

                if (objNewClient.NullCheck(Email.Text) == false)
                {
                    Email.Clear();
                    throw new Exception("Please insert your '" + Email.Name + "' !");
                }

                if (objNewClient.EmailCheck(Email.Text) == true)
                {
                    Email.Clear();
                    throw new Exception("Please insert a correct Email! ([email protected]/@gmail.com)");
                }

                objNewClient.Email += Email.Text;

                #endregion

                #region Phone

                //objNewClient.PhoneCheck(Phone);

                if (string.IsNullOrEmpty(Phone.Text))
                {
                    x = false;
                }
                if (x == true)
                {
                    if (objNewClient.LetterCheck(Phone.Text) == false)
                    {
                        Phone.Clear();
                        throw new Exception("Please insert a correct '" + Phone.Name + "' !");
                    }

                    if (objNewClient.UnicodeCheck(Phone.Text, 0) == false)
                    {
                        Phone.Clear();
                        throw new Exception("Please insert a correct '" + Phone.Name + "' !");
                    }
                }

                objNewClient.Phone += Phone.Text;

                #endregion

                #region Username

                //objNewClient.NullCheck(Username);
                //objNewClient.UnicodeCheck(Username, 0);

                if (objNewClient.NullCheck(Username.Text) == false)
                {
                    Username.Clear();
                    throw new Exception("Please insert your '" + Username.Name + "' !");
                }

                if (objNewClient.UnicodeCheck(Username.Text, 0) == false)
                {
                    Username.Clear();
                    throw new Exception("Please insert a correct '" + Username.Name + "' !");
                }

                if (Username.Text.Contains("admin"))
                {
                    Username.Clear();
                    throw new Exception("Your Username cannot contain 'admin'!");
                }

                objNewClient.UserName += Username.Text;

                #endregion

                #region Password

                //objNewClient.NullCheck(Password);
                //objNewClient.PasswordRule(Password);

                if (objNewClient.NullCheck(Password.Text) == false)
                {
                    Password.Clear();
                    throw new Exception("Please insert your '" + Password.Name + "' !");
                }

                if ((objNewClient.PasswordRule1(Password.Text) == true) || (objNewClient.PasswordRule2(Password.Text) == true))
                {
                    Password.Clear();
                    throw new Exception("Your password must contain at least 1 uupercase " + Environment.NewLine + " and 1 special character!");
                }

                objNewClient.Password += Password.Text;

                #endregion

                if (checkBox1.Checked)
                {
                    //SQL Command
                    string _command = "INSERT INTO Customer.dbo.Customer (FirstName,LastName,Email,Phone,UserName,Password) VALUES('"
                                      + objNewClient.FName + "','"
                                      + objNewClient.LName + "','"
                                      + objNewClient.Email + "','"
                                      + objNewClient.Phone + "','"
                                      + objNewClient.UserName + "','"
                                      + objNewClient.Password + "')";

                    objNewClient.InsertReadUpdateData(_command);

                    //Using EntityFramework

                    /*using (CustomerEntities obj = new CustomerEntities())
                     * {
                     *  Customer NewCustomer = new Customer();
                     *
                     *  NewCustomer.FirstName = objNewClient.FName;
                     *  NewCustomer.LastName = objNewClient.LName;
                     *  NewCustomer.Email = objNewClient.Email;
                     *  NewCustomer.Phone = objNewClient.Phone;
                     *  NewCustomer.UserName = objNewClient.UserName;
                     *  NewCustomer.Password = objNewClient.Password;
                     *  obj.Customers.Add(NewCustomer);
                     *  obj.SaveChanges();
                     * }*/

                    MessageBox.Show("You have succesfuly created an account!");
                    this.Close();
                    originalForm.enabledisable(1);
                }

                else
                {
                    Password.Clear();
                    throw new Exception("You didn't Agree the Terms of service!");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }