public void CreateOrUpdate(CreditCardDTO cardDTO)
 {
     CreditCards card = cardRepository.Get(cardDTO.Id);
     card = mapper.Map<CreditCardDTO, CreditCards>(cardDTO);
     cardRepository.CreateOrUpdate(card);
     cardRepository.SaveChanges();
 }
        // GET: api/CreditCard
        public List <CreditCards> Get()
        {
            List <CreditCards> pomList = new List <CreditCards>();

            using (var conn = new NpgsqlConnection("Host = localhost; Port = 5555; Username = db_201617z_va_proekt_invoke_mk_owner; Password = invoke_finki; Database = db_201617z_va_proekt_invoke_mk"))
            {
                conn.Open();

                using (var cmd = new NpgsqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = "SELECT * from invoke.creditcards";

                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            CreditCards card = new CreditCards();
                            card.CardID            = reader.GetInt64(0);
                            card.UserID            = reader.GetInt64(1);
                            card.CustomerUserName  = reader.GetString(2);
                            card.CardNumber        = reader.GetString(3);
                            card.CardCvCode        = reader.GetInt64(4);
                            card.CardHolderName    = reader.GetString(5);
                            card.CardHolderSurName = reader.GetString(6);
                            card.CardDateTime      = (DateTime)reader.GetDateTime(7);
                            card.CardType          = reader.GetString(8);

                            pomList.Add(card);
                        }
                    }
                }
            }
            return(pomList);
        }
Пример #3
0
//-------------------------------------------------------------------------------------------
    public void UpdatePage()
    {
        using (WeavverEntityContainer data = new WeavverEntityContainer())
        {
            decimal balance = data.Total_ForLedger(SelectedOrganization.Id, LoggedInUser.OrganizationId, LedgerType.Receivable.ToString(), true, true, false, null, null);

            // data.Total_ForLedger(LoggedInUser.OrganizationId);

            var cards = (from items in data.Accounting_CreditCards
                         where items.OrganizationId == SelectedOrganization.Id
                         select items);

            CreditCards.DataSource     = cards;
            CreditCards.DataTextField  = "CensoredAccountNumber";
            CreditCards.DataValueField = "Id";
            CreditCards.DataBind();

            if (balance < 0)
            {
                decimal amount = balance * -1;
                MinimumPaymentDue.Text = "$" + amount.ToString();
                Balance.Text           = "$" + amount.ToString();
                PayBalanceAmount.Text  = "$" + amount.ToString();
            }
        }
    }
Пример #4
0
        public CreditCardItemViewModel(SecureItem item, System.Windows.Media.Brush defaultColor, ImageSource defaultIcon) : base(item, defaultColor, defaultIcon)
        {
            IsDefaultImage = false;
            type           = SecurityItemsDefaultProperties.SecurityItemType_DigitalWallet;
            subType        = SecurityItemsDefaultProperties.SecurityItemSubType_DW_CreditCard;
            InitializeCollections();



            NameOnCard = item.Data.nameOnCard;
            CardNumber = item.Data.cardNumber;

            if (item.Data.expires != null)
            {
                DateTime expires = new DateTime();
                if (DateTime.TryParse(item.Data.expires, out expires))
                {
                    ExpiresMonth = expires.ToUniversalTime().Month.ToString();
                    ExpiresYear  = expires.ToUniversalTime().Year.ToString();
                }
            }
            if (item.Data.cardType != null)
            {
                SelectedCreditCard = CreditCards.FirstOrDefault(x => x.Type == item.Data.cardType);
            }


            IssuingBank  = item.Data.issuingBank;
            SecurityCode = item.Data.security_code;
            PIN          = item.Data.pin;
            IssueDate    = item.Data.issueDate;
        }
        public UpdateCustomerMobileCreditCardResponse UpdateMobileCustomerCreditCard(CreditCards cards, string token)
        {
            UpdateCustomerMobileCreditCardResponse result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "CustomerMobile/UpdateMobileCustomerCreditCard");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(cards);
                    var buffer      = Encoding.UTF8.GetBytes(myContent);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");



                    var response = client.PostAsync(client.BaseAddress, byteContent).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        result = JsonConvert.DeserializeObject <UpdateCustomerMobileCreditCardResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Пример #6
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            CreditCard           cc      = (CreditCard)gridMain.Rows[e.Row].Tag;
            FormCreditCardManage FormCCM = new FormCreditCardManage(Patients.GetPat(cc.PatNum));

            FormCCM.ShowDialog();
            int totalCCs   = PIn.Int(textTotal.Text);
            int invalidCCs = PIn.Int(textInvalid.Text);
            List <CreditCard> listCardsForPat = CreditCards.Refresh(cc.PatNum);

            gridMain.BeginUpdate();
            for (int i = gridMain.Rows.Count - 1; i > -1; i--)     //loop through backwards and remove any cards that are no longer in the list
            {
                CreditCard ccGrid = (CreditCard)gridMain.Rows[i].Tag;
                if (cc.PatNum != ccGrid.PatNum)
                {
                    continue;
                }
                if (!listCardsForPat.Any(x => x.CreditCardNum == ccGrid.CreditCardNum))               //this row is one of the cards for the patient
                //if the card is no longer in the list of cards for the patient, it must have been deleted from FormCreditCardManage, remove from grid
                {
                    gridMain.Rows.RemoveAt(i);
                    _listCreditCards.RemoveAt(i);                    //so the list and grid contain the same number of items
                    //Valid cards may have been deleted as well, but we only maintain the count of invalids changing.
                    //Valid card count and total card count will be refreshed if/when the user presses the Check button again.
                    totalCCs--;                    //update total card count
                    invalidCCs--;                  //update invalid count
                }
            }
            gridMain.EndUpdate();
            textTotal.Text   = totalCCs.ToString();
            textInvalid.Text = invalidCCs.ToString();
        }
Пример #7
0
        private void butAddProc_Click(object sender, EventArgs e)
        {
            FormProcCodes FormP = new FormProcCodes();

            FormP.IsSelectionMode = true;
            FormP.ShowDialog();
            if (FormP.DialogResult != DialogResult.OK)
            {
                return;
            }
            string        procCode     = ProcedureCodes.GetStringProcCode(FormP.SelectedCodeNum);
            List <string> procsOnCards = CreditCardCur.Procedures.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();

            //If the procedure is already attached to this card, return without adding the procedure again
            if (procsOnCards.Exists(x => x == procCode))
            {
                return;
            }
            //Warn if attached to a different active card for this patient
            if (CreditCards.ProcLinkedToCard(CreditCardCur.PatNum, procCode, CreditCardCur.CreditCardNum))
            {
                if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "This procedure is already linked with another credit card on this patient's "
                                 + "account. Adding the procedure to this card will result in the patient being charged twice for this procedure. Add this procedure?"))
                {
                    return;
                }
            }
            if (CreditCardCur.Procedures != "")
            {
                CreditCardCur.Procedures += ",";
            }
            CreditCardCur.Procedures += procCode;
            FillProcs();
        }
Пример #8
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (CreditCardCur.IsNew)
     {
         DialogResult = DialogResult.Cancel;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Are you sure you want to delete this credit card?"))
     {
         return;
     }
     #region X-Charge
     //Delete the archived X-Charge token
     if (_isXChargeEnabled && CreditCardCur.XChargeToken != "")
     {
         if (CreditCardCur.IsXWeb())
         {
             OpenDentBusiness.WebTypes.Shared.XWeb.XWebs.DeleteCreditCard(PatCur.PatNum, CreditCardCur.CreditCardNum);                   //Also deletes cc from db
         }
         else
         {
             DeleteXChargeAlias();
         }
     }
     #endregion
     CreditCards.Delete(CreditCardCur.CreditCardNum);
     List <CreditCard> creditCards = CreditCards.Refresh(PatCur.PatNum);
     for (int i = 0; i < creditCards.Count; i++)
     {
         creditCards[i].ItemOrder = creditCards.Count - (i + 1);
         CreditCards.Update(creditCards[i]);                //Resets ItemOrder.
     }
     DialogResult = DialogResult.OK;
 }
Пример #9
0
 private void UpsertCreditCard(PaySimple.ApiResponse apiResponse, string ccNumberMasked, CreditCardSource ccSource, DateTime ccExp)
 {
     if (_creditCardCur == null)           //new account
     {
         _creditCardCur        = new CreditCard();
         _creditCardCur.IsNew  = true;
         _creditCardCur.PatNum = _patCur.PatNum;
         List <CreditCard> itemOrderCount = CreditCards.Refresh(_patCur.PatNum);
         _creditCardCur.ItemOrder = itemOrderCount.Count;
     }
     if (ccExp.Year > 1880)
     {
         _creditCardCur.CCExpiration = ccExp;
     }
     _creditCardCur.CCNumberMasked = ccNumberMasked;
     _creditCardCur.Zip            = textZipCode.Text;
     _creditCardCur.PaySimpleToken = apiResponse.PaySimpleToken;
     _creditCardCur.CCSource       = ccSource;
     if (_creditCardCur.IsNew)
     {
         _creditCardCur.ClinicNum  = _clinicNum;
         _creditCardCur.Procedures = PrefC.GetString(PrefName.DefaultCCProcs);
         CreditCards.Insert(_creditCardCur);
     }
     else
     {
         CreditCards.Update(_creditCardCur);
     }
 }
Пример #10
0
        public static CreditCard CreateCard(long patNum, double chargeAmt, DateTime dateStart, long payPlanNum, string authorizedProcs = "",
                                            ChargeFrequencyType frequencyType = ChargeFrequencyType.FixedDayOfMonth, DayOfWeekFrequency dayOfWeekFrequency = DayOfWeekFrequency.Every,
                                            DayOfWeek dayOfWeek = DayOfWeek.Friday, string daysOfMonth = "", bool canChargeWhenZeroBal = false)
        {
            CreditCard card = new CreditCard();

            card.PatNum         = patNum;
            card.ChargeAmt      = chargeAmt;
            card.DateStart      = dateStart;
            card.PayPlanNum     = payPlanNum;
            card.CCExpiration   = DateTime.Today.AddYears(3);
            card.CCNumberMasked = "XXXXXXXXXXXXX1234";
            card.Procedures     = authorizedProcs;
            if (frequencyType == ChargeFrequencyType.FixedDayOfMonth)
            {
                card.ChargeFrequency = POut.Int((int)ChargeFrequencyType.FixedDayOfMonth)
                                       + "|" + (daysOfMonth == "" ? dateStart.Day.ToString() : daysOfMonth);
            }
            else if (frequencyType == ChargeFrequencyType.FixedWeekDay)
            {
                card.ChargeFrequency = POut.Int((int)ChargeFrequencyType.FixedWeekDay)
                                       + "|" + POut.Int((int)dayOfWeekFrequency) + "|" + POut.Int((int)dayOfWeek);
            }
            card.CanChargeWhenNoBal = canChargeWhenZeroBal;
            CreditCards.Insert(card);
            return(card);
        }
Пример #11
0
        public async virtual Task <CreditCardBalanceViewModel> GetCreditCardDetailsByIdAsync(int id)
        {
            CreditCard card;

            try
            {
                card = await CreditCards.Where(x => x.Id == id).FirstAsync();
            }
            catch (Exception)
            {
                throw new ArgumentException("Card with this ID doesn't exist");
            }
            if (!card.IsValid)
            {
                throw new InvalidOperationException("Card is invalid");
            }
            ActionResults.Add(new UserActionResult {
                CreditCardId = id, OperationCode = 0, TimeStamp = DateTime.Now, WithdrawalAmount = 0
            });
            await SaveChangesAsync();

            return(new CreditCardBalanceViewModel {
                Number = card.Number, Balance = card.Balance
            });
        }
Пример #12
0
            ///<summary>Performs base XWebInputDTGForPayment behavior and creates PaymentWeb row.</summary>
            protected override void PostProcessOutput(XWebResponse response)
            {
                //Verify result and set response.PayNote.
                base.PostProcessOutput(response);
                response.Alias = _cc.XChargeToken;
                if (InsertPaymentOnApproval)                  //Insert Payment, PaySplit, and set FK.
                {
                    response.PaymentNum = Payments.InsertFromXWeb(
                        _patNum, _provNum, _clinicNum,
                        (InsertPositivePayment ? _amount : -_amount),
                        response.GetFormattedNote(InsertPositivePayment), "", CreditCardSource.XWeb);                      //todo: create a formatted receipt to show the web user after the payment has been accepted
                }
                //XWeb's Decline Minimizer will pass us back updated card information. Update our copy when necessary.
                bool update = false;

                if (_cc.CCExpiration != response.AccountExpirationDate)
                {
                    _cc.CCExpiration = response.AccountExpirationDate;
                    update           = true;
                }
                if (_cc.CCNumberMasked != response.MaskedAcctNum)
                {
                    _cc.CCNumberMasked = response.MaskedAcctNum;
                    update             = true;
                }
                if (update)
                {
                    CreditCards.Update(_cc);
                }
            }
Пример #13
0
        public async Task <CreditCards> LoadDetail(long?CreditCardNo)
        {
            CreditCards CreditCardInfo = new CreditCards();

            using (var client = new HttpClient())
            {
                //Passing service base url
                client.BaseAddress = new Uri(Baseurl);

                client.DefaultRequestHeaders.Clear();
                //Define request data format
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                //Sending request to find web api REST service resource GetAllCreditCards using HttpClient
                HttpResponseMessage Res = await client.GetAsync(string.Format("{0}{1}", "api/GetCreditCardDetail?CreditCardNo=", CreditCardNo));

                //Checking the response is successful or not which is sent using HttpClient
                if (Res.IsSuccessStatusCode)
                {
                    //Storing the response details recieved from web api
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;

                    //Deserializing the response recieved from web api and storing into the Credicard list
                    CreditCardInfo = JsonConvert.DeserializeObject <CreditCards>(EmpResponse);
                }
                //returning the employee list to view
                return(CreditCardInfo);
            }
        }
 public CreditCardDTO Delete(CreditCardDTO cardDTO)
 {
     CreditCards cardToRemove = cardRepository.Get(cardDTO.Id);
     cardRepository.Delete(cardToRemove);
     cardRepository.SaveChanges();
     return cardDTO;
 }
Пример #15
0
        private void butMoveTo_Click(object sender, EventArgs e)
        {
            if (listCreditCards.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a card first.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Move this credit card information to a different patient account?"))
            {
                return;
            }
            FormPatientSelect form = new FormPatientSelect();

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            int        selected   = listCreditCards.SelectedIndex;
            CreditCard creditCard = creditCards[selected];

            creditCard.PatNum = form.SelectedPatNum;
            CreditCards.Update(creditCard);
            RefreshCardList();
            MessageBox.Show("Credit card moved successfully");
        }
Пример #16
0
        private void butUp_Click(object sender, EventArgs e)
        {
            int placement = gridMain.GetSelectedIndex();

            if (placement == -1)
            {
                MsgBox.Show(this, "Please select a card first.");
                return;
            }
            if (placement == 0)
            {
                return;                //can't move up any more
            }
            int        oldIdx;
            int        newIdx;
            CreditCard oldItem;
            CreditCard newItem;

            oldIdx = _listCreditCards[placement].ItemOrder;
            newIdx = oldIdx + 1;
            for (int i = 0; i < _listCreditCards.Count; i++)
            {
                if (_listCreditCards[i].ItemOrder == oldIdx)
                {
                    oldItem            = _listCreditCards[i];
                    newItem            = _listCreditCards[i - 1];
                    oldItem.ItemOrder  = newItem.ItemOrder;
                    newItem.ItemOrder -= 1;
                    CreditCards.Update(oldItem);
                    CreditCards.Update(newItem);
                }
            }
            FillGrid();
            gridMain.SetSelected(placement - 1, true);
        }
Пример #17
0
        private void butDown_Click(object sender, EventArgs e)
        {
            int placement = listCreditCards.SelectedIndex;

            if (placement == -1)
            {
                MsgBox.Show(this, "Please select a card first.");
                return;
            }
            if (placement == creditCards.Count - 1)
            {
                return;                //can't move down any more
            }
            int        oldIdx;
            int        newIdx;
            CreditCard oldItem;
            CreditCard newItem;

            oldIdx = creditCards[placement].ItemOrder;
            newIdx = oldIdx - 1;
            for (int i = 0; i < creditCards.Count; i++)
            {
                if (creditCards[i].ItemOrder == newIdx)
                {
                    newItem            = creditCards[i];
                    oldItem            = creditCards[i - 1];
                    newItem.ItemOrder  = oldItem.ItemOrder;
                    oldItem.ItemOrder -= 1;
                    CreditCards.Update(oldItem);
                    CreditCards.Update(newItem);
                }
            }
            RefreshCardList();
            listCreditCards.SetSelected(placement + 1, true);
        }
 private void CheckIfExistsCreditCard(string message)
 {
     if (!CreditCards.Any())
     {
         throw new InvalidOperationException(message);
     }
 }
Пример #19
0
        private void butMoveTo_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() < 0)
            {
                MsgBox.Show(this, "Please select a card first.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Move this credit card information to a different patient account?"))
            {
                return;
            }
            FormPatientSelect form = new FormPatientSelect();

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            int        selected   = gridMain.GetSelectedIndex();
            CreditCard creditCard = _listCreditCards[selected];
            long       patNumOrig = creditCard.PatNum;

            creditCard.PatNum = form.SelectedPatNum;
            CreditCards.Update(creditCard);
            FillGrid();
            MsgBox.Show(this, "Credit card moved successfully");
            SecurityLogs.MakeLogEntry(Permissions.CreditCardMove, patNumOrig, $"Credit card moved to PatNum: {form.SelectedPatNum}");
            SecurityLogs.MakeLogEntry(Permissions.CreditCardMove, form.SelectedPatNum, $"Credit card moved from PatNum: {patNumOrig}");
        }
Пример #20
0
        private void processReturnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 1)
            {
                return;
            }
            long              patNum    = PIn.Long(_tableTrans.Rows[gridMain.SelectedIndices[0]]["PatNum"].ToString());
            string            alias     = _tableTrans.Rows[gridMain.SelectedIndices[0]]["Alias"].ToString();
            List <CreditCard> listCards = CreditCards.GetCardsByToken(alias,
                                                                      new List <CreditCardSource> {
                CreditCardSource.XWeb, CreditCardSource.XWebPortalLogin
            });

            if (listCards.Count == 0)
            {
                MsgBox.Show(this, "This credit card is no longer stored in the database. Return cannot be processed.");
                return;
            }
            if (listCards.Count > 1)
            {
                MsgBox.Show(this, "There is more than one card in the database with this token. Return cannot be processed due to the risk of charging the " +
                            "incorrect card.");
                return;
            }
            FormXWeb FormXW = new FormXWeb(patNum, listCards.FirstOrDefault(), XWebTransactionType.CreditReturnTransaction, createPayment: true);

            FormXW.LockCardInfo = true;
            if (FormXW.ShowDialog() == DialogResult.OK)
            {
                FillGrid();
            }
        }
 private CreditCard GetMinimumAvailableLimitCard()
 {
     return(CreditCards
            .GroupBy(card => card.DueDate.Date)
            .Select(g => g.OrderBy(card => card.CreditLimit)
                    .FirstOrDefault(card => card.AvailableCredit > 0)
                    ).FirstOrDefault());
 }
Пример #22
0
        public CreditCardItemViewModel(SecureItemSearchResult item, System.Windows.Media.Brush defaultColor, ImageSource defaultIcon) : base(item, defaultColor, defaultIcon)
        {
            IsDefaultImage = false;
            type           = SecurityItemsDefaultProperties.SecurityItemType_DigitalWallet;
            subType        = SecurityItemsDefaultProperties.SecurityItemSubType_DW_CreditCard;
            InitializeCollections();

            SelectedCreditCard = CreditCards.FirstOrDefault(x => x.Type == item.CreditCardType);
        }
        /// <summary>
        /// Adicionar um novo cartão de crédito à carteira
        /// </summary>
        /// <param name="card">Cartão de crédito</param>
        public void AddCreditCard(CreditCard card)
        {
            if (CreditCards.Contains(card))
            {
                throw new InvalidOperationException("A Wallet já possui um cartão com essas caracteristicas");
            }

            _creditCards.Add(card);
        }
Пример #24
0
 private void RefreshCardList()
 {
     listCreditCards.Items.Clear();
     creditCards = CreditCards.Refresh(PatCur.PatNum);
     for (int i = 0; i < creditCards.Count; i++)
     {
         listCreditCards.Items.Add(creditCards[i].CCNumberMasked);
     }
 }
 private void FillGrid()
 {
     //Currently only working for X-Charge. If more added then move this check out of FillGrid.
     #region XCharge Check
     if (prog == null)
     {
         MsgBox.Show(this, "X-Charge entry is missing from the database.");               //should never happen
         return;
     }
     if (!prog.Enabled)
     {
         if (Security.IsAuthorized(Permissions.Setup))
         {
             FormXchargeSetup FormX = new FormXchargeSetup();
             FormX.ShowDialog();
         }
         return;
     }
     if (!File.Exists(xPath))
     {
         MsgBox.Show(this, "Path is not valid.");
         if (Security.IsAuthorized(Permissions.Setup))
         {
             FormXchargeSetup FormX = new FormXchargeSetup();
             FormX.ShowDialog();
         }
         return;
     }
     #endregion
     table = CreditCards.GetRecurringChargeList();
     gridMain.BeginUpdate();
     gridMain.Columns.Clear();
     ODGridColumn col = new ODGridColumn(Lan.g("TableRecurring", "PatNum"), 110);
     gridMain.Columns.Add(col);
     col = new ODGridColumn(Lan.g("TableRecurring", "Name"), 250);
     gridMain.Columns.Add(col);
     col = new ODGridColumn(Lan.g("TableRecurring", "Total Bal"), 90, HorizontalAlignment.Right);
     gridMain.Columns.Add(col);
     col = new ODGridColumn(Lan.g("TableRecurring", "ChargeAmt"), 100, HorizontalAlignment.Right);
     gridMain.Columns.Add(col);
     gridMain.Rows.Clear();
     OpenDental.UI.ODGridRow row;
     for (int i = 0; i < table.Rows.Count; i++)
     {
         row = new OpenDental.UI.ODGridRow();
         Double famBalTotal = PIn.Double(table.Rows[i]["FamBalTotal"].ToString());
         Double chargeAmt   = PIn.Double(table.Rows[i]["ChargeAmt"].ToString());
         row.Cells.Add(table.Rows[i]["PatNum"].ToString());
         row.Cells.Add(table.Rows[i]["PatName"].ToString());
         row.Cells.Add(famBalTotal.ToString("c"));
         row.Cells.Add(chargeAmt.ToString("c"));
         gridMain.Rows.Add(row);
     }
     gridMain.EndUpdate();
     labelTotal.Text    = Lan.g(this, "Total=") + table.Rows.Count.ToString();
     labelSelected.Text = Lan.g(this, "Selected=") + gridMain.SelectedIndices.Length.ToString();
 }
Пример #26
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn("Card Number", 140));
            if (Programs.IsEnabled(ProgramName.Xcharge))
            {
                gridMain.Columns.Add(new ODGridColumn("X-Charge", 70, HorizontalAlignment.Center));
            }
            if (Programs.IsEnabled(ProgramName.PayConnect))
            {
                gridMain.Columns.Add(new ODGridColumn("PayConnect", 85, HorizontalAlignment.Center));
            }
            if (Programs.IsEnabled(ProgramName.PaySimple))
            {
                gridMain.Columns.Add(new ODGridColumn("PaySimple", 80, HorizontalAlignment.Center));
            }
            if (PrefC.HasOnlinePaymentEnabled())
            {
                gridMain.Columns.Add(new ODGridColumn("XWeb", 45, HorizontalAlignment.Center));
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            _listCreditCards = CreditCards.Refresh(PatCur.PatNum);
            foreach (CreditCard cc in _listCreditCards)
            {
                row = new ODGridRow();
                string ccNum = cc.CCNumberMasked;
                if (Regex.IsMatch(ccNum, "^\\d{12}(\\d{0,7})"))                 //Credit cards can have a minimum of 12 digits, maximum of 19
                {
                    int idxLast4Digits = (ccNum.Length - 4);
                    ccNum = (new string('X', 12)) + ccNum.Substring(idxLast4Digits);               //replace the first 12 with 12 X's
                }
                row.Cells.Add(ccNum);
                if (Programs.IsEnabled(ProgramName.Xcharge))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.XChargeToken) && !cc.IsXWeb()?"X":"");
                }
                if (Programs.IsEnabled(ProgramName.PayConnect))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.PayConnectToken) ? "X" : "");
                }
                if (Programs.IsEnabled(ProgramName.PaySimple))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.PaySimpleToken) ? "X" : "");
                }
                if (PrefC.HasOnlinePaymentEnabled())
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.XChargeToken) && cc.IsXWeb()?"X":"");
                }
                row.Tag = cc;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Пример #27
0
        public static string GetCreditCard(RestCommand command, int creditCardID)
        {
            CreditCard creditCard = CreditCards.GetCreditCard(command.LoginUser, creditCardID);

            if (creditCard.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(creditCard.GetXml("CreditCard", true));
        }
        private async void LoadCreditCards()
        {
            lblEntidadPrompt.Text  = "Tarjeta";
            txtEntidad.ItemsSource = null;
            txtEntidad.ItemsSource = await CreditCards.getList();

            txtEntidad.DisplayMemberPath = "Name";
            txtEntidad.SelectedValuePath = "Id";
            txtEntidad.SelectedIndex     = 0;
        }
 public HttpResponseMessage addCreditCard([FromBody] CreditCards addCreditCard)
 {
     try
     {
         return(Request.CreateResponse(HttpStatusCode.OK, BLCreditCard.addCreditCard(addCreditCard)));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
     }
 }
        /// <summary>
        /// Remove um cartão de crédito da carteira
        /// </summary>
        /// <param name="number">Número do cartão</param>
        public void RemoveCreditCard(long number)
        {
            if (CreditCards.FirstOrDefault(a => a.Number == number) == null)
            {
                throw new InvalidOperationException("Cartão de crédito não encontrado");
            }

            var card = CreditCards.First(a => a.Number == number);

            _creditCards.Remove(card);
        }