Esempio n. 1
0
        /// <summary>
        /// Gets the credit cards.
        /// </summary>
        public static void GetCreditCards()
        {
            //va hacia el web services
            string[] fullNames;
            if (nameProfile.Contains("2"))
            {
                fullNames = NameProfile.Split('2');
                fullNames = fullNames[0].Split('/');
            }
            else
            {
                fullNames = NameProfile.Split('/');
            }
            if (string.IsNullOrEmpty(ucFormPayment.secondLevel))
            {
                ucFormPayment.secondLevel = NameProfile;
            }

            WsMyCTS wsServ = new WsMyCTS();

            string[] templistCardsSecondLevel = null;


            templistCardsSecondLevel = wsServ.GetCreditCardsSecondLevel(fullNames[1], fullNames[0], DK);


            var    listCardsFirstLevel = wsServ.GetCreditCardsFirstLevel(DK);
            string cc = string.Empty;
            var    listCardsSecondLevel     = templistCardsSecondLevel;
            var    listCardsSecondLevelTemp = new List <string>();
            var    listCardsFirstLevelTemp  = new List <string>();

            foreach (string creditCard in listCardsSecondLevel)
            {
                //string[] items = creditCard.Split(new string[] { "*#*" }, System.StringSplitOptions.RemoveEmptyEntries);
                string[] items = creditCard.Split(new string[] { "*#*" }, System.StringSplitOptions.None);
                if (items.Length > 0)
                {
                    if (!string.IsNullOrEmpty(items[0]))
                    {
                        cc = string.Concat(items[0], "-", items[1], " ", items[2], "/", items[3], "^", items.Length > 14 ? items[14] : "HTLsqvtsOdE=", "^", (items.Length > 4) ? items[4] : string.Empty);
                        //cc = string.Concat(items[0], "-", items[1], " ", items[2], "/", items[3]);// " ", items[14], "-" + items[4]);
                        //if (items.Length > 4)
                        listCardsSecondLevelTemp.Add(cc);
                        items = null;
                    }
                }
            }

            foreach (string creditCard in listCardsFirstLevel.Where(s => (!String.IsNullOrEmpty(s))).ToArray())
            {
                string[] items = creditCard.Split(new string[] { "*#*" }, System.StringSplitOptions.None);

                if (!items[0].Equals("*") && !string.IsNullOrEmpty(items[0].ToString()))
                {
                    var typeOfServ = (items.Length == 4) ? items[3].Split('*') : null;
                    cc = items[0].Replace('*', '-');
                    if (typeOfServ != null)
                    {
                        listCardsFirstLevelTemp.Add(string.Concat(cc, " ", items[1], "^", items[2] + " " + ((typeOfServ.Length == 4) ? ((typeOfServ[0] == "Y") ? "AIR" : "") + "^" + ((typeOfServ[1] == "Y") ? "CAR" : "") + "^" + ((typeOfServ[0] == "Y") ? "HTL" : "") + "^" + typeOfServ[3] : " ")));
                    }
                    else
                    {
                        listCardsFirstLevelTemp.Add(string.Concat(cc, " ", items[1], "^", items[2]));
                    }
                }
            }

            CreditCardsFirstLevel  = listCardsFirstLevelTemp;
            CreditCardsSecondLevel = listCardsSecondLevelTemp;
        }