protected void Button1_Click(object sender, EventArgs e) { localhost.Client c = new localhost.Client(); if (s.HasClient(txtUser.Text)) { Response.Write(Functions.AlertBox("Username exists")); } else if (DateTime.Now.Year - int.Parse(ddBirth.SelectedItem.Text) < 14) { Response.Write(Functions.AlertBox("You are too young")); } else { c.Username = txtUser.Text; c.Password = txtPass.Text; c.FirstName = txtName.Text; c.LastName = txtLname.Text; c.Gender = genderList.SelectedItem.Text; c.City = dropCity.SelectedIndex + 1; c.Street = txtStreet.Text; c.NumStreet = txtStreetNum.Text; c.Age = (DateTime.Now.Year - int.Parse(ddBirth.SelectedItem.Text)).ToString(); c.Mail = txtMail.Text; c.Phone = txtPhone.Text; if (fuImage.HasFile) { c.Pic = fuImage.FileName; fuImage.SaveAs(Server.MapPath("pics/users/" + fuImage.FileName)); } else { c.Pic = "default.jpg"; } c.Level = "Client"; c.Status = "Online"; s.AddNewClient(c); Response.Write(Functions.AlertRedirect("Now you can login", "Login.aspx")); } }