예제 #1
0
        protected void link_delete_Click(object sender, EventArgs e)
        {
            int find = int.Parse(txt_find.Text);

            UserReposit.deleteUser(find);
            load();
        }
예제 #2
0
        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));
        }
예제 #3
0
        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();
        }
예제 #4
0
        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));
        }
예제 #5
0
        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));
        }
예제 #6
0
        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));
        }
예제 #7
0
        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";
            }
        }
예제 #8
0
        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));
        }
예제 #9
0
        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");
            }
        }
예제 #10
0
        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));
        }
예제 #11
0
        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"));
        }
예제 #12
0
 public void load()
 {
     GridView1.DataSource = UserReposit.getAll();
     GridView1.DataBind();
 }
예제 #13
0
        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"));
        }