private void PersonalInterest_Load(object sender, EventArgs e) { backgroundWorker1.RunWorkerAsync(); exrepo = new ExistanceCheckUOW(); txt_priceto.Text = trackBar2.Value.ToString(); txt_pricefrom.Text = trackBar1.Value.ToString(); }
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { Repository.RepoBase <User> repouser = new Repository.RepoBase <User>("Users"); if (ExistanceCheckUOW.CheckUserEsitanceViaEmail(txt_Email.Text.Trim()).Result) { MessageBox.Show("Email Address already exists on the Database. Please choose another one Or Log in", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (ExistanceCheckUOW.CheckUserEsitanceViaMobile(txt_mobile.Text.Trim()).Result) { MessageBox.Show("Mobile Numner already exists on the Database. Please choose another one Or Log in", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } cmb_town.Invoke((MethodInvoker) delegate { if (txt_mobile.Text.Trim() == string.Empty) { MessageBox.Show("Mobile number cannot be empty. Please enter a mobile number", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_Email.Text.Trim() == string.Empty) { MessageBox.Show("Email number cannot be empty. Please enter a Email ", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_firstname.Text.Trim() == string.Empty) { MessageBox.Show("First Name cannot be empty. Please enter a First Name ", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_lastname.Text.Trim() == string.Empty) { MessageBox.Show("Last Name cannot be empty. Please enter a Last Name ", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_username.Text.Trim() == string.Empty) { MessageBox.Show("User Name cannot be empty. Please enter a User Name ", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txt_password.Text.Trim() == string.Empty) { MessageBox.Show("Password cannot be empty. Please enter a Password", "Car Management System", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } User user = new User(); user.Id = -1; user.Access_Token = ""; user.CityId = cmb_City.SelectedIndex; user.TownId = cmb_town.SelectedIndex; user.CountryId = 1; user.create_date = DateTime.Now; user.Email = txt_Email.Text.Trim(); user.First_Name = txt_firstname.Text.Trim(); user.IsRegistrationComplete = false; user.Last_Name = txt_lastname.Text; user.Mobile = txt_mobile.Text.Trim(); user.Password = txt_password.Text; user.PasswordSalt = ""; user.Phone = ""; user.UserName = txt_username.Text.Trim(); user.UserState = 1; var result = repouser.Save(user, 1); }); var list = repouser.FindALL().Result; lst_users.Invoke((MethodInvoker) delegate { lst_users.Items.Clear(); foreach (var item in list) { lst_users.Items.Add(item.UserName, 0).Tag = item; } }); }