public async void MakeNewSubscription(object obj)
        {
            string      name       = Name;
            string      add        = Address;
            string      email      = Email;
            string      phone      = Phone;
            string      cardholder = CardHolder;
            string      cardno     = CardNo;
            DateTime    expdate    = ExpDate;
            int         cvv        = Cvv;
            int         nocopy     = NumberOfCopies;
            string      password   = Password;
            SubDuration subdur     = SubDuration;


            Regex regexstring = new Regex("^[a-zA-Z]+$");
            Regex regexEmail  = new Regex(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                                          @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                                          @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");

            Regex regexphone = new Regex("^[0-9]+$");

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(add) || string.IsNullOrEmpty(email) ||
                string.IsNullOrEmpty(phone) || string.IsNullOrEmpty(cardholder) || string.IsNullOrEmpty(cardno) ||
                string.IsNullOrEmpty(password) ||
                Cvv == 0 || NumberOfCopies == 0)

            {
                CheckInput();
            }

            else if (!regexstring.IsMatch(name))
            {
                CheckStringValidation();
            }
            else if (!regexstring.IsMatch(cardholder))
            {
                CheckStringValidation();
            }
            else if (!regexEmail.IsMatch(email))
            {
                CheckEmailValidation();
            }

            //else if (!regexphone.IsMatch(phone))
            //{
            //    CheckPhoneValidation();
            //}


            App1 = appcatalog.CreateIndApplicant(name, add, email, phone, cardholder, cardno, expdate,
                                                 cvv, password);

            Subscription subscription = subcatalog.CreatIndividualSubs(App1, nocopy, subdur);

            ListInd.Add(subscription);
            clean.SaveIndividual(ListInd);

            //LoadDafaultData();
        }
Esempio n. 2
0
        private void MakeNewSubscription(object obj)
        {
            string       name       = Name;
            string       add        = Address;
            string       email      = Email;
            string       phone      = Phone;
            string       cardholder = CardHolder;
            string       cardno     = CardNo;
            DateTime     expdate    = ExpDate;
            int          cvv        = Cvv;
            int          nocopy     = NumberOfCopies;
            SubDuration  subdur     = SubDuration;
            IndApplicant appind     = appcatalog.CreateIndApplicant(name, add, email, phone, cardholder, cardno, expdate, cvv);

            Models.Subscription sub = subcatalog.CreatIndividualSubs(appind, nocopy, subdur);
            List.Add(sub);
        }