public static GuestModel GetGuest(int year, int guestId) { return(GuestRepository.GetGuest(year, guestId)); }
private void btnOnayla_Click(object sender, EventArgs e) { if (txtAdi.Text.Trim() == "" || txtSoyadi.Text == "" || txtTc.Text == "") { MessageBox.Show("Zorunlu alanlar girilmedi.", "Dikkat Eksik Bilgi!"); } Guest gue = new Guest(); gue.FirstName = txtAdi.Text; gue.LastName = txtSoyadi.Text; gue.IdentificationNo = txtTc.Text; gue.RoomId = Rp.GetRoomId(OdaNo); gue.Adress = txtAdres.Text; gue.Gender = cbCinsiyet.SelectedItem.ToString(); gue.Birthday = dtpDogumTarihi.Value; gue.ContactNo = txtTelefon.Text; gue.Email = txtEmail.Text; if (Giris.Date == DateTime.Now.Date) { gue.Status = true; } else { gue.Status = false; } if (Gp.AddGuest(gue)) { Guest gst = Gp.GetGuest(); Sale sa = new Sale(); sa.RoomId = gst.RoomId; sa.CheckIn = Giris; sa.CheckOut = Cikis; sa.NoOfGuests = Convert.ToInt32(cbMisafirSayisi.SelectedItem.ToString()); try { sa.TotalPrice = ToplamTutar; } catch (FormatException) { throw; } if (Giris.Date == DateTime.Now.Date) { sa.Status = true; } else { sa.Status = false; } sa.PersonnelId = General.PersonelId; sa.GuestId = gst.Id; if (Sp.AddSales(sa)) { GuestTransaction Gtr = new GuestTransaction(); Gtr.Date = DateTime.Now; /*if (Giris.Date == DateTime.Now.Date)*/ Gtr.TransType = "Konaklama Ücreti"; //else { gtrans.TransType = "Rezervasyon Ücreti"; } try { Gtr.Debt = ToplamTutar; } catch (FormatException) { throw; } Gtr.Credit = 0; Gtr.GuestId = gst.Id; Gtr.Status = true; if (Giris.Date == DateTime.Now.Date) { Gtr.Description = "Konaklama Açılış"; } else { Gtr.Description = "Rezervasyon"; } if (GTrans.AddGTrans(Gtr)) { MessageBox.Show("Kayıt yapıldı"); } else { MessageBox.Show("Misafir harekeleri oluşturulamadı"); } } else { MessageBox.Show("Satış Yapılamadı"); } } else { MessageBox.Show("Yapılmadı"); } }