Beispiel #1
0
        // Checking the values that come from textbox
        private bool FormValidation()
        {
            bool hasError = false;
            bool success  = int.TryParse(TxtPhoneNumber.Text, out _);

            if (string.IsNullOrEmpty(TxtEmail.Text) || string.IsNullOrEmpty(TxtPassword.Text) || string.IsNullOrEmpty(TxtName.Text) || string.IsNullOrEmpty(TxtSurname.Text) || string.IsNullOrEmpty(TxtPhoneNumber.Text))
            {
                MessageBox.Show("Zəhmət olmasa bütün xanaları doldurun");
                hasError = true;
            }
            else if (!Regex.IsMatch(TxtEmail.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("E-poçt ünvani düzgün yazın");
                TxtEmail.Select(0, TxtEmail.Text.Length);
                TxtEmail.Focus();
                hasError = true;
            }
            else if (!success)
            {
                MessageBox.Show("Nömrəni düzgün daxil edin");
                TxtPhoneNumber.Select(0, TxtPhoneNumber.Text.Length);
                TxtPhoneNumber.Focus();
                hasError = true;
            }

            return(hasError);
        }
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            string email = TxtEmail.Text;
            string pass  = TxtPassword.Password;

            var data = myContext.User.Where(d => d.Email == email).SingleOrDefault();

            if (email == null)
            {
                TxtEmail.BorderBrush = Brushes.Red;
                TxtEmail.Focus();
            }
            if (pass == null)
            {
                TxtPassword.BorderBrush = Brushes.Red;
                TxtPassword.Focus();
            }
            if (data != null)
            {
                MessageBox.Show("Login Successful");
                MainWindow dboard = new MainWindow();
                dboard.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Login Unsuccessful! Re-entry your input");
                TxtEmail.Text        = "";
                TxtPassword.Password = "";
            }
        }
Beispiel #3
0
 public void CleanControls()
 {
     TxtEmail.Text    = string.Empty;
     TxtPassword.Text = string.Empty;
     TxtName.Text     = string.Empty;
     TxtEmail.Focus();
 }
Beispiel #4
0
        private bool CheckLogin()
        {
            bool isTrue = false;

            var userLogin = loginRepository.GetAllUser();

            foreach (var item in userLogin)
            {
                isTrue = TxtEmail.Text == item.TenDangNhap && TxtPassword.Text == item.MatKhau;
                if (isTrue)
                {
                    isTrue = true;
                    break;
                }
            }

            if (isTrue == true)
            {
                return(true);
            }
            else
            {
                lblError.Text = "Thông tin đăng nhập bị sai. Vui lòng kiểm tra lại.";
                TxtEmail.SelectAll();
                TxtEmail.Focus();

                return(false);
            }
        }
Beispiel #5
0
 private void BtnSendEmail_Click(object sender, RoutedEventArgs e)
 {
     if (TxtEmailForget.Text == "")
     {
         MessageBox.Show("Please, fill column email please", "Alert", MessageBoxButton.OK);
         TxtEmail.Focus();
     }
     else
     {
         try
         {
             var    userid   = myContext.Users.FirstOrDefault(u => u.Email == TxtEmailForget.Text);
             string password = Guid.NewGuid().ToString();
             userid.ChangePassword = userid.Password;
             userid.Password       = password;
             myContext.SaveChanges();
             Outlook._Application _app = new Outlook.Application();
             Outlook.MailItem     mail = (Outlook.MailItem)_app.CreateItem(Outlook.OlItemType.olMailItem);
             //sesuaikan dengan content yang di xaml
             mail.To      = TxtEmailForget.Text;
             mail.Subject = "Forgotten Password";
             mail.Body    = "Hi, " + userid.Name + "." +
                            "This is your new password: "******"Message has been sent. Check your email now.", "Message", MessageBoxButton.OK);
             GridForgot.Visibility = Visibility.Hidden;
             GridLogin.Visibility  = Visibility.Visible;
         }
         catch (Exception x)
         {
             MessageBox.Show(x.Message);
         }
     }
 }
Beispiel #6
0
 protected void TxtEmail_TextChanged(object sender, EventArgs e)
 {
     if (Customer.LoginExists(TxtEmail.Text.ToLower()) == true)
     {
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Error", " alert('Sorry, a customer with this email address already exists.');", true);
         TxtEmail.Focus();
     }
 }
Beispiel #7
0
 private void FrmLogin_Load(object sender, EventArgs e)
 {
     ShowCloseFormWaitSplash.ShowSplashForm();
     Thread.Sleep(1500);
     ShowCloseFormWaitSplash.CloseSplashForm();
     lblError.Text = string.Empty;
     TxtEmail.Focus();
 }
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            DataAccess       ob  = new DataAccess();
            UserRegistration obj = new UserRegistration();

            obj.UserName = TxtUserName.Text;
            obj.PhoneNo  = TxtPhoneNo.Text;
            obj.EmailId  = TxtEmail.Text;
            obj.CSP1     = Convert.ToInt32(DropdownPrimary.SelectedValue);
            obj.CSP2     = Convert.ToInt32(DropDownSecondary.SelectedValue);

            //SqlConnection con = new SqlConnection("Data Source=192.168.0.18;initial catalog=DNADB;user id = sa; password=vss;");
            //con.Open();
            //SqlCommand cmd = new SqlCommand("insert into tbl_UserRegistration ( UserName, PhoneNo, EmailId, CSP1, CSP2) values ('" + TxtUserName.Text + "','" + TxtPhoneNo.Text + "','" + TxtEmail.Text + "'," + DropdownPrimary.SelectedValue + "," + DropDownSecondary.SelectedValue + ")", con);
            //if (cmd.ExecuteNonQuery() == 1)
            //{
            //    lblres.Text = "Registration Success";
            //    lblres.CssClass = "alert alert-success";
            //    return;
            //}
            //con.Close();


            if (ob.CheckUserNameAvailable(obj))
            {
                if (ServerInformationandInsert())
                {
                    if (ob.AddUserRegistration(obj))
                    {
                        string value = "Dear " + TxtUserName.Text + ",</br></br> Thank you for registering in multi cloud.";
                        ob.SendMail(TxtEmail.Text, value, "Greeting from Cloud");
                        lblres.Text     = "Registration Success";
                        lblres.CssClass = "alert alert-success";
                        clear();
                        TxtUserName.Focus();
                    }
                    else
                    {
                        lblres.Text     = "Registration not done";
                        lblres.CssClass = "alert alert-danger";
                    }
                }
                else
                {
                    lblres.Text     = "Server not available";
                    lblres.CssClass = "alert alert-danger";
                }
            }
            else
            {
                lblres.Text     = "Email Address already exists";
                lblres.CssClass = "alert alert-danger";
                TxtEmail.Focus();
            }
        }
Beispiel #9
0
 private Boolean ValidarCampos()
 {
     if (TxtPNome.Text == "")
     {
         Error.SendError("O campo primeiro nome tem preenchimento obrigatório", "Campo vazio");
         TxtPNome.Focus();
         return(false);
     }
     else if (TxtSNome.Text == "")
     {
         Error.SendError("O campo sobrenome tem preenchimento obrigatório", "Campo vazio");
         TxtSNome.Focus();
         return(false);
     }
     else if (TxtUserName.Text == "")
     {
         Error.SendError("O campo nome de usuário tem preenchimento obrigatório", "Campo vazio");
         TxtUserName.Focus();
         return(false);
     }
     else if (TxtEmail.Text == "")
     {
         Error.SendError("O campo email tem preenchimento obrigatório", "Campo vazio");
         TxtEmail.Focus();
         return(false);
     }
     else if (TxtCargo.Text == "")
     {
         Error.SendError("O campo cargo tem preenchimento obrigatório", "Campo vazio");
         TxtCargo.Focus();
         return(false);
     }
     else if (TxtSenha.Text == "")
     {
         Error.SendError("O campo senha tem preenchimento obrigatório", "Campo vazio");
         TxtSenha.Focus();
         return(false);
     }
     else if (TxtRSenha.Text == "")
     {
         Error.SendError("O campo de repetição de senha tem preenchimento obrigatório", "Campo vazio");
         TxtRSenha.Focus();
         return(false);
     }
     else if (TxtSenha.Text != TxtRSenha.Text)
     {
         Error.SendError("As senhas devem ser iguais", "Senhas diferentes");
         TxtSenha.Focus();
         return(false);
     }
     else
     {
         return(true);
     }
 }
Beispiel #10
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (TxtEmail.Text.Length == 0)
     {
         errormessage.Text = "Enter an email.";
         TxtEmail.Focus();
     }
     else if (!Regex.IsMatch(TxtEmail.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]$"))
     {
         errormessage.Text = "Enter a valid email.";
         TxtEmail.Select(0, TxtEmail.Text.Length);
         TxtEmail.Focus();
     }
     else
     {
         string firstname = TxtName.Text;
         string lastname  = TxtSurname.Text;
         string email     = TxtEmail.Text;
         string password  = Password.Password;
         if (Password.Password.Length == 0)
         {
             errormessage.Text = "Enter password.";
             Password.Focus();
         }
         else if (PasswordRecover.Password.Length == 0)
         {
             errormessage.Text = "Enter Confirm password.";
             PasswordRecover.Focus();
         }
         else if (Password.Password != PasswordRecover.Password)
         {
             errormessage.Text = "Confirm password must be same as password.";
             PasswordRecover.Focus();
         }
         else
         {
             var user = new User
             {
                 Email       = email,
                 Password    = password,
                 CreatedDate = DateTime.Now,
                 Name        = firstname,
                 Surname     = lastname,
                 UpdatedDate = DateTime.Now
             };
             errormessage.Text = "";
             dbContext.Users.Add(user);
             dbContext.SaveChanges();
             MainWindow mainWindow = new MainWindow();
             mainWindow.Show();
             Close();
         }
     }
 }
Beispiel #11
0
        // private void BtnSair_Click(object sender, EventArgs e)
        //  {
        //   if ((TxtSenha.Text !="") && (TxtEmail.Text!=""))
        //  {
        //      Close();
        //   }
        //   }

        private void TxtNome_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                if (TxtNome.Text != "")
                {
                    Variaveis.nome   = TxtNome.Text;
                    TxtEmail.Enabled = true;
                    TxtEmail.Focus();
                }
            }
        }
Beispiel #12
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            var email    = TxtEmail.Text;
            var password = PwdPassword.Password;

            if (email.Length < 7 || password.Length < 7)
            {
                MessageBox.Show("Bad username and password.", "Login Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                TxtEmail.Text        = "";
                PwdPassword.Password = "";
                TxtEmail.Focus();
                return;
            }

            try
            {
                _user = _userManager.AuthenticateUser(email, password);

                string roles = "";
                for (int i = 0; i < _user.Roles.Count; i++)
                {
                    roles += _user.Roles[i];
                    if (i < _user.Roles.Count - 1)
                    {
                        roles += ", ";
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Bad username and password.", "Login Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                TxtEmail.Text        = "";
                PwdPassword.Password = "";
                TxtEmail.Focus();
                return;
            }
            if (_user != null)
            {
                if (password == "newuser")
                {
                    var updatePassword = new FrmFirstTimeUpdatePassword(_user, _userManager);
                    if (updatePassword.ShowDialog() == false)
                    {
                        return;
                    }
                }
                MainPage main = new MainPage(_user);
                this.NavigationService.Navigate(main);
            }
        }
 protected void BtnRegister_Click(object sender, EventArgs e)
 {
     if (this.IsValid == true)
     {
         if (Person.GetPersonRecords("EmailId='" + TxtEmail.Text + "' and Role='JobSeeker'").Rows.Count > 0)
         {
             LblDuplicateEmail.Visible = true;
             TxtEmail.Focus();
             return;
         }
         int NewJobSeeker = Person.AddPerson(int.Parse(DdlTitle.SelectedValue), TxtFirstName.Text, TxtLastName.Text, TxtEmail.Text, TxtConfirmPassword.Text, "JobSeeker", "Active", ChkEnableEmail.Checked);
         FormsAuthentication.RedirectFromLoginPage(NewJobSeeker.ToString(), false);
     }
 }
Beispiel #14
0
 private void BtnParse_Click(object sender, EventArgs e)
 {
     if (TxtEmail.Text.Contains('@'))
     {
         string email = TxtEmail.Text.Trim();
         ParseEmail(email);
         MessageBox.Show("username: "******"\ndomain: " + domain);
     }
     else
     {
         MessageBox.Show("Please enter a valid email address.");
         TxtEmail.Clear();
         TxtEmail.Focus();
     }
 }
 private void BtnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (TxtName.Text == "")
     {
         MessageBox.Show("Name is Required", "Caution", MessageBoxButton.OK);
         TxtName.Focus();
     }
     else if (TxtEmail.Text == "")
     {
         MessageBox.Show("Email is Required", "Caution", MessageBoxButton.OK);
         TxtEmail.Focus();
     }
     else
     {
         var Cekemail = myContext.Suppliers.FirstOrDefault(s => s.Email == TxtEmail.Text);
         if (Cekemail == null)
         {
             var push = new Supplier(TxtName.Text, TxtEmail.Text);
             myContext.Suppliers.Add(push);
             var result = myContext.SaveChanges();
             if (result > 0)
             {
                 MessageBox.Show(result + " row has been inserted.");
             }
             GridSupplier.ItemsSource = myContext.Suppliers.ToList();
             ComboSupp.ItemsSource    = myContext.Suppliers.ToList();
             try
             {
                 //Outlook._Application _app = new Outlook.Application();
                 //Outlook.MailItem mail = (Outlook.MailItem)_app.CreateItem(Outlook.OlItemType.olMailItem);
                 //mail.To = TxtEmail.Text;
                 //mail.Body = TxtName + " Data anda sudah masuk ke database";
                 //mail.Importance = Outlook.OlImportance.olImportanceNormal;
                 //((Outlook._MailItem)mail).Send();
                 //MessageBox.Show("Your email has been send", "Message", MessageBoxButton.OK);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK);
             }
         }
         else
         {
             MessageBox.Show("This email has been used!");
         }
     }
 }
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            var res = myContext.Suppliers.FirstOrDefault(dataInMail => dataInMail.Email == TxtEmail.Text);

            if (TxtName.Text == "")
            {
                MessageBox.Show("Fill column name please", "Alert", MessageBoxButton.OK);
                TxtName.Focus();
            }
            else if (TxtEmail.Text == "")
            {
                MessageBox.Show("Fill column email please", "Alert", MessageBoxButton.OK);
                TxtEmail.Focus();
            }
            else if (res != null)
            {
                MessageBox.Show("This email already registered", "Alert", MessageBoxButton.OK);
                TxtEmail.Focus();
            }
            else
            {
                var push = new Supplier(TxtName.Text, TxtEmail.Text);
                myContext.Suppliers.Add(push);
                var result = myContext.SaveChanges();
                if (result > 0)
                {
                    try
                    {
                        //Outlook._Application _app = new Outlook.Application();
                        //Outlook.MailItem mail = (Outlook.MailItem)_app.CreateItem(Outlook.OlItemType.olMailItem);
                        ////sesuaikan dengan content yang di xaml
                        //mail.To = TxtEmail.Text;
                        //mail.Subject = "Bootcamp 32";
                        //mail.Body = "Congratulations, " + TxtName.Text + " has been success";
                        //mail.Importance = Outlook.OlImportance.olImportanceNormal;
                        //((Outlook._MailItem)mail).Send();
                        Load();
                        MessageBox.Show("Message has been sent.", "Message", MessageBoxButton.OK);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK);
                    }
                }
            }
        }
        private bool Validate()
        {
            if (string.IsNullOrEmpty(TxtUsername.Text))
            {
                DisplayAlert("Error", "Debe ingresar un nombre de usuario", "Aceptar");
                TxtUsername.Focus();
                return(false);
            }
            else if (string.IsNullOrEmpty(TxtEmail.Text))
            {
                DisplayAlert("Error", "Debe ingresar un Correo Válido", "Aceptar");
                TxtEmail.Focus();
                return(false);
            }
            else if (string.IsNullOrEmpty(TxtPass.Text))
            {
                DisplayAlert("Error", "Debe ingresar una Contraseña", "Aceptar");
                TxtPass.Focus();
                return(false);
            }
            else if (TxtPass.Text != TxtPassC.Text)
            {
                DisplayAlert("Error", "Las contraseñas no coinciden", "Aceptar");
                TxtPass.Focus();
                return(false);
            }
            try
            {
                MailAddress m = new MailAddress(TxtEmail.Text);
            }
            catch (FormatException)
            {
                DisplayAlert("Alerta", "Correo electrónico inválido", "Ok");
                return(false);
            }
            Regex rgx = new Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,15}$");

            if (!rgx.IsMatch(TxtPass.Text))
            {
                DisplayAlert("Error", "La contraseña debe contener de 8-15 caracteres; al menos 1 Mayúscula, Minúscula, Digito y Caracter especial", "OK");
                return(false);
            }


            return(true);
        }
        private void BtnSignIn_Click(object sender, RoutedEventArgs e)
        {
            //Admin login
            if (TxtEmail.Text == "admin" && TxtPassword.Password == "12345")
            {
                AdminPanel adminPanel = new AdminPanel();
                adminPanel.ShowDialog();
                TxtEmail.Clear();
                TxtPassword.Clear();
                return;
            }

            //Manager login Database
            if (string.IsNullOrEmpty(TxtEmail.Text))
            {
                MessageBox.Show("E-poçt ünvani boş ola bilməz");
                return;
            }
            else if (!Regex.IsMatch(TxtEmail.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("E-poçt ünvani düzgün yazın");
                TxtEmail.Select(0, TxtEmail.Text.Length);
                TxtEmail.Focus();
                return;
            }
            else if (string.IsNullOrEmpty(TxtPassword.Password))
            {
                MessageBox.Show("Şifrə boş ola bilməz");
                return;
            }

            var modelEmail = _libraryContext.Managers.FirstOrDefault(m => m.Email == TxtEmail.Text);


            if (modelEmail == null || modelEmail.Password != TxtPassword.Password)
            {
                MessageBox.Show("E-poçt ünvani və ya Şifrə yanlışdır");
                return;
            }
            else
            {
                DashboardWindow dashboard = new DashboardWindow();
                dashboard.Show();
                this.Close();
            }
        }
        protected void BtnREsetPass_Click(object sender, EventArgs e)
        {
            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyWebsiteDB"].ConnectionString))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("SELECT * FROM Tbl_Users WHERE Email=@Email", con);
                cmd.Parameters.AddWithValue("@Email", TxtEmail.Text);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count != 0)
                {
                    string     mGUID = Guid.NewGuid().ToString();
                    int        Uid   = Convert.ToInt32(dt.Rows[0][0]);
                    SqlCommand cmd1  = new SqlCommand("Insert into ForgotPass(Id,Uid,RequestDateTime) values('" + mGUID + "','" + Uid + "',GETDATE())", con);
                    cmd1.ExecuteNonQuery();
                    String ToEmailAddress = dt.Rows[0][3].ToString();
                    String Username       = dt.Rows[0][1].ToString();
                    String EmailBody      = "Hi ," + Username + ",<br/><br/>Click the link below to reset your password<br/> <br/> https://localhost:44304/NewPassword.aspx?Id=" + mGUID;
                    try
                    {
                        SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                        client.EnableSsl             = true;
                        client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                        client.UseDefaultCredentials = false;
                        client.Credentials           = new NetworkCredential("*****@*****.**", "20022019Hatice.1");
                        MailMessage PassMail = new MailMessage("*****@*****.**", ToEmailAddress);

                        PassMail.Subject = "şifre sıfırlama";
                        PassMail.Body    = EmailBody;
                        client.Send(PassMail);
                        LblResetPassMsg.Text      = "Link Başarılı Şekilde MAil Adresinize Gönderildi";
                        LblResetPassMsg.ForeColor = System.Drawing.Color.Green;
                        TxtEmail.Text             = string.Empty;
                    }
                    catch (Exception ex)
                    {
                        Response.Write("Link Gönderilemedi" + ex.Message);
                        TxtEmail.Text = string.Empty;
                        TxtEmail.Focus();
                    }
                }
            }
        }
Beispiel #20
0
        private void checkValues()
        {
            bool emailCheck = checkValiditEmail(TxtEmail.Text);

            if (emailCheck == false)
            {
                TxtEmail.Focus();
                showErrorMwssage(3010);
                return;
            }
            if (TxtPhone.Text.Length < 9 || TxtPhone.Text.Length > 11)
            {
                TxtPhone.Focus();
                showErrorMwssage(3011);
                return;
            }
            string m_PERID = TxtId.Text;

            char[] digits   = m_PERID.PadLeft(9, '0').ToCharArray();
            int[]  oneTwo   = { 1, 2, 1, 2, 1, 2, 1, 2, 1 };
            int[]  multiply = new int[9];
            int[]  oneDigit = new int[9];
            for (int i = 0; i < 9; i++)
            {
                multiply[i] = Convert.ToInt32(digits[i].ToString()) * oneTwo[i];
            }
            for (int i = 0; i < 9; i++)
            {
                oneDigit[i] = (int)(multiply[i] / 10) + multiply[i] % 10;
            }
            int sum = 0;

            for (int i = 0; i < 9; i++)
            {
                sum += oneDigit[i];
            }
            if (sum % 10 != 0)
            {
                showErrorMwssage(3012);
                TxtId.Focus();
                return;
            }
        }
Beispiel #21
0
 protected void BtnRegister_Click(object sender, EventArgs e)
 {
     if (this.IsValid == true)
     {
         if (Recruiter.GetRecruiterRecords("EmailId='" + TxtEmail.Text + "'").Rows.Count > 0)
         {
             LblDuplicateEmail.Visible = true;
             TxtEmail.Focus();
             return;
         }
         int NewRecruiter = Recruiter.AddRecruiter(int.Parse(DdlCompany.SelectedValue), int.Parse(DdlTitle.SelectedValue), TxtFirstName.Text, TxtLastName.Text, TxtEmail.Text, "Active");
         Recruiter_Login.AddRecruiter_Login(NewRecruiter, TxtPassword.Text, "Recruiter");
         //FormsAuthentication.RedirectFromLoginPage(NewRecruiter.ToString(), false);
         HttpCookie RecruiterInfo = Request.Cookies["LoginInfo"];
         RecruiterInfo["Role"] = "Recruiter";
         Response.Cookies.Set(RecruiterInfo);
         Response.Redirect("../Login/RecruiterLogin.aspx");
     }
 }
Beispiel #22
0
 protected void BtnRegister_Click(object sender, EventArgs e)
 {
     if (this.IsValid == true)
     {
         if (JobSeeker.GetJobSeekerRecords("EmailId='" + TxtEmail.Text + "'").Rows.Count > 0)
         {
             LblDuplicateEmail.Visible = true;
             TxtEmail.Focus();
             return;
         }
         int NewJobSeeker = JobSeeker.AddJobSeeker(int.Parse(DdlTitle.SelectedValue), TxtFirstName.Text, TxtLastName.Text, TxtEmail.Text, "Active");
         JobSeeker_Login.AddJobSeeker_Login(NewJobSeeker, TxtPassword.Text, "JobSeeker");
         HttpCookie JobSeekerInfo = new HttpCookie("JobSeekerInfo");
         JobSeekerInfo["Role"] = "JobSeeker";
         JobSeekerInfo.Expires = DateTime.Today.AddHours(12);
         Response.Cookies.Add(JobSeekerInfo);
         FormsAuthentication.RedirectFromLoginPage(NewJobSeeker.ToString(), false);
     }
 }
Beispiel #23
0
 private void BtnRemoveNode_Click(object sender, EventArgs e)
 {
     try
     {
         CheckTxtBox(TxtEmail.Text, TxtEmail);
         aNode.Remove(TxtEmail.Text);
         RefreshListbox();
         ClearInputFields();
     }
     catch (FormatException ex)
     {
         MessageBox.Show($"{ex.Message.ToString()}", "Indtastnings fejl", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     catch (NullReferenceException ex)
     {
         MessageBox.Show(ex.Message, "Prøv igen", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         TxtEmail.SelectAll();
         TxtEmail.Focus();
     }
 }
Beispiel #24
0
 private void BtnRecuperarLogin_Click(object sender, EventArgs e)
 {
     if (TxtNome.Text == "")
     {
         MessageBox.Show("Preencher Nome Completo!");
         TxtNome.Focus();
     }
     else if (TxtUsuario.Text == "")
     {
         MessageBox.Show("Preencher Usuário!");
         TxtUsuario.Focus();
     }
     else if (TxtEmail.Text == "")
     {
         MessageBox.Show("Preencher E-mail!");
         TxtEmail.Focus();
     }
     else
     {
     }
 }
Beispiel #25
0
 private void BtnGuardar_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TxtRuc.Text))
     {
         MessageBox.Show("Digite Ruc", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         TxtRuc.Focus();
     }
     else if (string.IsNullOrEmpty(TxtRazonSocial.Text))
     {
         MessageBox.Show("Digite Razon Social", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         TxtRazonSocial.Focus();
     }
     else if (string.IsNullOrEmpty(TxtCiudad.Text))
     {
         MessageBox.Show("Digite Ciudad", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         TxtCiudad.Focus();
     }
     else if (string.IsNullOrEmpty(TxtDireccion.Text))
     {
         MessageBox.Show("Digite Dirección", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         TxtDireccion.Focus();
     }
     else if (string.IsNullOrEmpty(TxtEmail.Text))
     {
         MessageBox.Show("Digite Correo Electrónico", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         TxtEmail.Focus();
     }
     else if (string.IsNullOrEmpty(TxtTelefono.Text))
     {
         MessageBox.Show("Digite Teléfono", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         TxtTelefono.Focus();
     }
     else
     {
         Guardar();
     }
 }
Beispiel #26
0
 private void BtnFindNode_Click(object sender, EventArgs e)
 {
     try
     {
         CheckTxtBox(TxtEmail.Text, TxtEmail);
         string email = TxtEmail.Text;
         RefreshListbox();
         TxtEmail.Focus();
         string nodeLocated = aNode.Find(email).Data.Email.ToString();
         int    index       = ListBoxOutput.FindString($"{nodeLocated}");
         ListBoxOutput.SetSelected(index, true);
         MessageBox.Show($"Bruger med email: [{nodeLocated}] er blevet fundet!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (FormatException ex)
     {
         MessageBox.Show($"{ex.Message.ToString()}", "Indtastnings fejl", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     catch (NullReferenceException)
     {
         MessageBox.Show($"Brugeren med email: {TxtEmail.Text} findes ikke", "Prøv igen", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         TxtEmail.SelectAll();
         TxtEmail.Focus();
     }
 }
Beispiel #27
0
 private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
 {
     TxtEmail.Focus();
     LblResult.Visibility = Visibility.Hidden;
 }
Beispiel #28
0
 private void BtnGuardar_Click(object sender, EventArgs e)
 {
     if (TxtNombre.Text == "")
     {
         MessageBox.Show("Falta el Nombre!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TxtNombre.Focus();
     }
     else if (TxtApPat.Text == "")
     {
         MessageBox.Show("Falta el Apellido Paterno!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TxtApPat.Focus();
     }
     else if (TxtApMat.Text == "")
     {
         MessageBox.Show("Falta el Apellido Materno!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TxtApMat.Focus();
     }
     else if (TxtDomicilio.Text == "")
     {
         MessageBox.Show("Falta el Domicilio!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TxtDomicilio.Focus();
     }
     else if (TxtTelefono.Text == "")
     {
         MessageBox.Show("Falta el Teléfono!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TxtTelefono.Focus();
     }
     else if (TxtFechaNac.Text == "/" || TxtFechaNac.Text == "__/__/____")
     {
         MessageBox.Show("Falta la Fecha de Nacimiento!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         DtpFechaNac.Focus();
     }
     else if (CmbSexo.Text == "")
     {
         MessageBox.Show("Falta elegir el Sexo!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         CmbSexo.Focus();
     }
     else if (TxtEmail.Text == "")
     {
         MessageBox.Show("Falta el Correo Electronico!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
         TxtEmail.Focus();
     }
     else
     {
         try
         {
             if (Estado == true)
             {
                 GuardaNuevo();
                 MessageBox.Show("Registro Guardado!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 BtnGuardar.Enabled = false;
                 //  x.CargarDatos();
             }
             else
             {
                 modifica();
                 MessageBox.Show("Los cambios se Guardaron Correctamente!!", "Pacientes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 BtnGuardar.Enabled = false;
             }
         }
         catch
         {
             MessageBox.Show("Error!!", "Pacientes");
         }
     }
 }
Beispiel #29
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            cn.Close();

            cn.Open();

            string     sql = "SELECT UserName from Manager where UserName=@un ";
            SqlCommand cmd = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = sql;
            cmd.Parameters.AddWithValue("un", TxtUserName.Text);


            dr = cmd.ExecuteReader();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    username = dr["UserName"].ToString();
                }
            }

            dr.Close();
            cn.Close();

            if (username != null || username == "")
            {
                username         = username.ToLower();
                TxtUserName.Text = TxtUserName.Text.ToLower();
                if (username == TxtUserName.Text)
                {
                    LblError.Visible = true;
                    LblError.Text    = "The username '" + TxtUserName.Text + "' is Already Entered ";
                    return;
                }
                else
                {
                    LblError.Visible = false;
                }
            }
            else
            {
                LblError.Visible = false;
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            cn.Close();
        }
        try
        {
            if (TxtUserName.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter user name";
                TxtUserName.Focus();
                return;
            }
            if (TxtPassword.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please Password";
                TxtPassword.Focus();
                return;
            }
            if (TxtEmail.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter Email";
                TxtEmail.Focus();
                return;
            }
            if (TxtFirstName.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter First Name";
                TxtFirstName.Focus();
                return;
            }
            if (TxtLastName.Text == "")
            {
                LblError.Visible = true;
                LblError.Text    = "Please enter Last Name";
                TxtLastName.Focus();
                return;
            }
            cn.Open();

            string dob = ddlDay.Text + "/" + ddlMonth.Text + "/" + ddlYear.Text;

            DateTimeFormatInfo StartDate = new DateTimeFormatInfo();
            StartDate.ShortDatePattern = "dd/MM/yyyy";
            StartDate.DateSeparator    = "/";
            DateTime objDate = Convert.ToDateTime(dob, StartDate);

            DateTime   jd = DateTime.Now;
            SqlCommand cm = new SqlCommand(
                "INSERT INTO Manager (First_Name, Last_Name, DOB, Occupation, Designation, Monthly_Salary, Email, Address, Country, City, PostalCode, Phone_Number, Status, Joining_Date, Password,Dept_Id, UserName, SQ1, Answer1, SQ2, Answer2, SQ3, Answer3) VALUES(@First_Name, @Last_Name, @DOB, @Occupation, @Designation, @Monthly_Salary, @Email, @Address, @Country, @City, @PostalCode, @Phone_Number, @Status, @Joining_Date, @Password,@Dept_Id, @User_Name, @SQ1, @Answer1, @SQ2, @Answer2, @SQ3, @Answer3)", cn);
            cm.Parameters.Add("@First_Name", TxtFirstName.Text);
            cm.Parameters.Add("@Last_Name", TxtLastName.Text);
            cm.Parameters.Add("@DOB", objDate);
            cm.Parameters.Add("@Occupation", TxtOccupation.Text);
            cm.Parameters.Add("@Designation", TxtDesignation.Text);
            cm.Parameters.Add("@Monthly_Salary", TxtSalary.Text);
            cm.Parameters.Add("@Email", TxtEmail.Text);
            cm.Parameters.Add("@Address", TxtAddress.Text);
            cm.Parameters.Add("@Country", TxtCountry.Text);
            cm.Parameters.Add("@City", TxtCity.Text);
            cm.Parameters.Add("@PostalCode", TxtPostalCode.Text);
            cm.Parameters.Add("@Phone_Number", TxtPhoneNo.Text);
            cm.Parameters.Add("@Status", TxtStatus.Text);
            cm.Parameters.Add("@Joining_Date", jd);
            cm.Parameters.Add("@Password", EncryptPasswrod(TxtPassword.Text));
            cm.Parameters.Add("@Dept_Id", DDLAccountType.Text);
            cm.Parameters.Add("@User_Name", TxtUserName.Text);
            cm.Parameters.Add("@SQ1", TxtQ1.Text);
            cm.Parameters.Add("@Answer1", TxtA1.Text);
            cm.Parameters.Add("@SQ2", TxtQ2.Text);
            cm.Parameters.Add("@Answer2", TxtA2.Text);
            cm.Parameters.Add("@SQ3", TxtQ3.Text);
            cm.Parameters.Add("@Answer3", TxtA3.Text);



            cm.ExecuteNonQuery();

            cm.Clone();


            cn.Close();
            LblError.Visible = true;
            LblError.Text    = "An Email is sent to A Manager /n Account Added Successfully";

            try
            {
                string emailfrom = "*****@*****.**";
                string pwd       = "inse6260";
                string sb        = "Welcome to INSE 6260 Bank ";

                string bd = "Dear Manager! Toy Account Has been Created successfully /n : Your user name to Login is :" + TxtUserName.Text + " and Password is:" + TxtPassword.Text + " and Security Questions Answer is apple";

                MailMessage msg = new MailMessage();
                msg.From = new MailAddress(emailfrom);

                msg.To.Add(TxtEmail.Text);
                msg.Subject = sb;
                msg.Body    = bd;

                SmtpClient sc = new SmtpClient("smtp.gmail.com");

                sc.Port = 587;

                sc.Credentials = new NetworkCredential(emailfrom, pwd);

                sc.EnableSsl = true;

                sc.Send(msg);

                Response.Write("mail send successfully");

                TxtFirstName.Text   = "";
                TxtLastName.Text    = "";
                TxtOccupation.Text  = "";
                TxtDesignation.Text = "";
                TxtSalary.Text      = "";
                TxtEmail.Text       = "";
                TxtAddress.Text     = "";
                TxtCity.Text        = "";
                TxtPostalCode.Text  = "";
                TxtPhoneNo.Text     = "";
                TxtStatus.Text      = "";
                TxtUserName.Text    = "";
                TxtPassword.Text    = "";
                TxtA1.Text          = "";
                TxtA2.Text          = "";
                TxtA3.Text          = "";

                Response.Redirect("~/Admin/AdminMenu.aspx", false);
            }
            catch (Exception ex)
            {
            }
        }
        catch
        { }
    }
Beispiel #30
0
        private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            // foreach (var data in myContext.Suppliers)
            //{
            //  if(data.Email != TxtEmail.Text)
            //{
            //   validEmail = true;
            // }
            //}
            //myContext.Projects.Where(p => p.ProjectID != ProjectId && p.Name == Name);

            if (TxtName.Text == "")
            {
                MessageBox.Show("Fill Name !");
                TxtName.Focus();
            }
            else if (TxtEmail.Text == "")
            {
                MessageBox.Show("Fill Email !");
                TxtEmail.Focus();
            }

            else
            {
                var checkemail = myContext.Suppliers.FirstOrDefault(email => email.Email == TxtEmail.Text);
                if (checkemail == null)
                {
                    var push = new Supplier(TxtName.Text, TxtEmail.Text);
                    myContext.Suppliers.Add(push);
                    var result = myContext.SaveChanges();

                    Showdata();
                    TxtName.Text  = "";
                    TxtEmail.Text = "";
                    if (result > 0)
                    {
                        MessageBox.Show(result + " row has been inserted");
                        GridSupplier.ItemsSource = myContext.Suppliers.ToList();
                        try
                        {
                            //Outlook._Application _app = new Outlook.Application();
                            //Outlook.MailItem mail = (Outlook.MailItem)_app.CreateItem(Outlook.OlItemType.olMailItem);
                            ////sesuaikan dengan content yang di xaml
                            //mail.To = TxtEmail.Text;
                            //mail.Subject = "from dinda";
                            //mail.Body = "Email has delivered !";
                            //mail.Importance = Outlook.OlImportance.olImportanceNormal;
                            //((Outlook._MailItem)mail).Send();
                            MessageBox.Show("Message has been sent.", "Message", MessageBoxButton.OK);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK);
                            TxtName.Text  = "";
                            TxtEmail.Text = "";
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Email already been used !", "Caution !", MessageBoxButton.OK);
                }
            }
        }