Beispiel #1
0
        public bool regup(string fname, string lname, string timme, string adres, string dayof, int typepay, int rasp, int ddd)
        {
            registrGANEntities connect = new registrGANEntities();
            int idp = connect.Patients.Where(w => w.FirstName == fname && w.LastName == lname && w.Adress == adres).Select(s => s.idPatiens).FirstOrDefault();

            if (idp != 0 && idp != -1 && rasp != 0 && rasp != -1)
            {
                Registr reg = new Registr()
                {
                    date          = dayof,
                    idrasp        = rasp,
                    idPatient     = idp,
                    time          = timme,
                    idTypepay     = typepay,
                    iduserRegistr = ddd
                };
                connect.Registr.Add(reg);
                connect.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public ActionResult Registr(Registr reg)
        {
            if (ModelState.IsValid)
            {
                using (watcherEntities data = new watcherEntities())
                {
                    var EmailRepeating = data.User_reg.Where(x => x.email == reg.email).ToList();
                    if (EmailRepeating.Count > 0)
                    {
                        ModelState.AddModelError("Repeat", "This email has already exist,please change this email");
                    }
                    User_reg user = new User_reg();
                    user.name     = reg.name;
                    user.surname  = reg.surname;
                    user.age      = reg.age;
                    user.email    = reg.email;
                    user.phone    = reg.phone;
                    user.password = reg.password;
                    data.User_reg.Add(user);
                    data.SaveChanges();

                    Response.Write("<script>alert(Success,Registration successfully done.)</script>");
                }
            }
            return(View());
        }
Beispiel #3
0
        public async Task <IActionResult> Upsert_User(Registr model)
        {
            Regex           regex   = new Regex("(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])");
            MatchCollection matches = regex.Matches(model.Password);

            if (matches.Count < 4)
            {
                ModelState.AddModelError("Password", "password must contain at least 1 alpha, 1 number, 1 special character, 1 lower");
            }
            if (ModelState.IsValid)
            {
                User user = await _db.Users.FirstOrDefaultAsync(u => u.Email == model.Email);

                if (user == null)
                {
                    string pass = Hash(model.Password);
                    _db.Users.Add(new User {
                        Email = model.Email, Password = pass, FirstName = model.FirstName, LastName = model.LastName, Role = model.Role, State = model.State
                    });
                    await _db.SaveChangesAsync();
                    await Authenticate(model.Email);

                    return(RedirectToAction("Show", controllerName: "Users"));
                }

                ModelState.AddModelError("", "Something wrong, try again");
            }
            return(View(model));
        }
Beispiel #4
0
 public BtnOk(Registr registr)
 {
     this.registr = registr;
 }
Beispiel #5
0
 public BtnCencel(Registr registr)
 {
     this.registr = registr;
 }