public DeleteProductViewModel GetDeleteMasaViewModel(int id) { Masa masa = this.Context.Masi.Find(id); DeleteProductViewModel model = Mapper.Map <Masa, DeleteProductViewModel>(masa); return(model); }
public ActionResult AddMasa(Masa _masa) { if (ModelState.IsValid) { if (_masa == null) { logger.Error($"{_masa} is empty|Error|"); } else { var karar = ms.Any(x => x.Not == _masa.Not); if (!karar) { ms.Add(_masa); ms.Save(); logger.Info($"{_masa.Not}:isimli masa eklendi-MasaID: {_masa.ID}"); TempData["added"] = "added"; return(RedirectToAction("Index", "Masa")); } else { logger.Error($"{_masa.Not}:isimli bir masa bulunmaktadır.|Error|"); return(View(TempData["hata"] = "Eklediğiniz isimde masa bulunmaktadır.Farklı bir isim ile yeniden deneyiniz.")); } } return(View("AddMasa", _masa)); } else { return(View()); } }
public void AddMasi(IzdeliqBindingModel model) { Masa masa = new Masa() { CatNumber = model.CatNumber, Color = model.Color, Description = model.Description, Price = model.Price, Name = model.Name, Razmeri = model.Razmeri, Type = model.Type, NalichnostBr = model.NalichnostBr }; Supplier supplier = this.Context.Suppliers.Find(model.SupplierId); masa.Supplier = supplier; if (model.ImageName != null && model.ImageName.ContentLength > 0) { using (var reader = new BinaryReader(model.ImageName.InputStream)) { masa.ImagePicture = reader.ReadBytes(model.ImageName.ContentLength); } } this.Context.Masi.Add(masa); this.Context.SaveChanges(); }
public FullProductViewModel GetMasaById(int id) { Masa masa = this.Context.Masi.Find(id); FullProductViewModel model = Mapper.Map <Masa, FullProductViewModel>(masa); return(model); }
public ActionResult MultiBitir() { MultiBitirViewModel model = new MultiBitirViewModel(); if (Session[SessionNames.MASA] == null) { return(Content("Bitmis")); } Guid masaId = Session[SessionNames.MASA].ToString().toGuid(); Guid userId = User.Identity.GetUserId().toGuid(); using (BilgiYarismasiEntities2 ent = new BilgiYarismasiEntities2()) { Masa masa = ent.Masa.Where(p => p.Id == masaId).FirstOrDefault(); Yarisma yarisma = masa.MasaKullanici .Where(p => p.KullaniciId == userId) .FirstOrDefault() .Yarisma.FirstOrDefault(); int?toplamPuan = ent.YarismaSoru .Where(p => p.Yarisma.MasaKullanici.KullaniciId == userId) .Where(p => p.Yarisma.BitisTarihi.HasValue) .Sum(p => p.Puan); int?yarismaPuan = ent.YarismaSoru .Where(p => p.Yarisma.MasaKullanici.KullaniciId == userId) .Where(p => p.YarismaId == yarisma.Id) .Sum(p => p.Puan); model.toplam = yarisma.SoruSayisi; model.cevaplanan = yarisma.YarismaSoru.Where(p => p.CevapId.HasValue).Count(); model.dogruSayisi = 0; model.yanlisSayisi = 0; model.yarismadanKazandiPuan = yarismaPuan.HasValue?yarismaPuan.Value:0; model.toplamPuan = toplamPuan.HasValue ? toplamPuan.Value : 0; foreach (var item in yarisma.YarismaSoru) { if (item.CevapId.HasValue) { if (item.Cevap.Dogrumu) { model.dogruSayisi++; } else { model.yanlisSayisi++; } } } masa.BitisTarihi = DateTime.Now; yarisma.BitisTarihi = masa.BitisTarihi; ent.SaveChanges(); } return(View(model)); }
public ActionResult Create(Masa masa) { int sess = Convert.ToInt32(Session["userID"]); try { var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var stringChars = new char[16]; var random = new Random(); for (int i = 0; i < stringChars.Length; i++) { stringChars[i] = chars[random.Next(chars.Length)]; } var finalString = new String(stringChars); masa.qrHash = finalString; Console.WriteLine("finalString:" + finalString); masa.qrFoto = GenerateQRCode(masa.qrHash, masa.masaNo); masa.userID = sess; masa.qrUrl = url; db.Masas.Add(masa); db.SaveChanges(); } catch (Exception ex) { } return(RedirectToAction("Index", "Masa")); }
protected void Page_Load(object sender, EventArgs e) { if (Masa.secilenMasa != null) { masaNo.Text = Masa.secilenMasa.masaAdi; } foreach (var item in Masa.listeGetir()) { if (item.masaTipi == MasaTipi.Bos) { item.masaButton.Click += masaSec; } else { item.masaButton.OnClientClick = "return false;"; } masalar.Controls.Add(item.masaButton); if (item.masaID <= 9) { kucukMasalar.InnerHtml += item.kucukMasa; } else { buyukMasalar.InnerHtml += item.kucukMasa; } } }
public Masa Create(Masa masa) { var result = _context.Add <Masa>(masa); _context.SaveChanges(); return(result.Entity); }
public Masa Delete(Masa masa) { var result = _context.Remove(masa); _context.SaveChanges(); return(result.Entity); }
public Masa MasaGetir(int id) { string commandText = "Exec spMasaBilgileriMasasi @BilgiId"; _sqlConnection = new SqlConnection(yol); Masa masa = new Masa(); if (_sqlConnection.State == ConnectionState.Closed) { _sqlConnection.Open(); } _sqlCommand = new SqlCommand(commandText, _sqlConnection); _sqlCommand.Parameters.AddWithValue("@BilgiId", id); SqlDataReader reader = _sqlCommand.ExecuteReader(); while (reader.Read()) { masa.MasaId = reader["MasaId"].ToString(); masa.MusaitlikDurumu = Convert.ToBoolean(reader["MusaitlikDurumu"]); } reader.Close(); _sqlConnection.Close(); return(masa); }
public void DeleteMasi(DeleteIzdelieBindingModel model) { Masa masa = this.Context.Masi.Find(model.Id); this.Context.Masi.Remove(masa); this.Context.SaveChanges(); }
public Pizza(string nombre, Tamanio tamanio, Masa masa, Salsa salsa, List <Ingredientes> ingredientes) { this.Nombre = nombre; this.Tamanio = tamanio; this.Masa = masa; this.Salsa = salsa; this.Ingredientes = ingredientes; }
static void Main(string[] args) { //Dolap dolap = new Dolap(); Masa masa = new Masa(); Sandalye.Sandalye sandalye = new Sandalye.Sandalye(); Oda oda = new Oda(); }
public void AddMasa(Masa b) { b.cod_unic = Validari.Validare_Cod_Unic(b, NumeFisier); using (StreamWriter swFisierText = new StreamWriter(NumeFisier, true)) { swFisierText.WriteLine(b.ConversieLaSir_PentruScriereInFisier()); } }
public async void AddTable(Masa masa, string userName) { var user = await _userManager.FindByNameAsync(userName); masa.Restoran = user; masa.RestoranId = user.Id; _context.Set <Masa>().Add(masa); var result = await _context.SaveChangesAsync(); }
public ActionResult Siparis(Masa _masa) { Masa x = ms.GetByDefault(a => a.ID == _masa.ID); List <Adisyon> aliste = svc.GetDefault(a => a.MasaId == x.ID); List <Adisyon> aktif = aliste.FindAll(a => a.Statu == Core.Entity.Enums.Status.Active); return(View(Tuple.Create(aktif, us.GetirListe(), x))); }
private void masayaSoruEkle(BilgiYarismasiEntities2 ent, Masa masa) { var masaKullanicilar = masa.MasaKullanici.Where(p => p.Tip != (int)enmMasaKullaniciTipi.Izleyici).ToList(); var eskiSorular = masa.MasaKullanici.FirstOrDefault().Yarisma.FirstOrDefault().YarismaSoru .Select(p => p.SoruId) .ToList(); var yeniSoruId = masa.Konu.Soru .Where(p => !eskiSorular.Any(t => t == p.Id)) .OrderBy(p => Guid.NewGuid()).FirstOrDefault().Id; foreach (var mitem in masaKullanicilar) { Yarisma yarisma = mitem.Yarisma.FirstOrDefault(); YarismaSoru yarismaSoru = new YarismaSoru(); yarismaSoru.Id = Guid.NewGuid(); yarismaSoru.SiraNo = yarisma.YarismaSoru.Count() + 1; yarismaSoru.SoruId = yeniSoruId; yarismaSoru.YarismaId = yarisma.Id; if (yarisma.MasaKullanici.Masa.Tip == (int)EnmMasaTipi.MultiPlayerMasa) { yarismaSoru.GosterimTarihi = DateTime.Now.AddSeconds(2); } ent.YarismaSoru.Add(yarismaSoru); var mDogruCevap = yarismaSoru.Soru.Cevap.Where(p => p.Dogrumu).FirstOrDefault(); //yarismaSoru.CevapId = mDogruCevap.Id; var cevaplar = yarismaSoru.Soru.Cevap .Where(p => !p.Dogrumu) .OrderBy(p => Guid.NewGuid()) .Take(yarismaSoru.Soru.SecenekSayisi.HasValue ? yarismaSoru.Soru.SecenekSayisi.Value - 1 : 3) .ToList(); cevaplar.Add(mDogruCevap); cevaplar = cevaplar.OrderBy(p => Guid.NewGuid()).ToList(); foreach (var cevap in cevaplar) { YarismaSoruCevap yarismaSoruCevap = new YarismaSoruCevap(); yarismaSoruCevap.CevapId = cevap.Id; yarismaSoruCevap.Id = Guid.NewGuid(); yarismaSoruCevap.YarismaSoruId = yarismaSoru.Id; ent.YarismaSoruCevap.Add(yarismaSoruCevap); } yarisma.SoruSayisi++; ent.SaveChanges(); } }
public ActionResult deletedMasa(Masa _masa) { Masa deleted = ms.GetByDefault(x => x.ID == _masa.ID); ms.Delete(deleted.ID); TempData["delete"] = "delete"; return(RedirectToAction("Index")); }
public ActionResult Disable(Masa _masa) { Masa x = ms.GetByDefault(a => a.ID == _masa.ID); List <Adisyon> aliste = svc.GetDefault(a => a.MasaId == x.ID); aliste.Select(a => { a.Statu = Core.Entity.Enums.Status.Deleted; return(a); }).ToList(); svc.Save(); return(RedirectToAction("Index", "Home")); }
public ActionResult uruncikar(Masa id, Adisyon adisyon) { Adisyon deleteA = svc.GetByDefault(x => x.ID == adisyon.ID); deleteA.Statu = Core.Entity.Enums.Status.Deleted; svc.Save(); TempData["Urunİptal"] = "Urunİptal"; return(RedirectToAction("Index", "Home")); }
private void masaEkle() { for (int i = 0; i < 12; i++) { Masa masa = new Masa { id = i, masaKodu = i.ToString(), masaAdi = "Masa-" + i.ToString() }; masalar.Add(masa); } }
public static Masa AddMasa_Citire_Consola() { string locuri; int locatie_masa = 0; Masa m; do { Console.WriteLine("\nIntroduceti informatiile despre masa pe care doriti sa o adaugati:"); Console.WriteLine("\t-Numar locuri:"); locuri = Console.ReadLine(); Console.WriteLine("\tLocatie masa:"); Console.WriteLine("1. Interior"); Console.WriteLine("2. Separeu"); Console.WriteLine("3. Terasa"); bool gasit; do { gasit = false; try { Console.WriteLine("\nIntroduceti cifra corespunzatoare optiunii dorite: "); locatie_masa = Convert.ToInt32(Console.ReadLine()); } catch (FormatException) { Console.WriteLine("Optiune inexistenta!"); gasit = true; } if (gasit == false) { if (locatie_masa < 1 || locatie_masa > 3) { Console.WriteLine("Optiune inexistenta!"); gasit = true; } else { gasit = false; } } } while (gasit == true); string add = $"{locuri};{Convert.ToString((Locatie)locatie_masa)}"; //bool consola = true; m = new Masa(add);//, consola); } while (m.locuri == -1); return(m); }
public JsonResult DeleteMasaRecord(int masaID) { bool result = false; Masa usr = db.Masas.Find(masaID); if (usr != null) { //db.Bildirims.Remove(usr); db.Masas.Remove(usr); db.SaveChanges(); result = true; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult getMasaBekle() { Guid masaId = Session[SessionNames.MASA].ToString().toGuid(); Guid userId = User.Identity.GetUserId().toGuid(); MultiMasaKullaniciTemizle(); using (BilgiYarismasiEntities2 ent = new BilgiYarismasiEntities2()) { Masa masa = ent.Masa.FirstOrDefault(p => p.Id == masaId); var masaKullanicilar = ent.MasaKullanici .Where(p => p.MasaId == masaId) .OrderBy(p => p.SiraNo) .ToList(); int mSiraNo = 0; foreach (var item in masaKullanicilar) { mSiraNo++; item.Tip = mSiraNo == 1 ? (int)enmMasaKullaniciTipi.Yonetici : (int)enmMasaKullaniciTipi.Yarismaci; if (mSiraNo > masa.KisiSayisi) { item.Tip = (int)enmMasaKullaniciTipi.Izleyici; } item.SiraNo = mSiraNo; } var masaKullanici = masaKullanicilar.FirstOrDefault(p => p.KullaniciId == userId); masaKullanici.Ping = DateTime.Now; ent.SaveChanges(); if (masaKullanicilar.Count >= masa.KisiSayisi) { return(Content("1")); } StringBuilder sb = new StringBuilder(); int i = 0; foreach (var item in masaKullanicilar) { i++; sb.AppendFormat("{1} nolu yarışmacı yarışmaya katıldı: {0} <br />", item.Kullanici.Nick, i); } return(Content(sb.ToString())); } }
public ActionResult SingleBasla(Guid id) { Session[SessionNames.KONU] = id; using (BilgiYarismasiEntities2 ent = new BilgiYarismasiEntities2()) { Konu konu = ent.Konu.Where(p => p.Id == id).FirstOrDefault(); Masa masa = new Masa(); masa.Id = Guid.NewGuid(); masa.KisiSayisi = 1; masa.KonuId = id; masa.SoruSayisi = 0; masa.SureDk = konu.SureDk; masa.Tip = (int)EnmMasaTipi.SinglePlaeyerMasa; masa.KayitTarihi = DateTime.Now; masa.BaslangicTarihi = masa.KayitTarihi; ent.Masa.Add(masa); MasaKullanici masaKullanici = new MasaKullanici(); masaKullanici.Id = Guid.NewGuid(); masaKullanici.KullaniciId = User.Identity.GetUserId().toGuid(); masaKullanici.MasaId = masa.Id; masaKullanici.SiraNo = 1; masaKullanici.Tip = (int)enmMasaKullaniciTipi.Yonetici; masaKullanici.KayitTarihi = DateTime.Now; ent.MasaKullanici.Add(masaKullanici); Yarisma yarisma = new Yarisma(); yarisma.BaslangicTarihi = DateTime.Now; yarisma.Id = Guid.NewGuid(); yarisma.MasaKullaniciId = masaKullanici.Id; yarisma.SoruSayisi = 0; yarisma.SureDk = masa.SureDk; ent.Yarisma.Add(yarisma); ent.SaveChanges(); yarismayaSoruEkle(ent, yarisma); ent.SaveChanges(); Session[SessionNames.MASA] = masa.Id; } return(RedirectToAction("SingleYaris")); }
public ActionResult SingleYaris(SingleYarisViewModel model) { if (model.cevapId == null || model.cevapId == Guid.Empty) { return(RedirectToAction("SingleYaris")); } var aktifMasa = Utils.AktifMasa; if (aktifMasa == null) { return(RedirectToAction("index")); } using (BilgiYarismasiEntities2 ent = new BilgiYarismasiEntities2()) { Masa masa = ent.Masa.Where(p => p.Id == aktifMasa.Id).FirstOrDefault(); Yarisma yarisma = masa.MasaKullanici.FirstOrDefault() .Yarisma.OrderBy(p => p.BaslangicTarihi).FirstOrDefault(); YarismaSoru yarismaSoru = yarisma.YarismaSoru.OrderBy(p => p.SiraNo).LastOrDefault(); Cevap cevap = ent.Cevap.Where(p => p.Id == model.cevapId).FirstOrDefault(); if (yarismaSoru.SiraNo != model.SiraNo) { return(RedirectToAction("SingleYaris")); } yarismaSoru.CevapId = model.cevapId; if (cevap.Dogrumu) { yarismaSoru.Puan = YarismaDegerler.BaslangicPuani; } ent.SaveChanges(); if (yarisma.YarismaSoru.Count() >= masa.Konu.Soru.Count()) { return(RedirectToAction("SingleBitir")); } yarismayaSoruEkle(ent, yarisma); ent.SaveChanges(); } return(RedirectToAction("SingleYaris")); }
//public static bool MasaEkle(int masaNo, int kafeID, string Durum) //{ // using( var connection = CreateConnection()) // { // SqlCommand cmd = new SqlCommand("INSERT INTO Masalar (MasaNo, KafeID, Durum) VALUES (@masaNo, @kafeID, @durum)", connection); // cmd.Parameters.AddWithValue("@masaNo", masaNo); // cmd.Parameters.AddWithValue("@kafeID", kafeID); // cmd.Parameters.AddWithValue("@durum", Durum); // int result = cmd.ExecuteNonQuery(); // if (result > 0) // return true; // return false; // } //} public static int MasaEkle(Masa masa) { using (var connection = CreateConnection()) { SqlCommand cmd = new SqlCommand("INSERT INTO Masalar (MasaNo, KafeID, Durum, KisiSayisi) VALUES (@masaNo, @kafeID, @durum, @kisiSayisi); SELECT scope_identity()", connection); cmd.Parameters.AddWithValue("@masaNo", masa.MasaNo); cmd.Parameters.AddWithValue("@kafeID", masa.Kafe.ID); cmd.Parameters.AddWithValue("@durum", masa.Durum.ToString()); cmd.Parameters.AddWithValue("@kisiSayisi", masa.KisiSayisi); int masaID = Convert.ToInt32(cmd.ExecuteScalar()); return(masaID); } }
// GET: Admin/UrunSiparis public ActionResult Index(Masa _id) { Adisyon ads = new Adisyon(); ads.MasaId = _id.ID; ads.siparis = rnd.Next(); svc.Add(ads); Masa masa = ms.GetById(_id.ID); masa.AdisyonId = ads.ID; return(View(Tuple.Create(us.GetirListe(), masa))); }
private void FormuTemizle(bool kodHaric) { _masaId = 0; _sonMasaAdi = string.Empty; _masa = new Masa(); _masaGetiriliyor = false; CommonHelper.AlanlariTemizle(layoutControlGroup2, kodHaric ? new string[] { txtMasaAdi.Name } : null); CommonHelper.DegerleriTagaAl(layoutControlGroup2); btnKaydet.Visible = true; btnYeni.Visible = true; btnSil.Enabled = false; _guncelle = false; txtMasaAdi.Focus(); }
private void masaClick(object sender, EventArgs e) { SimpleButton btn = (SimpleButton)sender; Masa masa = masalar.SingleOrDefault(c => c.masaKodu == btn.Name); if (masa.hareketler == null) { masa.hareketler = new List <UrunHareket>(); } seciliMasa = masa.masaKodu; gridControl1.DataSource = masa.hareketler; toplamTxt.Value = Convert.ToDecimal(colToplam.SummaryItem.SummaryValue); }