コード例 #1
0
 private void ButtonRegister_Click(object sender, RoutedEventArgs e)
 {
     if (!Regex.IsMatch(TextEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"))
     {
         MessageBox.Show("Please enter a valid Email address", "Invalid Email", MessageBoxButton.OK, MessageBoxImage.Error);
         TextEmail.Select(0, TextEmail.Text.Length);
         TextEmail.Focus();
         TextEmail.Text = string.Empty;
     }
     else if (_stuManager.CheckDuplicateRecords(TextEmail.Text))
     {
         MessageBox.Show("Already registered email address, Please use a new address", "Duplicate Email", MessageBoxButton.OK, MessageBoxImage.Error);
         TextEmail.Select(0, TextEmail.Text.Length);
         TextEmail.Focus();
     }
     else
     {
         _stuManager.Create(TextFirstName.Text, TextLastName.Text, TextEmail.Text);
         MessageBox.Show($"Congratulations {TextFirstName.Text}!\n" +
                         $"Your Student ID is: {_stuManager.SelectedStudent.StudentID}");
         TextFirstName.Text = string.Empty;
         TextLastName.Text  = string.Empty;
         TextEmail.Text     = string.Empty;
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Steffen70/AutoverleihDotNet5
 private void BtnUserAdd_Click(object sender, EventArgs e)
 {
     Person p = new Person(TextName.Text, TextVorname.Text, TextEmail.Text);
     TextName.Clear();
     TextVorname.Clear();
     TextVorname.Clear();
     TextEmail.Clear();
     xmldata.persons.Add(p);
     personBindingSource.Add(p);
 }
コード例 #3
0
 private void Abrir_Limpiar(object sender, RoutedEventArgs e)
 {
     TextBoxCodigo.Clear();
     TextBoxNombre.Clear();
     TextBoxID.Text = "";
     TextContrato.Clear();
     TextTelefono.Clear();
     TextEmail.Clear();
     TextEmpre.Clear();
     TextAgente.Clear();
 }
コード例 #4
0
 public void Clear()
 {
     TextUsuario.Clear();
     TextSenha.Clear();
     TextConfirma.Clear();
     TextNome.Clear();
     TextTelefone.Clear();
     TextCEP.Clear();
     labVerifica.Content = "Status:";
     TextEmail.Clear();
     Data.SelectedDate = DateTime.Now;
     TextCnpj.Clear();
 }
コード例 #5
0
 public void Clear()
 {
     TextUsuario.Clear();
     TextPassSenha.Clear();
     TextPassConfirma.Clear();
     TextNome.Clear();
     TextTelefone.Clear();
     TextCEP.Clear();
     labVerifica.Content = "Status:";
     TextEmail.Clear();
     Data.SelectedDate = DateTime.Now;
     RadioM.IsChecked  = true;
     RadioF.IsChecked  = false;
 }
コード例 #6
0
        // 确定按钮
        private void Ok_Click(object sender, EventArgs e)
        {
            string username  = TextAccount.Text.Trim();
            string password  = TextPasswd.Text.Trim();
            string sex       = TextSex.Text.Trim();
            string birthday  = TextBirthday.Text.Trim();
            string telephone = TextPhone.Text.Trim();
            string email     = TextEmail.Text.Trim();

            String2NULL(ref username);
            String2NULL(ref password);
            String2NULL(ref sex);
            String2NULL(ref birthday);
            String2NULL(ref telephone);
            String2NULL(ref email);

            #region 查询数据库当前账号是否被注册过
            sqlCon.Open();

            string         sql_cmd = String.Format("select * from [user] where username={0}", username);
            SqlDataAdapter sda     = new SqlDataAdapter(sql_cmd, sqlCon);
            DataSet        ds      = new DataSet();
            sda.Fill(ds);

            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("当前账户名已被使用,请重新输入!");
            }
            else
            {
                sql_cmd = String.Format("insert into [user] values({0},{1},{2},{3},{4},{5},0,0,NULL,NULL)",
                                        username, password, sex, birthday, telephone, email);
                SqlCommand SqlCmd = new SqlCommand(sql_cmd, sqlCon);
                SqlCmd.ExecuteNonQuery();
                MessageBox.Show("账号创建成功!");
            }
            TextAccount.Clear();
            TextPasswd.Clear();
            TextSex.Clear();
            TextBirthday.Clear();
            TextPhone.Clear();
            TextEmail.Clear();
            TextAccount.Focus();

            sqlCon.Close();
            #endregion
        }
コード例 #7
0
 void ReleaseDesignerOutlets()
 {
     if (ButtonAddEvent != null)
     {
         ButtonAddEvent.Dispose();
         ButtonAddEvent = null;
     }
     if (ButtonCall != null)
     {
         ButtonCall.Dispose();
         ButtonCall = null;
     }
     if (ButtonEmail != null)
     {
         ButtonEmail.Dispose();
         ButtonEmail = null;
     }
     if (ImagePhoto != null)
     {
         ImagePhoto.Dispose();
         ImagePhoto = null;
     }
     if (TextEmail != null)
     {
         TextEmail.Dispose();
         TextEmail = null;
     }
     if (TextFirst != null)
     {
         TextFirst.Dispose();
         TextFirst = null;
     }
     if (TextLast != null)
     {
         TextLast.Dispose();
         TextLast = null;
     }
     if (TextPhone != null)
     {
         TextPhone.Dispose();
         TextPhone = null;
     }
 }
コード例 #8
0
        public AddressPageObject fillForm(string clientType, string promoCode, string name, string email, string birthDate, string gender, string maritalStatus)
        {
            TextName.SendKeys(name);
            TextEmail.SendKeys(email);

            if (clientType == "Person")
            {
                RadioClientType.FindElement(By.XPath("//label[text()=" + "'" + clientType + "']")).Click();
                TextPromoCode.SendKeys(promoCode);
                TextBirthDate.SendKeys(birthDate);
                SelectGender.SendKeys(gender);
                SelectGender.FindElement(By.XPath("//select/option[text()=" + "'" + maritalStatus + "'" + "]")).Click();
                BtnNext.Click();
                return(new AddressPageObject(driver));
            }
            RadioClientType.FindElement(By.XPath("//label[text()=" + "'" + clientType + "']")).Click();
            TextPromoCode.SendKeys(promoCode);
            BtnNext.Click();
            return(new AddressPageObject(driver));
        }
コード例 #9
0
 private void btnSignIn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TextEmail.Text) || string.IsNullOrEmpty(TextPassword.Text))
     {
         MetroFramework.MetroMessageBox.Show(this, "All field should be filled up.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         TextEmail.Focus();
         return;
     }
     else
     {
         var user = UserServices.LogIn(TextEmail.Text, TextPassword.Text);
         if (user != null)
         {
             if (user.type == "admin")
             {
                 StarterForm.isAdmin      = true;
                 StarterForm.loggedStatus = true;
                 StarterForm.loggedInUser = user;
                 if (BookStoreEvent != null)
                 {
                     BookStoreEvent();
                     UserInfoShowEvent(user);
                 }
             }
             else
             {
                 StarterForm.loggedStatus = true;
                 StarterForm.loggedInUser = user;
                 UserInfoShowEvent(user);
             }
             this.Hide();
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(this, "Wrong Email or Password.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             TextEmail.Focus();
             return;
         }
     }
 }
コード例 #10
0
 public void preencherEmail(String email)
 {
     TextEmail.SendKeys(email);
 }
コード例 #11
0
ファイル: Doctor.cs プロジェクト: Alexisson/emedicine
        private void CreateNewDoctor(object sender, EventArgs e)
        {
            Messages msg = new Messages();

            if (TextLastName.Text == "")
            {
                msg.DataError("Введите фамилию!");
                TextLastName.Focus();
            }
            else if (TextFirstName.Text == "")
            {
                msg.DataError("Введите имя!");
                TextFirstName.Focus();
            }
            else if (TextIIN.Text.Length != 12)
            {
                msg.DataError("Введите корректный ИИН!");
                TextIIN.Focus();
            }
            else if (TextEmail.Text == "")
            {
                msg.DataError("Введите адрес электронной почты!");
                TextEmail.Focus();
            }
            else if (TextPhone.Text == "")
            {
                msg.DataError("Введите номер телефона!");
                TextPhone.Focus();
            }
            else if (TextPassword.Text == "")
            {
                msg.DataError("Введите пароль!");
                TextPassword.Focus();
            }
            else if (TextPassword.Text != TextRepPassword.Text)
            {
                msg.DataError("Пароли не совпадают!");
                TextPassword.Focus();
            }
            else if (CBSetSpec.Text == "")
            {
                msg.DataError("Выберите специализацию!");
                CBSetSpec.Focus();
            }
            else
            {
                conn.Open();
                sql = "SELECT COUNT(*) FROM DOCTOR WHERE DOC_EMAIL = '" + TextEmail.Text + "'";
                MySqlCommand checkEmail = new MySqlCommand(sql, conn);
                COUNT = Convert.ToInt32(checkEmail.ExecuteScalar());
                if (COUNT == 0)
                {
                    sql = "SELECT COUNT(*) FROM DOCTOR WHERE DOC_IIN = '" + TextIIN.Text + "'";
                    MySqlCommand checkIIN = new MySqlCommand(sql, conn);
                    COUNT = Convert.ToInt32(checkIIN.ExecuteScalar());
                    if (COUNT == 0)
                    {
                        sql = "INSERT INTO DOCTOR (DOC_LASTNAME, " +
                              "DOC_FIRSTNAME, " +
                              "DOC_PATRONYMIC, " +
                              "DOC_IIN, " +
                              "DOC_EMAIL, " +
                              "DOC_PHONE, " +
                              "DOC_PASSWORD, " +
                              "SPECIALISATION_ID_SPEC) " +
                              "VALUES ('" + TextLastName.Text + "', " +
                              "'" + TextFirstName.Text + "', " +
                              "'" + TextPatronymic.Text + "', " +
                              "'" + TextIIN.Text + "', " +
                              "'" + TextEmail.Text + "', " +
                              "'" + TextPhone.Text + "', " +
                              "'" + TextPassword.Text + "', " +
                              "" + idspec + ")";
                        MySqlCommand insdoc = new MySqlCommand(sql, conn);
                        if (insdoc.ExecuteNonQuery() == 1)
                        {
                            msg.WriteSuccess();
                            this.Close();
                            AdminMainForm amf = new AdminMainForm();
                            amf.Show();
                            conn.Close();
                        }
                        else
                        {
                            msg.WriteError();
                            conn.Close();
                        }
                    }
                    else
                    {
                        msg.DataError("ИИН уже существует в системе!");
                        conn.Close();
                    }
                }
                else
                {
                    msg.DataError("Электронный адрес уже существует в системе!");
                    conn.Close();
                }
            }
        }
コード例 #12
0
 public void Login(string email, string password)
 {
     TextEmail.SendKeys(email);
     TextPassword.SendKeys(password);
     ButtonLogin.Click();
 }
コード例 #13
0
ファイル: Person.cs プロジェクト: Alexisson/emedicine
        private void CreateNewPerson(object sender, EventArgs e)
        {
            Messages msg = new Messages();

            if (TextLastName.Text == "")
            {
                msg.DataError("Введите фамилию!");
                TextLastName.Focus();
            }
            else if (TextFirstName.Text == "")
            {
                msg.DataError("Введите имя!");
                TextFirstName.Focus();
            }
            else if (SexSet.Text == "")
            {
                msg.DataError("Выберите пол!");
                SexSet.Focus();
            }
            else if (TextIIN.Text.Length != 12)
            {
                msg.DataError("Введите корректный ИИН!");
                TextIIN.Focus();
            }
            else if (TextEmail.Text == "")
            {
                msg.DataError("Введите адрес электронной почты!");
                TextEmail.Focus();
            }
            else if (TextPhone.Text == "")
            {
                msg.DataError("Введите номер телефона!");
                TextPhone.Focus();
            }
            else if (TextPassword.Text == "")
            {
                msg.DataError("Введите пароль!");
                TextPassword.Focus();
            }
            else if (TextPassword.Text != TextRepPassword.Text)
            {
                msg.DataError("Пароли не совпадают!");
                TextPassword.Focus();
            }
            else
            {
                conn.Open();
                sqlins = "INSERT INTO PERSON (PERSON_LASTNAME, " +
                         "PERSON_FIRSTNAME, " +
                         "PERSON_PATRONYMIC, " +
                         "PERSON_BIRTHDAY, " +
                         "PERSON_IIN, " +
                         "PERSON_PASSWORD, " +
                         "PERSON_EMAIL, " +
                         "PERSON_SEX, " +
                         "PERSON_PHONE) " +
                         "VALUES ('" + TextLastName.Text + "', " +
                         "'" + TextFirstName.Text + "', " +
                         "'" + TextPatronymic.Text + "', " +
                         "'" + this.BirthdaySet.Text + "', " +
                         "'" + TextIIN.Text + "', " +
                         "'" + TextPassword.Text + "', " +
                         "'" + TextEmail.Text + "', " +
                         "'" + SexSet.Text + "'," +
                         "'" + TextPhone.Text + "')";

                sql = "SELECT COUNT(*) FROM PERSON WHERE PERSON_EMAIL = '" + TextEmail.Text + "'";
                MySqlCommand checkEmail = new MySqlCommand(sql, conn);
                COUNT = Convert.ToInt32(checkEmail.ExecuteScalar());
                if (COUNT == 0)
                {
                    sql = "SELECT COUNT(*) FROM PERSON WHERE PERSON_IIN = '" + TextIIN.Text + "'";
                    MySqlCommand checkIIN = new MySqlCommand(sql, conn);
                    COUNT = Convert.ToInt32(checkIIN.ExecuteScalar());
                    if (COUNT == 0)
                    {
                        MySqlCommand cmd = new MySqlCommand(sqlins, conn);
                        if (cmd.ExecuteNonQuery() == 1)
                        {
                            msg.WriteSuccess();
                            this.Close();
                            AdminMainForm amf = new AdminMainForm();
                            amf.Show();
                            conn.Close();
                        }
                        else
                        {
                            msg.WriteError();
                            conn.Close();
                        }
                    }
                    else
                    {
                        msg.DataError("Номер документа уже существует в системе!");
                        conn.Close();
                        COUNT = 0;
                    }
                }
            }
        }