public ActionResult UpgradeAccountSuccessful()
        {
            User   objUser     = (User)Session["User"];
            string paidamount  = (string)Session["PaymentAmount"];
            string accountType = (string)Session["AccountType"];

            objUser.PaymentStatus = "Paid";
            objUser.AccountType   = accountType;
            Api.User.User ApiobjUser = new Api.User.User();
            Api.PaymentTransaction.PaymentTransaction objApiPaymentTransaction = new Api.PaymentTransaction.PaymentTransaction();
            if (DateTime.Compare(objUser.ExpiryDate, DateTime.Now) > 0)
            {
                objUser.ExpiryDate = objUser.ExpiryDate.AddDays(30);
            }
            else
            {
                objUser.ExpiryDate = DateTime.Now.AddDays(30);
            }
            int    i = ApiobjUser.UpdateUserAccountInfoByUserId(objUser.Id.ToString(), objUser.AccountType, objUser.ExpiryDate, objUser.PaymentStatus);
            string res_PaymentTransaction = objApiPaymentTransaction.SavePayPalTransaction(objUser.Id.ToString(), paidamount);
            int    ret = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(objUser.Id.ToString(), Session["Ewallet"].ToString(), accountType, "paid");

            objUser.Ewallet          = Session["Ewallet"].ToString();
            objUser.ActivationStatus = "paid";
            Session["User"]          = objUser;
            Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation();
            try
            {
                Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)(new JavaScriptSerializer().Deserialize(ApiInvitation.UserInvitedInfo(objUser.Id.ToString()), typeof(Domain.Socioboard.Domain.Invitation)));
                if (_Invitation != null)
                {
                    User  newUser = (User)(new JavaScriptSerializer().Deserialize(ApiobjUser.getUsersById(_Invitation.SenderUserId.ToString()), typeof(User)));
                    float bonus   = (float.Parse(paidamount) * Payment.ReferedAmountDetails(accountType)) / 100;
                    newUser.Ewallet = (float.Parse(newUser.Ewallet) + bonus).ToString();
                    int ret1 = ApiobjUser.UpdatePaymentandEwalletStatusByUserId(newUser.Id.ToString(), newUser.Ewallet, newUser.AccountType, newUser.PaymentStatus);
                    Api.Affiliates.Affiliates ApiAffiliates = new Api.Affiliates.Affiliates();
                    ApiAffiliates.AddAffiliateDetail(newUser.Id.ToString(), objUser.Id.ToString(), DateTime.Now, bonus.ToString());
                }
            }
            catch (Exception ex) { }
            Session["Paid_User"] = "******";
            return(RedirectToAction("Index", "Home"));
        }
Beispiel #2
0
 public Domain.Socioboard.Domain.Invitation GetInvitationInfoBycode(string code)
 {
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 NHibernate.IQuery query = session.CreateQuery("from Invitation where InvitationCode=:code")
                                           .SetParameter("code", code);
                 Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)query.UniqueResult();
                 return(_Invitation);
             }
             catch (Exception ex)
             {
                 return(null);
             }
         }
     }
 }
Beispiel #3
0
 /// <Add>
 /// Add a new invitation in DataBase.
 public void Add(Domain.Socioboard.Domain.Invitation invitation)
 {
     try
     {
         //Creates a database connection and opens up a session
         using (NHibernate.ISession session = SessionFactory.GetNewSession())
         {
             //After Session creation, start Transaction.
             using (NHibernate.ITransaction transaction = session.BeginTransaction())
             {
                 //Proceed action to save data.
                 session.Save(invitation);
                 transaction.Commit();
             } //End Using trasaction
         }     //End Using session
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }