Ejemplo n.º 1
0
        public void AddToWallet(FormCollection _formControls)
        {
            logger.Info("AddToWallet Method Start" + " at " + DateTime.UtcNow);
            UserWalletLog walletLog = new UserWalletLog();

            walletLog.TransactionDate = DateTime.Now;
            logger.Info("AddToWallet Method FormControls" + _formControls.Count + " at " + DateTime.UtcNow);
            foreach (string _formData in _formControls)
            {
                if (_formData == "UserProfileId")
                {
                    walletLog.UserProfileId = Convert.ToInt32(_formControls[_formData]);
                }
                else
                {
                    walletLog.Amount = Convert.ToDecimal(_formControls[_formData]);
                }
            }
            walletLog.IsRefund = false;

            //walletLog.Status = (int)OrderStatus.Pending;
            //walletLog.Comment = "Generate Request";
            db.UserWalletLog.Add(walletLog);
            db.SaveChanges();

            UserProfile user = db.UserProfiles.Where(p => p.UserProfileId == walletLog.UserProfileId).First();

            TempData["UserWalletLog"] = walletLog;

            GenerateRequest(user, walletLog.Amount.ToString());
            logger.Info("AddToWallet Method End" + " at " + DateTime.UtcNow);
        }
Ejemplo n.º 2
0
        public ActionResult GetResponse(string DR)
        {
            logger.Info("GetResponse Method Start" + " at " + DateTime.UtcNow);
            UserWalletLog userWalletLog = (UserWalletLog)TempData["UserWalletLog"];
            RequestParams parameters    = new RequestParams();

            db.Entry(userWalletLog).State = EntityState.Modified;
            parameters.GetResponse(DR, userWalletLog.UserProfileId, userWalletLog.Amount, ref userWalletLog);

            logger.Info("GetResponse Method userWallet log status " + userWalletLog.Status1 + " at " + DateTime.UtcNow);
            if (userWalletLog.Status1 == (int)OrderStatus.PaymentSuceess)
            {
                UserWallet wallet = db.UserWallets.Where(p => p.UserProfileId == userWalletLog.UserProfileId).FirstOrDefault();
                logger.Info("GetResponse Method wallet " + wallet.UserWalletId + " at " + DateTime.UtcNow);
                if (wallet == null)
                {
                    wallet = new UserWallet();
                    wallet.UserProfileId = userWalletLog.UserProfileId;
                    wallet.Balance      += userWalletLog.Amount;
                    logger.Info("GetResponse Method user " + wallet.UserProfileId + " at " + DateTime.UtcNow);
                    logger.Info("GetResponse Method wallet balance " + wallet.Balance + " at " + DateTime.UtcNow);
                    db.UserWallets.Add(wallet);
                }
                else
                {
                    wallet.Balance += userWalletLog.Amount;
                    logger.Info("GetResponse Method wallet balance " + wallet.Balance + " at " + DateTime.UtcNow);
                    db.Entry(wallet).State = EntityState.Modified;
                }
            }
            db.SaveChanges();
            TempData["WalletStatus"] = userWalletLog.Status1;
            logger.Info("GetResponse Method End" + " at " + DateTime.UtcNow);
            return(RedirectToAction("Wallet", "UserWallet"));;
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            logger.Info("Delete HttpPost Method Start" + " at " + DateTime.UtcNow);
            logger.Info("Delete HttpPost Method UserWalletLog Id " + id + " at " + DateTime.UtcNow);
            UserWalletLog userwalletlog = db.UserWalletLog.Find(id);

            db.UserWalletLog.Remove(userwalletlog);
            db.SaveChanges();
            logger.Info("Delete HttpPost Method User Wallet Log details removed " + " at " + DateTime.UtcNow);
            logger.Info("Delete HttpPost Method End" + " at " + DateTime.UtcNow);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
        //
        // GET: /UserWalletLog/Details/5
        /// <summary>
        /// This mehod will give details for seleced Id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Details(int id = 0)
        {
            logger.Info("Details Method Start" + " at " + DateTime.UtcNow);
            logger.Info("Details Method UserWalletLog Id" + id + " at " + DateTime.UtcNow);
            UserWalletLog userwalletlog = db.UserWalletLog.Find(id);

            if (userwalletlog == null)
            {
                logger.Info("Details Method UserWalletLog not found " + " at " + DateTime.UtcNow);
                return(HttpNotFound());
            }
            logger.Info("Details Method End" + " at " + DateTime.UtcNow);
            return(View(userwalletlog));
        }
Ejemplo n.º 5
0
 public ActionResult Edit(UserWalletLog userwalletlog)
 {
     logger.Info("Edit HttpPost Method Start" + " at " + DateTime.UtcNow);
     logger.Info("Edit HttpPost Method UserWalletLog Id " + userwalletlog.UserWalletLogId + " at " + DateTime.UtcNow);
     if (ModelState.IsValid)
     {
         db.Entry(userwalletlog).State = EntityState.Modified;
         db.SaveChanges();
         logger.Info("Edit HttpPost Method User Wallet Log updated " + " at " + DateTime.UtcNow);
         return(RedirectToAction("Index"));
     }
     ViewBag.UserProfileId = new SelectList(db.UserProfiles, "UserProfileId", "UserName", userwalletlog.UserProfileId);
     logger.Info("Edit HttpPost Method End" + " at " + DateTime.UtcNow);
     return(View(userwalletlog));
 }
Ejemplo n.º 6
0
        //
        // GET: /UserWalletLog/Edit/5
        /// <summary>
        /// This method will edit selected UserWalletLog.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(int id = 0)
        {
            logger.Info("Edit Get Method Start" + " at " + DateTime.UtcNow);
            logger.Info("Edit Get Method UserWalletLog Id " + id + " at " + DateTime.UtcNow);
            UserWalletLog userwalletlog = db.UserWalletLog.Find(id);

            if (userwalletlog == null)
            {
                logger.Info("Edit Get Method User Wallet Log is null " + " at " + DateTime.UtcNow);
                return(HttpNotFound());
            }
            ViewBag.UserProfileId = new SelectList(db.UserProfiles, "UserProfileId", "UserName", userwalletlog.UserProfileId);
            logger.Info("Edit Get Method Start" + " at " + DateTime.UtcNow);
            return(View(userwalletlog));
        }
Ejemplo n.º 7
0
        public ActionResult GetResponse(string DR)
        {
            logger.Info("GetResponse Method Start" + " at " + DateTime.UtcNow);
            UserWalletViewModel userWalletViewModal = (UserWalletViewModel)TempData["UserWallet"];
            RequestParams       parameters          = new RequestParams();
            UserWalletLog       userWalletLog       = userWalletViewModal.UserWalletLog;

            db.Entry(userWalletLog).State = EntityState.Modified;
            parameters.GetResponse(DR, userWalletViewModal.UserProfileId, userWalletViewModal.UserWalletLog.Amount, ref userWalletLog);

            userWalletViewModal.UserWalletLog = userWalletLog;
            logger.Info("GetResponse Method userWalletLog Status" + userWalletLog.Status1 + " at " + DateTime.UtcNow);

            if (userWalletLog.Status1 == (int)OrderStatus.PaymentSuceess)
            {
                UserWallet wallet = db.UserWallets.Where(p => p.UserProfileId == userWalletViewModal.UserProfileId).FirstOrDefault();
                if (wallet == null)
                {
                    wallet = new UserWallet();
                    wallet.UserProfileId = userWalletViewModal.UserProfileId;
                    wallet.Balance      += userWalletLog.Amount;
                    logger.Info("GetResponse Method user " + wallet.UserProfileId + " at " + DateTime.UtcNow);
                    logger.Info("GetResponse Method userWallet Balance " + wallet.Balance + " at " + DateTime.UtcNow);
                    db.UserWallets.Add(wallet);
                    logger.Info("GetResponse Method User wallet details added at " + DateTime.UtcNow);
                }
                else
                {
                    wallet.Balance += userWalletLog.Amount;
                    logger.Info("GetResponse Method userWallet Balance " + wallet.Balance + " at " + DateTime.UtcNow);
                    db.Entry(wallet).State = EntityState.Modified;
                    logger.Info("GetResponse Method User wallet details updated at " + DateTime.UtcNow);
                }
                userWalletViewModal.UserWallet = wallet;
            }
            db.SaveChanges();
            ViewData.Model = userWalletViewModal;
            logger.Info("GetResponse Method End" + " at " + DateTime.UtcNow);
            return(View());
        }