private void clickMe_Click(object sender, EventArgs e) { string name = nameBox.Text; string surname = surnameTextbox.Text; string gender = sexBox.Text.Substring(2); int age = Convert.ToInt32(ageBox.Value); int education = Convert.ToInt32(educationBox.Text.Substring(0, 1)); string ishTecrubesi = experienceBox.Text; int work = Convert.ToInt32(categoryBox.Text.Substring(0, 1)); string city = cityBox.Text; string minSalary = minSalaryBox.Value.ToString(); string cellphone = cellPhone.Text; using (HrConnect db = new HrConnect()) { var cvs = db.Cvs.ToList(); var result = cvs.Where(x => x.Userid == Helper.userId).ToList(); if (result.Count > 0) { MessageBox.Show("Bu usernamenin uygun cv si var"); } else { string workName = db.Works.FirstOrDefault(x => x.Id == work).WorkName; string educationName = db.Educations.FirstOrDefault(x => x.Id == education).EducationName; db.Cvs.Add(new Cv() { CvName = name, CvSurname = surname, CvSex = gender, CvAge = age, EducationName = educationName, CvWorkExperiment = ishTecrubesi, WorkName = workName, CvCity = city, CvMinSalary = minSalary, ContactPhone = cellphone, Userid = Helper.userId }); db.SaveChanges(); nameBox.Text = ""; surnameTextbox.Text = ""; sexBox.Text = ""; ageBox.Value = 0; educationBox.Text = ""; experienceBox.Text = ""; categoryBox.Text = ""; cityBox.Text = ""; minSalaryBox.Value = 0; cellPhone.Text = ""; } } }
private void listviewClick(object sender, EventArgs e) { var selectedItem = Convert.ToInt32(listView1.SelectedItems[0].Text); using (HrConnect db = new HrConnect()) { var elan = db.Elans.FirstOrDefault(x => x.Id == selectedItem); var cv = db.Cvs.FirstOrDefault(x => x.Userid == Helper.userId); MessageBox.Show(elan.Id.ToString() + "Elan Id"); MessageBox.Show(cv.Id.ToString() + "Cv id"); //db.Elans.Remove(elan); //elan.Cvs.Add(cv); //db.Elans.Add(elan); db.Elans.FirstOrDefault(x => x.Id == selectedItem).Cvs.Add(cv); db.SaveChanges(); } }
private void button1_Click_1(object sender, EventArgs e) { string elanName = elanAdi.Text; string shirketName = sirketAdi.Text; string workName = kateqoriaBox.Text.Substring(2); string description = ishInfo.Text; string city = cityBox.Text; int salary = Convert.ToInt32(maashBox.Value); int age = Convert.ToInt32(yashBox.Value); string educationName = educationBox.Text.Substring(2); string tecrube = experienceBox.Text; string phone = phoneBox.Text; using (HrConnect db = new HrConnect()) { db.Elans.Add(new Elan { ElanName = elanName, ShirketName = shirketName, Workname = workName, Education = educationName, Description = description, City = city, Salary = salary.ToString(), Age = age, Experience = tecrube, Telephone = phone, Userid = Helper.userId }); db.SaveChanges(); elanAdi.Text = ""; sirketAdi.Text = ""; ishInfo.Text = ""; cityBox.Text = ""; maashBox.Value = 0; yashBox.Value = 0; } }
private void button1_Click(object sender, EventArgs e) { HrConnect db = new HrConnect(); var username = usernameLabel.Text; var email = emailLabel.Text; var passwordFirst = passwordLabel.Text; var passwordSecond = secondPassword.Text; string random = randomTextBox.Text; int whichUser = Convert.ToInt32(statusBox.Text.Substring(0, 1)); if (emailChecker(email) && passwordChecker(passwordFirst) && identicPasswordChecker(passwordFirst, passwordSecond) && randomChecker(random) && username.Length >= 4) { var users = db.Users.ToList(); if (users.Exists(x => x.Username == username)) { MessageBox.Show("Bele Username artig var"); } else if (users.Exists(x => x.Email == email)) { MessageBox.Show("Bele email var"); } else { db.Users.Add(new User() { Username = username, Email = email, Password = passwordFirst, WhichUser = whichUser }); db.SaveChanges(); var secondusers = db.Users.ToList(); Helper.userId = secondusers[secondusers.Count - 1].Id; MessageBox.Show(Helper.userId.ToString()); db.Dispose(); usernameLabel.Text = ""; emailLabel.Text = ""; passwordLabel.Text = ""; secondPassword.Text = ""; randomLabel.Text = ""; if (whichUser == 1) { var ishciMain = new IshciMain(); ishciMain.Show(); this.Hide(); } else { var ishverenMain = new IshverenMain(); ishverenMain.Show(); this.Hide(); } } } else { MessageBox.Show("Melumatlar yanlishdir"); } }