protected void link_delete_Click(object sender, EventArgs e) { int find = int.Parse(txt_find.Text); UserReposit.deleteUser(find); load(); }
public ActionResult RemoveUser(string id) { UserReposit userReposit = new UserReposit(); List <Users> LUsers = new List <Users>(); var user = userReposit.GetId(Int32.Parse(id)); userReposit.Delete(user); //Если пользователь работник if (user.RoleName == "Employee") { VacancyReposit vacancyReposit = new VacancyReposit(); List <Vacancy> LVacancy = new List <Vacancy>(); LVacancy = vacancyReposit.GetVacancy(user.Login); foreach (var item in LVacancy) { vacancyReposit.Delete(item); } } //Если ищущий работу if (user.RoleName == "Jobseeker") { CondidateReposit condidateReposit = new CondidateReposit(); Condidate condidate = new Condidate(); condidate = condidateReposit.GetLogin(user.Login); condidateReposit.Delete(condidate); } user = userReposit.GetLogin(User.Identity.Name); LUsers = userReposit.GetALL(); LUsers = LUsers.Where(x => x.RoleName != "admin").ToList(); return(View("MasterRoom", LUsers)); }
protected void link_role_Click(object sender, EventArgs e) { int find = int.Parse(txt_find.Text); User roleUser = UserReposit.getUser(find); roleUser.Role = "Admin"; load(); }
public ActionResult MasterRoom() { UserReposit userReposit = new UserReposit(); List <Users> LUsers = new List <Users>(); Users user = new Users(); user = userReposit.GetLogin(User.Identity.Name); LUsers = userReposit.GetALL(); LUsers = LUsers.Where(x => x.RoleName != "admin").ToList(); return(View(LUsers)); }
public ActionResult SortVacancy(string attr) { IList <Vacancy> LVacancy; attr = attr.Replace("*", " "); List <WorkModel> LWorkModel = new List <WorkModel>(); VacancyReposit vacanceReposit = new VacancyReposit(); if (saveAttrVacancy == false) { LVacancy = vacanceReposit.SortBy(attr); UserReposit userReposit = new UserReposit(); var user = userReposit.GetLogin(User.Identity.Name); if (user.RoleName == "Employee") { LVacancy = LVacancy.Where(x => x.NameAutor.Contains(User.Identity.Name)).ToList(); } saveAttrVacancy = !saveAttrVacancy; } else { LVacancy = vacanceReposit.SortDown(attr); UserReposit userReposit = new UserReposit(); var user = userReposit.GetLogin(User.Identity.Name); if (user.RoleName == "Employee") { LVacancy = LVacancy.Where(x => x.NameAutor.Contains(User.Identity.Name)).ToList(); } saveAttrVacancy = !saveAttrVacancy; } foreach (var item in LVacancy) { WorkModel model = new WorkModel(); model.modelVacancy.Name = item.Name; model.modelVacancy.Description = item.Description; model.modelVacancy.Time = item.Time; model.modelVacancy.CompanyName = item.CompanyName; model.modelVacancy.Request = item.Request; model.modelVacancy.Pay = item.Pay; model.modelVacancy.NameAutor = item.NameAutor; model.modelVacancy.OpenVacancy = item.OpenVacancy; LWorkModel.Add(model); } return(View("FindVacancy", LWorkModel)); }
public ActionResult SortCondidate(string attr) { IList <Condidate> LCondidate; attr = attr.Replace("*", " "); List <WorkModel> LWorkModel = new List <WorkModel>(); CondidateReposit condidateReposit = new CondidateReposit(); if (saveAttrCondidate == false) { LCondidate = condidateReposit.SortBy(attr); UserReposit userReposit = new UserReposit(); var user = userReposit.GetLogin(User.Identity.Name); if (user.RoleName == "Employee") { LCondidate = LCondidate.Where(x => x.NameAutor.Contains(User.Identity.Name)).ToList(); } saveAttrCondidate = !saveAttrCondidate; } else { LCondidate = condidateReposit.SortDown(attr); UserReposit userReposit = new UserReposit(); var user = userReposit.GetLogin(User.Identity.Name); if (user.RoleName == "Employee") { LCondidate = LCondidate.Where(x => x.NameAutor.Contains(User.Identity.Name)).ToList(); } saveAttrCondidate = !saveAttrCondidate; } foreach (var item in LCondidate) { WorkModel model = new WorkModel(); model.modelCondidate.FIO = item.FIO; model.modelCondidate.DataBirth = item.DataBirth; model.modelCondidate.experience = item.experience; model.modelCondidate.Skill = item.Skill; model.modelCondidate.Telephone = item.Telephone; model.modelCondidate.City = item.City; LWorkModel.Add(model); } return(View("FindCondidate", LWorkModel)); }
protected void Button1_Click(object sender, EventArgs e) { string name = txt_name.Text; string email = txt_email.Text; string password = txt_password.Text; string conPassword = txt_conPass.Text; string gender = RadioButtonList1.Text; DateTime birthdate = Date_birth.SelectedDate.Date; string pic = FileUpload1.FileName; string phone = txt_phone.Text; string address = txt_address.Text; bool isNull = (birthdate == null); if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(conPassword) && !string.IsNullOrEmpty(gender) && !string.IsNullOrEmpty(pic) && !string.IsNullOrEmpty(phone) && !string.IsNullOrEmpty(address) && Date_birth.SelectedDate != null) { if (UserReposit.findEmail(email) == true) { lbl_message.Text = "Your email is already registered"; } else if (password != conPassword) { lbl_message.Text = "Your confirm password is wrong"; } else if (!pic.EndsWith(".jpg") && !pic.EndsWith(".png")) { lbl_message.Text = "You must input .jpg or .png image"; } else { FileUpload1.SaveAs("D:\\UploadsUser\\" + FileUpload1.FileName); string inputPath = "D:\\UploadsUser\\" + FileUpload1.FileName; UserReposit.insertUser(FactoryUser.createUser(name, email, password, gender, birthdate, inputPath, phone, address)); Response.Redirect("Login.aspx"); } } else { lbl_message.Text = "You must fill all data"; } }
public ActionResult RegCon() { CondidateReposit condidateReposit = new CondidateReposit(); var Con = new Condidate(); UserReposit userReposit = new UserReposit(); var user = userReposit.GetLogin(User.Identity.Name); Con = condidateReposit.GetLogin(user.Login); CondidateModel condidateModel = new CondidateModel(); if (user.CountSummary == true) { condidateModel.FIO = Con.FIO; condidateModel.DataBirth = Con.DataBirth; condidateModel.experience = Con.experience; condidateModel.Skill = Con.Skill; condidateModel.Telephone = Con.Telephone; condidateModel.City = Con.City; condidateModel.NameAutor = Con.NameAutor; } return(View(condidateModel)); }
protected void btn_confirm_Click(object sender, EventArgs e) { User user = (User)Session["user"]; string curr = txt_curr.Text; string newPass = txt_new.Text; string confirm = txt_confirm.Text; if (user.Password != curr) { lbl_error.Text = "incorrect current password!"; } else if (newPass != confirm) { lbl_error.Text = "Wrong Confirm Password!"; } else { User getUser = UserReposit.getUser(user.Id); getUser.Password = newPass; UserReposit.updateUser(getUser.Id, getUser); Response.Redirect("Home.aspx"); } }
public ActionResult Login(LoginModel model) { if (ModelState.IsValid) { // поиск пользователя в бд var repos = new UserReposit(); var user = repos.GetLogin(model.Login); if (user != null) { if (user.Login == model.Login && user.Password == model.Password) { FormsAuthentication.SetAuthCookie(model.Login, true); return(RedirectToAction("Index", "V1")); } else { ModelState.AddModelError("", "Пользователя с таким логином и паролем нет"); } } } return(View(model)); }
public ActionResult RegCon(CondidateModel model) { if (ModelState.IsValid) { var Con = new Condidate(); CondidateReposit condidateReposit = new CondidateReposit(); //Проверка было ли создано резюме UserReposit userReposit = new UserReposit(); var user = userReposit.GetLogin(User.Identity.Name); if (user.CountSummary == true) { Con = condidateReposit.GetLogin(user.Login); } Con.FIO = model.FIO; Con.DataBirth = model.DataBirth; Con.experience = model.experience; Con.Skill = model.Skill; Con.Telephone = model.Telephone; Con.City = model.City; if (user.CountSummary == false) { user.CountSummary = true; Con.NameAutor = user.Login; condidateReposit.Add(Con); userReposit.Update(user); } else { condidateReposit.Update(Con); } } return(RedirectToAction("Index", "V1")); }
public void load() { GridView1.DataSource = UserReposit.getAll(); GridView1.DataBind(); }
public ActionResult RegVac(VacancyModel model) { if (ModelState.IsValid) { string connectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Igory\source\ElmaTask\ElmaTask\ElmaTask\App_Data\DB.mdf;Integrated Security=True"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); string sqlExpression = "SaveVac"; SqlCommand command = new SqlCommand(sqlExpression, connection); command.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter nameParam = new SqlParameter { ParameterName = "@Name", Value = model.Name }; command.Parameters.Add(nameParam); SqlParameter DescriptionParam = new SqlParameter { ParameterName = "@Description", Value = model.Description }; command.Parameters.Add(DescriptionParam); SqlParameter TimeParam = new SqlParameter { ParameterName = "@Time", Value = model.Time }; command.Parameters.Add(TimeParam); SqlParameter CompanyNameParam = new SqlParameter { ParameterName = "@CompanyName", Value = model.CompanyName }; command.Parameters.Add(CompanyNameParam); SqlParameter RequestParam = new SqlParameter { ParameterName = "@Request", Value = model.Request }; command.Parameters.Add(RequestParam); SqlParameter PayParam = new SqlParameter { ParameterName = "@Pay", Value = model.Pay }; command.Parameters.Add(PayParam); SqlParameter NameAutorParam = new SqlParameter { ParameterName = "@NameAutor", Value = User.Identity.Name }; command.Parameters.Add(NameAutorParam); SqlParameter OpenParam = new SqlParameter { ParameterName = "@OpenVacancy", Value = true }; command.Parameters.Add(OpenParam); command.ExecuteScalar(); UserReposit userReposit = new UserReposit(); var user = userReposit.GetLogin(User.Identity.Name); user.CountVacancy++; userReposit.Update(user); connection.Close(); } return(RedirectToAction("Index", "V1")); }