Ejemplo n.º 1
0
 protected void submit_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Subscription        SelectedSub = new Subscription(int.Parse(subscription.SelectedValue));
         NetflixWS.NetflixWS proxyObj    = new NetflixWS.NetflixWS();
         NetflixWS.Card      c           = new NetflixWS.Card();
         c.CardNumber = CreditCard.Text;
         c.Owner      = int.Parse(Owner.Text);
         c.CVV        = int.Parse(CVV.Text);
         c.ExpMonth   = int.Parse(ExpMonth.Text);
         c.ExpYear    = int.Parse(ExpYear.Text);
         c.FirstName  = FirstName.Text;
         c.LastName   = LastName.Text;
         NetflixWS.Transaction t = new NetflixWS.Transaction();
         t.CardNumber = CreditCard.Text;
         t.Payee      = "Netflix";
         t.Amount     = SelectedSub.Amountpermonth;
         if (proxyObj.IsPaid(t.Payee, t.CardNumber))
         {
             err = " Card allready is in use for another account";
             return;
         }
         if (!proxyObj.CanPay(c, t))
         {
             err = "Cant pay for this subscription with this card";
             return;
         }
         bool worked = NetflixBL.General.SignUp(username.Text, password.Text, 1, subscription.SelectedIndex + 1, email.Text, CreditCard.Text);
         if (!worked)
         {
             err = "username already exist! please change username";
             return;
         }
         if (!proxyObj.Pay(c, t))
         {
             //NOTREACHED!
             err = "user registed but couldnt pay for some reasone";
             return;
         }
         err = "you have sucsussfully signed up!";
         Response.Redirect("Login.aspx");
     }
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!((string)Session["Login"] == "user"))
            {
                Response.Redirect("Login.aspx");
            }

            user = new NetflixBL.User((string)Session["Username"]);
            if (!Page.IsPostBack)
            {
                NetflixWS.NetflixWS proxyObj = new NetflixWS.NetflixWS();
                card = proxyObj.UserPayment(user.CreditCard);
                NetflixWS.Transaction payment = proxyObj.UserLatesPay("Netflix", card.CardNumber);
                PaymentID.Text     += (" " + payment.ID);
                PaymentCard.Text   += (" " + payment.CardNumber);
                PaymentAmount.Text += (" " + payment.Amount);
                PayerName.Text     += (" " + card.FirstName + " " + card.LastName);
                NewEmail.Text       = user.Email;
                NewPass.Text        = user.Pass;
                username.Text      += user.Username;
                Subscription.Text  += " " + user.Sub.Description + " " + user.Sub.Seriesamount + " seriers includes";
            }
        }