Example #1
0
        /// <summary>
        /// Method Name     : Validation
        /// Author          : Sanket Prajapati
        /// Creation Date   : 13 jan 2018
        /// Purpose         : Use for validation
        /// Revision        :
        /// </summary>
        private string Validation()
        {
            MonthYearModel yearValue    = yearList.FirstOrDefault(rc => rc.Year == spinnerExpYear.SelectedItem.ToString());
            MonthYearModel monthValue   = monthList.FirstOrDefault(rc => rc.Month == spinnerExpMonth.SelectedItem.ToString());
            string         errormessage = string.Empty;

            CardTypeInfoModel cardTypeInfoModel = UtilityPCL.GetCardTypes().FirstOrDefault(rc => rc.CardType == cardType);

            if (string.IsNullOrEmpty(txtNameofCardHolder.Text))
            {
                errormessage = StringResource.msgNameofCardholderisRequired;
            }
            else if (!string.IsNullOrEmpty(txtNameofCardHolder.Text.Trim()))
            {
                errormessage = ValidFullName();
                if (string.IsNullOrEmpty(errormessage))
                {
                    if (string.IsNullOrEmpty(txtCardNumber.Text))
                    {
                        errormessage = StringResource.msgCardNumberIsRequired;
                    }
                    else
                    {
                        errormessage = validExpDateAndCardnumber(yearValue, monthValue, cardTypeInfoModel);
                    }
                }
            }
            return(errormessage);
        }