private static Grup selectGrupDeUnTorneigIUnGrup(int idT, int numG) { Grup g = null; //--------------------------------- using (MySqlConnection connexio = MySQL.GetConnexio()) { connexio.Open(); using (MySqlCommand consulta = connexio.CreateCommand()) { consulta.CommandText = @"select * from grup where torneig_id = @idTorneig and num = @numGrup"; UtilsDB.AddParameter(consulta, "idTorneig", idT, MySqlDbType.Int32); UtilsDB.AddParameter(consulta, "numGrup", numG, MySqlDbType.Int32); MySqlDataReader reader = consulta.ExecuteReader(); while (reader.Read()) { Int32 num = reader.GetInt32(reader.GetOrdinal("num")); string description = reader.GetString(reader.GetOrdinal("description")); Int32 carambolesVictoria = reader.GetInt32(reader.GetOrdinal("caramboles_victoria")); Int32 limitEntrades = reader.GetInt32(reader.GetOrdinal("limit_entrades")); Torneig t = TorneigBD.selectTorneigPerId(idT); g = new Grup(num, description, carambolesVictoria, limitEntrades, t); } } } return(g); }
internal static void updateInscritEnUnGrup(Inscrit i, Grup g) { using (MySqlConnection connexio = MySQL.GetConnexio()) { connexio.Open(); MySqlTransaction trans = connexio.BeginTransaction(); using (MySqlCommand consulta = connexio.CreateCommand()) { consulta.Transaction = trans; consulta.CommandText = @"update inscrit set grup_num = @grupNum where soci_id = @idSoci and torneig_id = @idTorneig"; UtilsDB.AddParameter(consulta, "grupNum", g.Num, MySqlDbType.Int32); UtilsDB.AddParameter(consulta, "idTorneig", i.Torneig.Id, MySqlDbType.Int32); UtilsDB.AddParameter(consulta, "idSoci", i.Soci.Id, MySqlDbType.Int32); try { consulta.ExecuteNonQuery(); trans.Commit(); } catch (Exception e) { } } } }
public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var grup = _context.Grups.Include(e => e.DirectionList) .ToList().Find(x => x.GrupId == id); if (grup == null) { return(NotFound()); } Current = grup; if (grup.isPranet) { var students = await _context.Students.Include(x => x.GetDirection) .Where(x => x.DirectionId == grup.DirectId) .ToListAsync(); ViewBag.student = students; } else { var students = _context.Students.Include(e => e.GetDirection) .Where(x => x.GrupName == Current.Name && x.DirectionId == Current.DirectId).ToArray(); ViewBag.student = students; } SearchContent(grup); return(View(grup)); }
private void btnDuzenle_Click(object sender, EventArgs e) { if (btnDuzenle.Text == "Düzenle") { listBoxGrupList.Enabled = false; btnSil.Enabled = false; groupBox1.Text = "Grup Düzenle "; txtGrupAdi.Text = listBoxGrupList.Text; btnDuzenle.Text = "Kaydet"; btnEkle.Enabled = false; btnDuzenle.Text = "Kaydet"; duzenlenecekGrup = (Grup)listBoxGrupList.SelectedItem; } else { duzenlenecekGrup.GrupAdi = txtGrupAdi.Text; Program.GrupRep.Duzenle(duzenlenecekGrup); groupBox1.Text = "Yeni Grup Ekle"; txtGrupAdi.Clear(); btnEkle.Enabled = true; btnDuzenle.Text = "Düzenle"; ListeYenile(); Program.EkranGuncelle(); btnSil.Enabled = true; listBoxGrupList.Enabled = true; } }
public async Task <IActionResult> Edit(int id, [Bind("GrupId,Name")] Grup grup) { if (id != grup.GrupId) { return(NotFound()); } if (ModelState.IsValid) { try { Current.Name = grup.Name; _context.Update(Current); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GrupExists(grup.GrupId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(grup)); }
public async Task <IActionResult> Create([Bind("GrupId,Name,DirectId,isPranet")] Grup grup) { if (ModelState.IsValid) { if (grup.isPranet) { if (_context.Grups.FirstOrDefault(x => x.DirectId == grup.DirectId) == null) { _context.Add(grup); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } else { _context.Add(grup); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } ViewData["DirectionId"] = new SelectList(_context.Directions, "DirectionId", "Name"); return(View(grup)); }
private void Saved(object o) { IsVisibility = false; if (Gr) { if (SelectedGroup.Title != "" && SelectedGroup.Title != Auto1 && SelectedGroup.Title != Auto2 && SelectedGroup.Title != Auto3 && MGroups.All(gr => gr.Title != SelectedGroup.Title)) { MGroups.Add(SelectedGroup); } else { Null = true; } } else { var b1 = SelectedTask.Group != "" && SelectedTask.Group != Auto1 && SelectedTask.Group != Auto2 && SelectedTask.Group != Auto3; var b2 = (SelectedTask.Status != TaskStatus.Completed || _chCom) && (SelectedTask.Status != TaskStatus.Canceled || _chCan); if (b1 && b2) { var grup = MGroups.FirstOrDefault(gr => gr.Title == SelectedTask.Group); if (grup == null) { grup = new Grup { Title = SelectedTask.Group }; MGroups.Add(grup); } grup.Tasks.Add(SelectedTask); Date(SelectedTask); } else if (b2) { Date(SelectedTask); SelectedTask.PropertyChanged -= Modify; SelectedTask.Group = ""; SelectedTask.PropertyChanged += Modify; MGroups.First(gr => gr.Title == Auto3).Tasks.Add(SelectedTask); } else if (b1) { if (MGroups.All(g => g.Title != SelectedTask.Group)) { MGroups.Add(new Grup { Title = SelectedTask.Group }); } } else { SelectedTask.PropertyChanged -= Modify; SelectedTask.Group = ""; SelectedTask.PropertyChanged += Modify; } _groups.Add(SelectedTask); } }
public void AddtoGroup() { List <int> GrupIDList = new List <int>(); //Adds groupID's to a variable foreach (var pickerview in pickerStack.Children) { if (pickerview is CustomPicker) { Grup selectgroup = ((CustomPicker)pickerview).SelectGroup;//here you will get your select group,then you could get its ID ,GroupName or SubsID GrupIDList.Add(selectgroup.ID); } else if (pickerview is CustomPicker2) { Grup selectgroup = ((CustomPicker2)pickerview).SelectGroup;//here you will get your select group,then you could get its ID ,GroupName or SubsID GrupIDList.Add(selectgroup.ID); } } GrupRehber newGrupRehber = new GrupRehber(); newGrupRehber.RehberID = viewModel.Item.ID; newGrupRehber.GrupIDList = GrupIDList; //This request deletes all previous groups of the registry and adds current ones. var client = new RestClient("http://192.168.1.57/VizyonMesajMobilAPI/api/addtogrup"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddHeader("Authorization", "Bearer " + App.LoginToken); request.AddParameter("application/json", JsonConvert.SerializeObject(newGrupRehber), ParameterType.RequestBody); IRestResponse response = client.Execute(request); }
public bool Insert(Grup model) { const string sql = @"INSERT INTO public.grup(aktif, sil, olusturmatarihi, olusturankisi, guncellemetarihi, guncelleyenkisi, ad, aciklama, yoneticiid) VALUES (@aktif, @sil, @olusturmatarihi, @olusturankisi, @guncellemetarihi, @guncelleyenkisi, @ad, @aciklama, @yoneticiid);"; return(_genericRepository.Insert(sql, model)); }
public ActionResult DeleteConfirmed(int id) { Grup grup = _grupService.GetById(id); _grupService.Delete(id); return(RedirectToAction("Index")); }
private void button2_Click(object sender, EventArgs e) { if (button2.Text == "Düzenle") { groupBox1.Text = "Grup Düzenle "; txt_GrupAdi.Text = lst_GrupListe.Text; btn_GrupEkle.Enabled = false; button2.Text = "Kaydet"; duzenlenecekGrup = (Grup)lst_GrupListe.SelectedItem; button1.Enabled = false; } else { duzenlenecekGrup.GrupAdi = txt_GrupAdi.Text; Program.GrupRep.Duzenle(duzenlenecekGrup); groupBox1.Text = "Yeni Grup Ekle "; txt_GrupAdi.Clear(); groupBox1.Enabled = true; button2.Text = "Düzenle"; button1.Enabled = true; ListeYenile(); Program.EkranGuncelle(); } }
private GrupKullaniciIzinViewModel GrupKullaniciVeIzinleriGetir(int grupId) { Grup grup = grupRepo.Gruplar.FirstOrDefault(x => x.GrupId == grupId); var tumIzinler = izinRepo.Izinler.Select(p => new SelectListItem { Text = p.IzinAdi, Value = p.IzinId.ToString() }).ToList(); tumIzinler.Insert(0, new SelectListItem { Text = "Izin seçiniz", Value = "0" }); var tumKullanicilar = kullaniciRepo.Kullanicilar.Select(p => new SelectListItem { Text = p.KullaniciAdi, Value = p.KullaniciId.ToString() }).ToList(); tumKullanicilar.Insert(0, new SelectListItem { Text = "Kullanıcı seçiniz", Value = "0" }); var model = new GrupKullaniciIzinViewModel { Grup = grup, Kullanicilar = grupRepo.GrupKullanicilariniGetir(grupId), Izinler = grupRepo.GrupIzinleriniGetir(grupId), TumIzinler = tumIzinler, TumKullanicilar = tumKullanicilar, SelectedIzinId = 0, SelectedKullaniciId = 0 }; return(model); }
public ActionResult InsertTeam(Grup model) { bool result = false; if (model.Id == 0) { model.yoneticiid = HttpContext.Session.GetInt32("kullaniciid").Value; model.Olusturankisi = model.yoneticiid; result = _grupService.Insert(model); } else { model.Guncelleyenkisi = HttpContext.Session.GetInt32("kullaniciid").Value; result = _grupService.Update(model); } if (result) { GenericModels.GrupOptionRefresh(); ViewData["success"] = "true"; } else { ViewData["success"] = "false"; } return(Redirect("/Home/Index")); }
public static ObservableCollection <Grup> selectGrupsDeUnTorneig(Int32 idTorneig) { ObservableCollection <Grup> grups = new ObservableCollection <Grup>(); //--------------------------------- using (MySqlConnection connexio = MySQL.GetConnexio()) { connexio.Open(); using (MySqlCommand consulta = connexio.CreateCommand()) { consulta.CommandText = @"select * from grup where torneig_id = @idTorneig"; UtilsDB.AddParameter(consulta, "idTorneig", idTorneig, MySqlDbType.Int32); MySqlDataReader reader = consulta.ExecuteReader(); while (reader.Read()) { Int32 num = reader.GetInt32(reader.GetOrdinal("num")); string description = reader.GetString(reader.GetOrdinal("description")); Int32 carambolesVictoria = reader.GetInt32(reader.GetOrdinal("caramboles_victoria")); Int32 limitEntrades = reader.GetInt32(reader.GetOrdinal("limit_entrades")); Torneig t = TorneigBD.selectTorneigPerId(idTorneig); Grup g = new Grup(num, description, carambolesVictoria, limitEntrades, t); grups.Add(g); } } } return(grups); }
public string GrupSil(int Id) { Grup g = context.Gruplar.Find(Id); if (g != null) { var yetkiler = context.GrupYetkiler.Where(p => p.GrupId.Equals(Id)); foreach (var yetki in yetkiler) { context.GrupYetkiler.Remove(yetki); } var kullanicilar = context.GrupKullanicilar.Where(p => p.GrupId.Equals(Id)); foreach (var kullanici in kullanicilar) { context.GrupKullanicilar.Remove(kullanici); } context.Gruplar.Remove(g); context.SaveChanges(); return(g.GrupId.ToString()); } return(string.Empty); }
public CustomPicker2(UserDetailViewModel viewModel, Grup SelectGroup) { InitializeComponent(); this.SelectGroup = SelectGroup; picker.ItemsSource = viewModel.GroupList; picker.ItemDisplayBinding = new Binding("GrupAdi"); picker.SelectedItem = viewModel.GroupList.First(p => p.ID == SelectGroup.ID); }
public ActionResult DeleteConfirmed(int id) { Grup grup = db.Grup.Find(id); db.Grup.Remove(grup); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] Grup grup) { if (ModelState.IsValid) { _grupService.Update(grup); return(RedirectToAction("Index")); } return(View(grup)); }
public ActionResult Edit([Bind(Include = "Id,Adi,BaslangicTarihi, BitisTarihi")] Grup grup) { if (ModelState.IsValid) { _grupService.Update(grup); return(RedirectToAction("Index")); } return(View(grup)); }
private void LbGruplar_SelectionChanged(object sender, SelectionChangedEventArgs e) { Grup seçilenGrup = LbGruplar.SelectedItem as Grup; if (seçilenGrup != null) { LbKişiler.ItemsSource = seçilenGrup.Kişi; } }
public static void LogYaz(Grup Grup, string Aciklama) { using (LogDetayi detay = new LogDetayi()) { detay.Aciklama = Aciklama; detay.Grup = Grup.ToString(); THLlogYaz = new Thread(new ParameterizedThreadStart(LogYazz)); THLlogYaz.Start(detay); } }
public ActionResult Edit([Bind(Include = "Id,GrupAdi,Lokasyon_Id")] Grup grup) { if (ModelState.IsValid) { db.Entry(grup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Lokasyon_Id = new SelectList(db.Lokasyon, "Id", "LokasyonAdi", grup.Lokasyon_Id); return(View(grup)); }
//Constructor cu parametrii public Persoana(string _nume, string _prenume, string _data, int _nr_de_telefon, string _email, Grup grup) { Nume = _nume; Prenume = _prenume; DataDeNastere = _data; NrDeTelefon = _nr_de_telefon; Email = _email; IdPersoana = IdUltimaPersoana; IdUltimaPersoana++; Grupul = grup; }
public Masina(string _numevanzator, string _numecumparator, string _marca, string _model, string _culoare, double _pret, int _anfabricatie, Grup _grup) { Numevanzator = _numevanzator; Numecumparator = _numecumparator; Marca = _marca; Model = _model; Culoare = _culoare; Pret = _pret; Anfabricatie = _anfabricatie; dotari = _grup; }
//Constructor fara parametrii public Persoana() { Nume = string.Empty; Prenume = string.Empty; DataDeNastere = string.Empty; NrDeTelefon = 0; Email = string.Empty; IdPersoana = IdUltimaPersoana; IdUltimaPersoana++; Grupul = Grup.Necunoscut; }
private void btn_GrupEkle_Click(object sender, EventArgs e) { Grup g = new Grup(); g.GrupAdi = txt_GrupAdi.Text; Program.GrupRep.Ekle(g); ListeYenile(); txt_GrupAdi.Clear(); Program.EkranGuncelle(); }
private void button1_Click(object sender, EventArgs e) { Grup yeniGrup = new Grup(); yeniGrup.GrupAdi = txtGrupAdi.Text; Program.GrupRep.Ekle(yeniGrup); ListeYenile(); txtGrupAdi.Clear(); // listBoxGrupList.Items.Add(yeniGrup); Program.EkranGuncelle(); }
private void SearchContent(Grup grup) { if (grup != null && grup.DirectId > 0) { var DirectionName = _context.Directions.Where(x => x.DirectionId == grup.DirectId).FirstOrDefault().Name; ViewData["DirectionId"] = DirectionName; } else { ViewData["DirectionId"] = "Yo'nalish aniqlanmadi"; } }
public Persoana(string _nume, string _prenume, string _email, string _numar, Grup _grup, DateTime _dataNasterii, DateTime _dataActualizare, Gen _gen) { //constructor cu datele de initializare separate Nume = _nume; Prenume = _prenume; Email = _email; NumarTelefon = _numar; grup = _grup; DataNasterii = _dataNasterii; DataActualizare = _dataActualizare; Gen = _gen; }
public ActionResult Create([Bind(Include = "Id,GrupAdi,Lokasyon_Id")] Grup grup) { if (ModelState.IsValid) { db.Grup.Add(grup); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Lokasyon_Id = new SelectList(db.Lokasyon, "Id", "LokasyonAdi", grup.Lokasyon_Id); return(View(grup)); }