public int CreateBaseApplication(BaseCardApplicationModel model) { PaymentCardApplication application = new PaymentCardApplication() { UserId = model.UserId, TypeId = model.CardTypeId, CreationDate = model.CreationDate }; context.Entry(application).State = System.Data.Entity.EntityState.Added; context.SaveChanges(); return(application.Id); }
public int CreateBaseCard(PaymentCardApplication model) { try { Random rand = new Random(); PaymentCards card = new PaymentCards() { UserId = model.UserId, TypeId = model.TypeId, CreationDate = DateTime.Now, CardSecurityCode = rand.Next(100, 999).ToString(), ExpirationDate = DateTime.Now.AddYears(3), IsBlocked = false, PIN = rand.Next(1000, 9999), CardNumber = CreateFakeCreditCardNumber("22", 13) }; context.Entry(card).State = System.Data.Entity.EntityState.Added; context.SaveChanges(); return(card.Id); } catch (Exception ex) { return(0); } }
public string PaymentCardApplicationNotice(PaymentCardApplication enumPaymentCardApplicationStatus, PaymentGatewayMode enumPaymentGatewayMode, decimal decPaymentAmount, string strCurrencyCode) { string strNotice = ""; if (enumPaymentGatewayMode == PaymentGatewayMode.MerchantSiteCapturesCardDetails) { if (enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeOnly) { strNotice = (String)GetGlobalResourceObject("SiteResources", "PaymentCardGuaranteeOnly"); } else if (enumPaymentCardApplicationStatus == PaymentCardApplication.DepositOnly) { strNotice = (String)GetGlobalResourceObject("SiteResources", "PaymentCardDepositOnly"); } else if (enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeAndDeposit) { strNotice = (String)GetGlobalResourceObject("SiteResources", "PaymentCardGuaranteeAndDeposit"); } } else if (enumPaymentGatewayMode == PaymentGatewayMode.PaymentGatewayCapturesCardDetails) { if (enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeOnly) { strNotice = (String)GetGlobalResourceObject("SiteResources", "AltPaymentCardGuaranteeOnly"); } else if (enumPaymentCardApplicationStatus == PaymentCardApplication.DepositOnly) { strNotice = (String)GetGlobalResourceObject("SiteResources", "AltPaymentCardDepositOnly"); } else if (enumPaymentCardApplicationStatus == PaymentCardApplication.GuaranteeAndDeposit) { strNotice = (String)GetGlobalResourceObject("SiteResources", "AltPaymentCardGuaranteeAndDeposit"); } } strNotice = strNotice.Replace("{deposit_amount}", decPaymentAmount.ToString(this.CurrencyFormat())); strNotice = strNotice.Replace("{deposit_currency}", strCurrencyCode); return strNotice; }