Esempio n. 1
0
        public static Cards GetChargeCards(string typeCode, decimal parValue)
        {
            try
            {
                lock (lockObj)
                {
                    ChargeAccountType AccountType = SQLChargeAccountType.GetChargeAccountType(p => p.Code == typeCode).FirstOrDefault();
                    Cards             cards       = GetCards(p => p.ChargeAccountTypeID == AccountType.ChargeAccountTypeID &&
                                                             p.IsAvailable == true &&
                                                             p.ReChargeStatus == 0 &&
                                                             p.Price == parValue).FirstOrDefault();

                    cards.ReChargeStatus = 1;

                    if (UpdateCards(cards))
                    {
                        return(cards);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(null);
        }
Esempio n. 2
0
        public static OrderChargeAccount GetChargeAccount_i(string typeCode, bool isReadonly)
        {
            try
            {
                ChargeAccountType AccountType = SQLChargeAccountType.GetChargeAccountType(p => p.Code == typeCode).FirstOrDefault();

                OrderChargeAccount orderChargeAccount = GetOrderChargeAccount(p => p.ChargeAccountTypeID == AccountType.ChargeAccountTypeID &&
                                                                              p.IsAvailable == true && p.IsUsing == false).OrderBy(p => p.UseTimes).FirstOrDefault();
                if (orderChargeAccount == null)
                {
                    return(null);
                }
                if (isReadonly)
                {
                    orderChargeAccount.IsUsing = true;
                    if (UpdateOrderChargeAccount(orderChargeAccount))
                    {
                        return(orderChargeAccount);
                    }
                }
                else
                {
                    return(orderChargeAccount);
                }
            }
            catch (Exception)
            {
            }
            return(null);
        }