コード例 #1
0
        public bool AddExtraAndGTrans(ExtraTransactions Ex, int GId)
        {
            using (var trans = ent.Database.BeginTransaction())
            {
                bool Sonuc = false;
                try
                {
                    ent.ExtraTransactions.Add(Ex);
                    ent.SaveChanges();

                    GuestTransaction g = new GuestTransaction();
                    g.Date        = Ex.TransactionDate;
                    g.TransType   = "Extra Ücreti";
                    g.Debt        = Ex.Sum;
                    g.Credit      = 0;
                    g.GuestId     = Ex.GuestId;
                    g.Status      = true;
                    g.Description = "";
                    ent.GuestTransactions.Add(g);
                    ent.SaveChanges();

                    trans.Commit();
                    Sonuc = true;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    string hata = ex.Message;
                }
                return(Sonuc);
            }
        }
コード例 #2
0
        private void btnDuzenle_Click(object sender, EventArgs e)
        {
            if (txtDegisenAdet.Text.Trim() != "" && txtDegisenTutar.Text.Trim() != "" && ExId != 0)
            {
                ExtraTransactions ext = new ExtraTransactions();
                ext.Id              = ExId;
                ext.RoomId          = RmId;
                ext.TransactionDate = Exdt;
                ext.TypeId          = TypId;
                ext.GuestId         = ExGId;
                ext.Status          = true;
                ext.Deleted         = false;
                ext.Unit            = Convert.ToInt32(txtDegisenAdet.Text);
                ext.Sum             = Convert.ToDecimal(txtDegisenTutar.Text);

                if (Er.UpdateExtraTrans(ext))
                {
                    MessageBox.Show("Eklendi");
                    GridDuzenle2(Er.GetExtraTransactions(GId));
                }
                else
                {
                    MessageBox.Show("Düzenleme İşlemi Başarısız oldu.");
                }
            }
            else
            {
                MessageBox.Show("Eksik Bilgi Girişi");
            }
        }
コード例 #3
0
        public ExtraTransactions GetExtraType(int ID)
        {
            ExtraTransactions sonuc = (from ex in ent.ExtraTransactions
                                       where ex.RoomId == ID && ex.Deleted == false && ex.Status == true
                                       select ex).FirstOrDefault();

            return(sonuc);
        }
コード例 #4
0
        public ExtraTransactions GetExtraType(int ID)
        {
            ExtraTransactions sonuc = (from ex in ent.ExtraTransactions
                                       where ex.RoomId == ID
                                       select ex).FirstOrDefault();

            return(sonuc);
        }
コード例 #5
0
        private void btnOda_Click(object sender, EventArgs e)
        {
            if (txtOdaNo.Text.Trim() != "")
            {
                ExtraTransactions ex = new ExtraTransactions();
                ex.TypeId  = ExtraTypeId;
                ex.RoomId  = RId;
                ex.GuestId = GId;
                try
                {
                    ex.Unit = Convert.ToInt32(txtUnit.Text);
                }
                catch (Exception)
                {
                    throw;
                }
                try
                {
                    ex.Sum = Convert.ToDecimal(txtSum.Text);
                }
                catch (Exception)
                {
                    throw;
                }
                ex.TransactionDate = DateTime.Now;
                ex.Status          = true;
                ex.Deleted         = false;

                if (Er.AddExtraAndGTrans(ex, GId))
                {
                    MessageBox.Show("Extra harcaması yapıldı.");
                    Temizle();
                }
                else
                {
                    MessageBox.Show("İşlem gerçekleşmedi.");
                }
            }
            else
            {
                MessageBox.Show("Lütfen Oda Bilgilerini seçiniz.");
            }
        }
コード例 #6
0
        public bool DeleteExtra(int ID)
        {
            bool sonuc = false;
            ExtraTransactions degisen = (from e in ent.ExtraTransactions
                                         where e.Id == ID
                                         select e).FirstOrDefault();

            degisen.Deleted = true;
            try
            {
                ent.SaveChanges();
                sonuc = true;
            }
            catch (Exception ex)
            {
                string hata = ex.Message;
            }
            return(sonuc);
        }
コード例 #7
0
        public bool UpdateExtraTrans(ExtraTransactions Ex)
        {
            bool sonuc = false;
            ExtraTransactions degisen = (from e in ent.ExtraTransactions
                                         where e.Id == Ex.Id
                                         select e).FirstOrDefault();

            degisen.Sum  = Ex.Sum;
            degisen.Unit = Ex.Unit;
            try
            {
                ent.SaveChanges();
                sonuc = true;
            }
            catch (Exception ex)
            {
                string hata = ex.Message;
            }
            return(sonuc);
        }
コード例 #8
0
 public bool AddExtraTrans(ExtraTransactions Ex)
 {
     throw new NotImplementedException();
 }