Пример #1
0
        public static List <CardDetails> RetrieveAvailablePregeneratedCards()
        {
            try
            {
                string key = System.Configuration.ConfigurationManager.AppSettings.Get("ekey");

                var returnedPregeneratedCards = new List <CardDetails>();

                var pregeneratedCards = CardDL.RetrieveAvailablePregeneratedCards();

                pregeneratedCards.ForEach(pregeneratedCard =>
                {
                    CardDetails pCard = new CardDetails
                    {
                        ID           = pregeneratedCard.ID,
                        CardNumber   = Crypter.Decrypt(key, pregeneratedCard.CardNumber),
                        Issued       = Convert.ToBoolean(pregeneratedCard.Status),
                        Branch       = pregeneratedCard.Branch1.Name,
                        BranchID     = pregeneratedCard.Branch1.ID,
                        DateUploaded = Convert.ToDateTime(pregeneratedCard.DateUploaded).ToString("MM/dd/yyyy")
                    };

                    returnedPregeneratedCards.Add(pCard);
                });

                return(returnedPregeneratedCards);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public static CardDetails GetCardSerialNumber(string loggedInUsername)
        {
            try
            {
                string key = System.Configuration.ConfigurationManager.AppSettings.Get("ekey");

                var returnedPregeneratedCard = new CardDetails();

                var pregeneratedCard = CardDL.GetCardSerialNumber(loggedInUsername);

                if (pregeneratedCard != null)
                {
                    CardDetails pCard = new CardDetails
                    {
                        ID           = pregeneratedCard.ID,
                        CardNumber   = Crypter.Decrypt(key, pregeneratedCard.CardNumber),
                        Issued       = Convert.ToBoolean(pregeneratedCard.Status),
                        Branch       = pregeneratedCard.Branch1.Name,
                        BranchID     = pregeneratedCard.Branch1.ID,
                        DateUploaded = Convert.ToDateTime(pregeneratedCard.DateUploaded).ToString("MM/dd/yyyy")
                    };

                    returnedPregeneratedCard = pCard;
                }
                else
                {
                    returnedPregeneratedCard = null;
                }

                return(returnedPregeneratedCard);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }