Пример #1
0
        public void DeleteCard(int CardId)
        {
            Htl_Cards comm         = entities.Htl_Cards.Where(u => u.CardId == CardId).FirstOrDefault();
            Htl_Cards datatodelete = entities.Htl_Cards.FirstOrDefault(m => m.CardId == comm.CardId);

            entities.DeleteObject(datatodelete);
            entities.SaveChanges();
        }
Пример #2
0
        public void UpdateCardToSoldStatus(CardViewModel modeltosave)
        {
            Htl_Cards comm = entities.Htl_Cards.Where(u => u.CardId == modeltosave.CardId).FirstOrDefault();

            comm.CardId       = modeltosave.CardId;
            comm.CardStatusId = modeltosave.CardStatusId;
            entities.ApplyCurrentValues(comm.EntityKey.EntitySetName, comm);
            entities.SaveChanges();
        }
Пример #3
0
        public bool CheckDuplicateCardNumber(string CardNumber)
        {
            Htl_Cards Cards = entities.Htl_Cards.Where(ii => ii.CardNumber == CardNumber).FirstOrDefault();

            if (Cards != null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Пример #4
0
        public void CreateIssueCard(CardViewModel model)
        {
            Htl_Cards obj = new Htl_Cards
            {
                CardId = model.HFCardId,

                CardStatusId = model.CardStatusId,
                UpdatedBy    = model.UpdatedBy,
                UpdatedDate  = model.UpdatedDate,
            };

            entities.ApplyCurrentValues(obj.EntityKey.EntitySetName, obj);
            entities.SaveChanges();
        }
Пример #5
0
        public void UpdateCardStatus(CardViewModel modeltosave)
        {
            Htl_Cards comm = entities.Htl_Cards.Where(u => u.CardId == modeltosave.HFCardId).FirstOrDefault();

            comm.CardId     = modeltosave.HFCardId;
            comm.CardNumber = modeltosave.CardNumber;
            comm.CardTypeId = modeltosave.CardTypeId;
            comm.CardValue  = modeltosave.CardValue;

            comm.isActive     = modeltosave.isActive;
            comm.ValidTill    = modeltosave.ValidTill;
            comm.CardStatusId = modeltosave.CardStatusId;

            entities.ApplyCurrentValues(comm.EntityKey.EntitySetName, comm);
            entities.SaveChanges();
            /////
        }
Пример #6
0
        public void CreateCard(CardViewModel model)
        {
            Htl_Cards obj = new Htl_Cards
            {
                CardNumber   = model.CardNumber,
                CardStatusId = model.CardStatusId,
                ValidTill    = model.ValidTill,
                CardTypeId   = model.CardTypeId,
                CardValue    = model.CardValue,
                isActive     = model.isActive,
                CreatedBy    = model.CreatedBy,
                CreatedDate  = DateTime.Now,
                CardRule     = model.CardRule,
            };

            entities.AddToHtl_Cards(obj);
            entities.SaveChanges();
        }
        public int GetCardIdByCardNumber(string CardNumber)
        {
            Htl_Cards comm = entities.Htl_Cards.Where(u => u.CardNumber == CardNumber).FirstOrDefault();

            return(comm.CardId);
        }