public ActionResult Create(ProfilViewModel model) { if (ModelState.IsValid) { try { Profil p = new Profil(model); gp.Ajouter(p); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", "Erreur : " + ex.Message); return(View(model)); } } return(View(model)); }
private static IList <Profil> GetSeedProfils() { profil = new Profil { Id = Guid.NewGuid(), UserName = "******", DisplayName = "Moritz Müller", Bio = "First bio on InstaNet", Image = File.ReadAllBytes(".//wwwroot//Images//SampleUser.PNG") }; var seedList = new List <Profil> { profil }; return(seedList); }
public ActionResult Index(Profil model) { if (ModelState.IsValid) { var user = UserManager.FindByName(User.Identity.Name); Profil guncellenecekProfil = user.Profil.LastOrDefault(); guncellenecekProfil.Ad = model.Ad; guncellenecekProfil.DogumTarihi = model.DogumTarihi; guncellenecekProfil.Soyad = model.Soyad; guncellenecekProfil.TCKimlikNo = model.TCKimlikNo; guncellenecekProfil.Telefon = model.Telefon; UserManager.Update(user); } return(View(model)); }
public void startAsync(string profilName, string query) { Profil usedProfil = pWorker.getProfilbyName(profilName); if (usedProfil != null) { DatabaseAsyncParam data = new DatabaseAsyncParam(); data.UsedProfil = usedProfil; data.FieldName = this.iterationVaribaleName; data.ValueName = this.iterationVaribaleValue; data.Query = query; worker.RunWorkerAsync(data); } else { this.scrMysqError(" invalid profil: " + profilName); } }
//Cliknutí na picturebox private void pictureBox1_Click(object sender, EventArgs e) { if ((label1.Text == "Level 0") && (coins >= 10)) { sl = new Profil("Pepa", 1); label1.Text = sl.hl.Info; pictureBox1.BackColor = Color.Aquamarine; textBox1.Text = sl.ToString();; coins = coins - 10; } else if (label1.Text == "Level 1") { sl = new Profil("Pepa", 2); label1.Text = sl.hl.Info; pictureBox1.BackColor = Color.Red; textBox1.Text = sl.ToString(); } }
public ActionResult Create(ProfilViewModel model) { if (ModelState.IsValid) { try { Profil p = new Profil(model); gp.Ajouter(p); return RedirectToAction("Index"); } catch(Exception ex) { ModelState.AddModelError("", "Erreur : " + ex.Message); return View(model); } } return View(model); }
public FrmProfilPerusahaan(string header, Profil profil) : base() { InitializeComponent(); ColorManagerHelper.SetTheme(this, this); base.SetHeader(header); base.SetButtonSelesaiToBatal(); this._profil = profil; if (this._profil != null) { txtNamaPerusahaan.Text = this._profil.nama_profil; txtAlamat.Text = this._profil.alamat; txtKota.Text = this._profil.kota; txtTelepon.Text = this._profil.telepon; } }
public LogIn LogNewUser(CredentialDto logDto) { if (!AllUsersCredential().Any(p => p.CheckCredential(logDto))) { return(LogIn.Failed); } Database.Player userDb = dbContext.Players.FirstOrDefault(p => p.Email == logDto.Email); if (userDb == null || userDb.Password != logDto.Password) { return(LogIn.Failed); } Profil user = new Profil(userDb); LoggedUsers.Add(user); return(LogIn.Success); }
//public ActionResult Create([Bind(Include = "UserID,Förnamn,Efternamn,Födelsedatum,ProfileURL,Bio")]HttpPostedFileBase file, Profil profil) //{ public ActionResult Create([Bind(Include = "UserID, Förnamn, Efternamn, Födelsedatum, ProfileURL, sBio")] Profil profil) { // Hitta ID för nuvarande användare: var userId = User.Identity.GetUserId(); // Skapa en appliactionDbContext-referens: var dbContext = new ApplicationDbContext(); // Hitta användaren i databasen: var currentUser = dbContext.Users.FirstOrDefault(u => u.Id == userId); if (ModelState.IsValid) { db.Profil.Add(profil); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult SepettenUrunCikar(int urunId) { var user = UserManager.FindByName(User.Identity.Name); Profil userProfil = user.Profil.LastOrDefault(); Sepet userSepet = SepetManager.GetByProfilId(userProfil.ProfilId); if (userSepet.SepetUrun.Count == 0) { RedirectToAction("Index", "Sepet"); } else { SepetManager.RemoveUrunFromSepet(userSepet.SepetId, urunId); } return(RedirectToAction("Index", "Sepet")); }
public ActionResult Inscription(Profil profil = null, string mailValid = "", string passwordValid = "") { if (HttpContext.User.Identity.IsAuthenticated) { profil = dalProfil.getProfil(HttpContext.User.Identity.Name); return(Connexion(profil)); } if (profil != null) { bool validMail = mailValid.Equals(profil.mail); bool validPassword = passwordValid.Equals(profil.password); if (validMail && validPassword) { profil.commentaire = HttpUtility.HtmlDecode(profil.commentaire); Profil profilExist = dalProfil.getProfil(profil.login); if (profilExist != null) { ModelState.AddModelError("Profil", "Identifiant déjà pris."); } else { profil.token = Helpers.SHA512(Helpers.RandomString(10)); dalProfil.AddProfil(profil); TempData["addNotification"] = new string[] { "Votre êtes bien inscrit au site de natation synchronisée de la FFN.", "L'administrateur va traiter votre inscription." }; return(RedirectToAction("Index", "Home")); } } else { if (!validMail) { ModelState.AddModelError("Profil", "Les emails ne correspondent pas."); } if (!validPassword) { ModelState.AddModelError("Profil", "Les mots de passe ne correspondent pas."); } } } return(View()); }
public ActionResult Create(int id, ReglageViewModel model) { if (ModelState.IsValid) { try { Profil p = gp.Selectionner(id); Reglage r = new Reglage(model); p.AjouterReglage(r); return(RedirectToAction("Index", new { id })); } catch (Exception ex) { ModelState.AddModelError("", "Erreur : " + ex.Message); return(View(model)); } } return(View(model)); }
public ActionResult EditProfile(string nick) { Profil profil = db.Profiles.SingleOrDefault(p => p.UserName == User.Identity.Name); profil.Nick = nick; string avatar = "cucumber.jpg"; HttpPostedFileBase file = Request.Files["image"]; if (file != null && file.ContentLength > 0) { avatar = file.FileName; file.SaveAs(HttpContext.Server.MapPath("~/Images/") + avatar); } profil.Avatar = avatar; db.Entry(profil).State = EntityState.Modified; db.SaveChangesAsync(); return(RedirectToAction("Profile", "Posts", new { profileID = profil.ID })); }
public ActionResult OdemeYap(int id) { var user = UserManager.FindByName(User.Identity.Name); Profil userProfil = user.Profil.LastOrDefault(); List <Adres> adresler = userProfil.Adresler.ToList(); List <Siparis> siparisler = SiparisManager.GetByProfilWithSiparisUrun(userProfil.ProfilId); Siparis siparis = siparisler.Where(x => x.SiparisId == id).FirstOrDefault(); OdemeViewModel odemeViewModel = new OdemeViewModel { Profil = userProfil, Adresler = adresler, Siparis = siparis }; return(View(odemeViewModel)); }
public ActionResult Create(Siparis siparis) { var user = UserManager.FindByName(User.Identity.Name); Profil userProfil = user.Profil.LastOrDefault(); if (ModelState.IsValid) { siparis.SiparisUrunler = sipUrunler; siparis.SiparisTarihi = DateTime.Now; SepetManager.Add(new Sepet { ProfilId = userProfil.ProfilId }); SiparisManager.Add(siparis); return(RedirectToAction("Index")); } return(View(siparis)); }
public bool SetCurrentProfil(string profil) { foreach (Profil p in Profils) { if (p.Name == profil) { Current = p; PlayerPrefs.SetString("Profil", profil); return(true); } } if (LoadProfil(profil)) { return(true); } return(false); }
public ActionResult Edit(int id, ReglageViewModel model) { if (ModelState.IsValid) { try { Profil profil = gp.Lister().Single(p => p.ListerReglage().Exists(r => r.Id == id)); //TODO: Meilleur façon de faire ça? Reglage reglage = new Reglage(model); profil.ModifierReglage(id, reglage); return(RedirectToAction("Index", new { profil.Id })); } catch (Exception ex) { ModelState.AddModelError("", "Erreur : " + ex.Message); return(View(model)); } } return(View(model)); }
// PUT: api/Reglage/5/6 public void Put(int idProfil, int idReglage, [FromBody] ReglageViewModel value) { Profil p = gp.Selectionner(idProfil); Reglage reglage = p.SelectionnerReglage(idReglage); Reglage nouveauReglage = new Reglage(value); reglage.TemperatureInterieur = nouveauReglage.TemperatureInterieur; reglage.Humidite = nouveauReglage.Humidite; if (nouveauReglage.Duree.Days != -1) { reglage.Duree = nouveauReglage.Duree; } if (nouveauReglage.Lumiere != -1) { reglage.Lumiere = nouveauReglage.Lumiere; } p.ModifierReglage(idReglage, reglage); }
public ActionResult Connexion(Profil profil = null) { ActionResult returnView = null; var query = HttpUtility.ParseQueryString(this.Request.UrlReferrer.Query); string returnUrl = HttpUtility.UrlDecode((query["ReturnUrl"] == null || "".Equals(query["ReturnUrl"])) ? "" : query["ReturnUrl"]); Profil profilFound = null; profilFound = dalProfil.getProfil(profil.login, profil.password); if (profilFound != null) { if (profilFound.role == null) { ModelState.AddModelError("Profil", "Aucun profile ne vous a été assigné pour le moment."); returnView = View(); } else { FormsAuthentication.SetAuthCookie(profilFound.login.ToString(), false); profilFound.dateConnexion = DateTime.Now; dalProfil.UpdateProfil(); if (!string.IsNullOrWhiteSpace(returnUrl) && Url.IsLocalUrl(returnUrl)) { returnView = Redirect(returnUrl); } else if (profilFound.role.Equals(ProfilDal.ADMIN)) { returnView = RedirectToAction("Index", "Admin"); } else { returnView = RedirectToAction("Index", "Juge"); } } } else { returnView = View(); ModelState.AddModelError("Profil", "Identifiant et/ou mot de passe incorrect(s)."); } return(returnView); }
/** * This method is called when clicking the button to end the game * The current holes is saved before ending the game */ private async void stopPartieClicked(object sender, EventArgs e) { if (partie.Shots.Count == 0)//checks if the current hole was played { await this.DisplayAlert("Erreur", "Vous devez avoir joué ce trou pour arrêter la partie ici", "Ok"); } else { //the user has to confirm his click var confirm = await this.DisplayAlert("Arrêter la partie", "Voulez vous vraiment arrêter la partie après ce trou ?", "Oui", "Non"); if (confirm) { MessagingCenter.Send <HoleFinishedPage, int>(this, "ReallyFinit", 2);//sends a message : the game is finished Profil profil = StatistiquesGolf.getProfil(); partie.holeFinished(profil.SaveStats); await Navigation.PopModalAsync(); } } }
/// <summary> /// save profil /// </summary> /// <param name="profil"></param> /// <returns></returns> public override Profil Save(Profil profil) { try { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); string ressourceP = ResourcePath + "/save"; var request = new RestRequest(ressourceP, Method.POST); serializer.MaxJsonLength = int.MaxValue; request.RequestFormat = DataFormat.Json; string json = serializer.Serialize(profil); request.AddParameter("application/json", json, ParameterType.RequestBody); RestResponse queryResult = (RestResponse)RestClient.Execute(request); Profil pf = RestSharp.SimpleJson.DeserializeObject <Profil>(queryResult.Content); return(pf); } catch (Exception) { return(null); } }
public ActionResult EditUser(Profil profil) { var login = HttpContext.User.Identity.Name; Users user = db.Users.FirstOrDefault(u => u.Login == login); user.FirstName = profil.FirstName; user.LastName = profil.LastName; user.MiddleName = profil.MiddleName; user.Phone = profil.Phone; user.Login = profil.EMail; db.Update(user); db.SaveChanges(); var ticket = new FormsAuthenticationTicket(2, user.Login, DateTime.Now, DateTime.Now.AddMinutes(60), true, String.Empty); var encTicket = FormsAuthentication.Encrypt(ticket); var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); cookie.Expires = DateTime.Now.AddMinutes(60); Response.Cookies.Add(cookie); return(PartialView(profil)); }
public ActionResult SepeteUrunEkle(int urunId) { Urun sepeteEklenecekUrun = UrunManager.GetById(urunId); var user = UserManager.FindByName(User.Identity.Name); Profil userProfil = user.Profil.LastOrDefault(); Sepet userSepet = SepetManager.GetByProfilId(userProfil.ProfilId); if (userSepet.SepetUrun.Count == 0) { userSepet.ProfilId = userProfil.ProfilId; SepetManager.Add(userSepet); } SepetUrun sepetUrun = new SepetUrun { SepetId = userSepet.SepetId, Urun = sepeteEklenecekUrun, Miktar = 1 }; SepetManager.AddUrunToSepet(userSepet.SepetId, sepetUrun); return(RedirectToAction("Index", "Home")); }
/// <summary> /// Right according to Profil /// </summary> /// <returns>return rights according to profil </returns> public List <Right> getRightByProfil(Profil profil) { try { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); var request = new RestRequest(ResourcePath + "/r_profil", Method.POST); serializer.MaxJsonLength = int.MaxValue; string json = serializer.Serialize(profil); request.AddParameter("application/json", json, ParameterType.RequestBody); var response = RestClient.ExecuteTaskAsync(request); RestResponse queryResult = (RestResponse)response.Result; List <Right> objects = RestSharp.SimpleJson.DeserializeObject <List <Right> >(queryResult.Content); return(objects); } catch (Exception e) { logger.Error("Unable to retrieve right.", e); throw new ServiceExecption("Unable to retrieve right.", e); } }
public IActionResult Duzenle(int id) { var Birimler = new List <SelectListItem>(); var Selecteds = db.BirimveKoordinator.ToList().FindAll(x => x.BirimKoordinatoruID == id); foreach (var item in db.Birimler) { Birimler.Add(new SelectListItem { Value = item.ID.ToString(), Text = item.Ad, Selected = Selecteds.Any(x => x.BirimID == item.ID) }); } ViewBag.Birimler = Birimler; BirimKoordinatoru birimkoordinatoru = db.BirimKoordinatorleri.ToList().Find(x => x.ID == id); Profil profil = db.Hesaplar.ToList().Find(x => x.ID == birimkoordinatoru.ProfilID); birimkoordinatoru.Profil = profil; return(View(birimkoordinatoru)); }
public ActionResult Profil() { int id; try { id = Int32.Parse(Session["userId"].ToString()); } catch { return(RedirectToAction("Index", "Home")); } //id = Int32.Parse(Session["userId"].ToString()); dynamic mymodel = new ExpandoObject(); Profil ktos = new Profil(); User c = ktos.ZnajdzUsera(id); mymodel.User = c; mymodel.Events = ktos.GetUserEvent(c); return(View(mymodel)); }
public ActionResult Profil(Profil profil) { profil.Employee = Repo.GetEmployee(int.Parse(Session["IDEmployee"].ToString())); profil.Team = Repo.GetTeam(profil.Employee.AssignedTeam); if (ModelState.IsValid) { profil.User = new User(); profil.User.Password = profil.Password; if (Repo.ChangePassword(profil.Employee.Email, profil.User.Password)) { TempData["PasswordChangeStatus"] = $"Password uspješno promijenjen"; return(Redirect("/Home/Index")); } else { TempData["PasswordChangeStatus"] = $"Nekaj ne valja, nisam mogao promijeniti password"; return(Redirect("/Home/Index")); } } return(View(profil)); }
public ActionResult annler_mision(int id_marche, int id_mission_annulée) { Marché mar = dbmetier.Marché.Find(id_marche); Affectation_profils aff; Mission mission = dbmetier.Missions.Where(a => a.id_mission == id_mission_annulée).FirstOrDefault(); mission.date_fin_mission = System.DateTime.Now; ICollection <Affectation_profils> listaf = new List <Affectation_profils>(); int budget_mission = 0; foreach (var item in mission.Affectation_profils) { Profil profil = item.Profil; Participation par = dbmetier.Participations.Where(a => a.id_marché_participation == id_marche).FirstOrDefault(); Participation_profil particpro = dbmetier.Participation_profil.Where(a => a.id_profil_fk == profil.id_profil && a.id_participation_fk == (int)par.id_participation).FirstOrDefault(); budget_mission += (int)item.charge_profil * (int)particpro.cout_unit_ht; } mar.montant_total -= budget_mission; dbmetier.SaveChanges(); foreach (var item in mission.Affectation_profils) { aff = new Affectation_profils { charge_profil = item.charge_profil, id_affectation = item.id_affectation, id_mission_affectation = item.id_mission_affectation, id_profils_affectation = item.id_profils_affectation, Mission = item.Mission, Profil = item.Profil }; listaf.Add(aff); } foreach (var item in listaf) { aff = dbmetier.Affectation_profils.Where(a => a.id_affectation == item.id_affectation).FirstOrDefault(); dbmetier.Affectation_profils.Remove(aff); } dbmetier.SaveChanges(); return(RedirectToAction("Dashboardresp", new { id_marche = id_marche }));; }
public HttpResponseMessage Put(Profil EndreBrukerInfo) { string userName = User.Identity.Name; if (ModelState.IsValid) { bool ok = _BrukerBLL.EndreBrukerInfo(EndreBrukerInfo, userName); if (ok) { return(new HttpResponseMessage() { StatusCode = HttpStatusCode.OK, }); } return(new HttpResponseMessage() { StatusCode = HttpStatusCode.NotFound, Content = new StringContent("Kunne ikke sette inn i databasen") }); } return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); }
protected override void Simpan() { if (this._profil == null) { this._profil = new Profil(); } _profil.nama_profil = txtNamaPerusahaan.Text; _profil.alamat = txtAlamat.Text; _profil.kota = txtKota.Text; _profil.telepon = txtTelepon.Text; _profil.email = txtEmail.Text; _profil.website = txtWebsite.Text; var result = 0; var validationError = new ValidationError(); IProfilBll bll = new ProfilBll(MainProgram.log); result = bll.Save(_profil, ref validationError); if (result > 0) { Listener.Ok(this, _profil); this.Close(); } else { if (validationError.Message.NullToString().Length > 0) { MsgHelper.MsgWarning(validationError.Message); base.SetFocusObject(validationError.PropertyName, this); } else { MsgHelper.MsgUpdateError(); } } }
public FrmPenjualan(string header, Pengguna pengguna, string menuId) { InitializeComponent(); ColorManagerHelper.SetTheme(this, this); this.Text = header; this._log = MainProgram.log; this._bll = new JualProdukBll(_log); this._pengguna = MainProgram.pengguna; this._profil = MainProgram.profil; this._pengaturanUmum = MainProgram.pengaturanUmum; _currentNota = this._bll.GetLastNota(); _listOfItemJual.Add(new ItemJualProduk()); // add dummy objek InitGridControl(gridControl); SetStatusBar(); ShowInfoTanggal(_currentNota); txtKasir.Text = this._pengguna.nama_pengguna; }
public List<Profil> ListerProfil() // on liste une liste de profil { string query = "SELECT * FROM profil"; List<Profil> profils = new List<Profil>(); MySqlConnection connection = OuvrirConnection(); if (connection != null) { MySqlCommand cmd = new MySqlCommand(query, connection); MySqlDataReader msdr = cmd.ExecuteReader(); while (msdr.Read()) { Profil profil = new Profil() { Id = msdr.GetInt32(0), Nom = msdr.GetString(1), }; profils.Add(profil); } msdr.Close(); profils.ForEach(p => p.Conditions = ListerReglage(p.Id)); connection.Close(); } return profils; }
public void Modifier(int id, Profil profil) { string query = "UPDATE profil SET nom='" + profil.Nom + "'WHERE id='" + id + "'"; connection.Modifier(query); }
public int Ajouter(Profil profil) { string query = "INSERT INTO projet_serre.profil (nom) VALUES ('" + profil.Nom + "'); SELECT LAST_INSERT_ID();"; return connection.Ajouter(query); }
ProfilsConfiguration(Profil profil1, Profil profil2, Profil profil3, Profil profil4) { Profil1 = profil1; Profil2 = profil2; Profil3 = profil3; Profil4 = profil4; }
public void Ajouter(Profil profil) { int idProfil = connection.Ajouter(profil); profils.Add(profil); profil.Id = idProfil; }
public ProfilViewModel(Profil p) { Id = p.Id; Nom = p.Nom; }