public List <BankCard> GetBankCardByUserId(int userId) { var bankCards = new List <CreditCardDAL>(); using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); SqlCommand cmd = new SqlCommand(PS_GetBankCardByUserId, conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@UserId", userId)); using (SqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { var bankCard = new CreditCardDAL(); bankCard.CardNumber = (string)rdr["CardNumber"]; bankCard.ExpirationDate = (DateTime)rdr["ExpirtionDate"]; bankCard.Name = (string)rdr["Label"]; bankCard.SecurityCode = (int)rdr["SecurityCode"]; bankCards.Add(bankCard); } } } var userCreditCard = bankCards.Select(bankCard => bankCard.ToDoamin()).ToList(); return(userCreditCard); }
protected override void OnAppearing() { base.OnAppearing(); BindingContext = Bill; if (Bill != null && Bill.Id != 0) { CreditCardDAL creditCardDAL = new CreditCardDAL(); btn.Text = creditCardDAL.Find(Bill.CreditCarkId).CardNumber; } }
/// <summary> /// Registra o cartão de crédito informado na transação /// </summary> /// <param name="creditCard"></param> public void Inserir(CreditCard creditCard) { CreditCardDAL dal = new CreditCardDAL(); //busca o cartão de crédito pelo número var Exist = dal.GetCreditCard(creditCard.card_number); //se não existir insere o novo registro if (!Exist) { dal.Inserir(creditCard); } }
public async Task btn_Click(object sender, EventArgs e) { if (btn.Text != null) { CreditCardDAL creditCardDAL = new CreditCardDAL(); var credit = creditCardDAL.Find(btn.Text); if (credit != null) { CreditCardDetail creditCardDetail = new CreditCardDetail(); creditCardDetail.CreditCard = credit; await Navigation.PushAsync(creditCardDetail); } } }
protected override void OnStart() { base.OnStart(); var status = CrossPermissions.Current.CheckPermissionStatusAsync(Plugin.Permissions.Abstractions.Permission.Sms); if (PermissionStatus.Granted == status.Result) { CreditCardDAL creditCardDAL = new CreditCardDAL(); string BankPhone = creditCardDAL.FindAllBankPhone(); SMSTimeDAL sMSTimeDAL = new SMSTimeDAL(); string timeStamp = sMSTimeDAL.FindTimeStamp(); GetAllMessage(BankPhone, timeStamp); AddMessage(); } else { MessageList.NoSMSPermissionTip(); } CreditCardList.AddCardGetSMS = GetAllMessage; }
public void delete(object sender, EventArgs e) { CreditCardDAL dal = new CreditCardDAL(); dal.DeleteAll(); }
public void query(object sender, EventArgs e) { CreditCardDAL dal = new CreditCardDAL(); TableQuery<CreditCard> list = dal.FindList(1, 10); }