public ActionResult CardUpdate(CardModel cardModel) { ModelState.Remove("Email"); ModelState.Remove("MobileNo"); ModelState.Remove("IssueDate"); ModelState.Remove("Amount"); CommonDbResponse dbResponse = new CommonDbResponse(); if (ModelState.IsValid) { //cardModel.ActionUser = Session["UserName"].ToString(); CardModel card = new CardModel(); card.UserId = cardModel.UserId.DecryptParameter(); card.AgentId = cardModel.AgentId.DecryptParameter(); card.CardNo = cardModel.CardNo.DecryptParameter(); card.CardType = cardModel.CardType; //cardModel.UserName = Session["CardForUser"].ToString(); CardCommon cardCommon = card.MapObject <CardCommon>(); dbResponse = _card.UpdateCard(cardCommon); //if (dbResponse.Code == 0) //{ // dbResponse.SetMessageInTempData(this); // return RedirectToAction("Index", new { UserId = cardModel.UserId, AgentId = cardModel.AgentId }); //} dbResponse.SetMessageInTempData(this); return(RedirectToAction("Index", new { UserId = cardModel.UserId, AgentId = cardModel.AgentId })); } dbResponse = new CommonDbResponse { Code = ResponseCode.Failed, Message = "Invalid Card Info" }; dbResponse.SetMessageInTempData(this); return(RedirectToAction("Index", new { UserId = cardModel.UserId, AgentId = cardModel.AgentId })); }
public ActionResult RequestCard(CardModel cardModels) { int ReqAmount = 0; float AvaBalnce = 0; cardModels.Balance = Session["Balance"].ToString(); //CardModel cardModel = new CardModel(); var cardType = _card.GetCardType(); foreach (var item in cardType.Where(kvp => kvp.Value.ToUpper() == "VIRTUAL CARD").ToList()) { cardType.Remove(item.Key); } cardModels.CardTypeList = ApplicationUtilities.SetDDLValue(cardType as Dictionary <string, string>, "", "--Card Type--"); if (int.TryParse(cardModels.Amount, out ReqAmount)) { if (ReqAmount < 100) //|| ReqAmount>1000 { ModelState.AddModelError("Amount", "Amount should be at least RS. 100"); return(View(cardModels)); } } else { ModelState.AddModelError("Amount", "Invalid Requested amount."); return(View(cardModels)); } if (float.TryParse(cardModels.Balance, out AvaBalnce)) { if (ReqAmount > AvaBalnce) { ModelState.AddModelError("Amount", "Requested amount greater then balance"); return(View(cardModels)); } } cardModels.UserId = Session["UserId"].ToString(); cardModels.AgentId = Session["AgentId"].ToString(); cardModels.UserName = Session["UserName"].ToString(); //cardModels.UserName = Session["FullName"].ToString(); WalletUserInfo walletUser = _walletUserBusiness.UserInfo(cardModels.UserId); cardModels.Email = walletUser.Email; cardModels.MobileNo = walletUser.MobileNo; cardModels.ActionUser = cardModels.UserName; cardModels.CreatedIp = ApplicationUtilities.GetIP(); CardCommon cardCommon = cardModels.MapObject <CardCommon>(); //CommonDbResponse dbResponse = _card.CardApproval(cardCommon); CommonDbResponse dbResponse = _card.RequestCard(cardCommon); if (dbResponse.Code == 0) { //dbResponse.SetMessageInTempData(this, "Index"); return(RedirectToAction("Index")); } dbResponse.SetMessageInTempData(this, "Index"); return(View(cardModels)); }
public ActionResult CardBalance(CardModel cardModel) { int ReqAmount = 0; float AvaBalnce = 0; cardModel.Balance = Session["Balance"].ToString(); var cardType = _card.GetCardType(); foreach (var item in cardType.Where(kvp => kvp.Value.ToUpper() == "VIRTUAL CARD" || kvp.Value.ToUpper() == "GIFT CARD").ToList()) { cardType.Remove(item.Key); } cardModel.CardTypeList = ApplicationUtilities.SetDDLValue(cardType as Dictionary <string, string>, "", "--Card Type--"); if (string.IsNullOrEmpty(cardModel.CardNo)) { ModelState.AddModelError("CardNo", "Card Number Required!"); //return RedirectToAction("CardBalance"); return(View("CardBalance", cardModel)); } if (int.TryParse(cardModel.Amount, out ReqAmount) && float.TryParse(cardModel.Balance, out AvaBalnce)) { if (ReqAmount > AvaBalnce && cardModel.Type.ToLower() == "ad") { ModelState.AddModelError("Amount", "Requested amount greater then balance"); return(View("CardBalance", cardModel)); } string userid = Session["UserId"].ToString(); if (string.IsNullOrEmpty(userid)) { return(RedirectToAction("Index", "Home")); } var cardCommonList = _card.GetCardList(userid).Where(x => x.CardId == cardModel.CardNo);//MapObjects<CardModel>(); float AvailableCardBalance = 0; if (float.TryParse(cardCommonList.FirstOrDefault().Amount, out AvailableCardBalance)) { if (ReqAmount > AvailableCardBalance && cardModel.Type.ToLower() == "rb") { ModelState.AddModelError("Amount", "Requested amount greater then balance"); return(View("CardBalance", cardModel)); } } } CardCommon cardCommon = cardModel.MapObject <CardCommon>(); //CommonDbResponse dbResponse = _card.CardApproval(cardCommon); CommonDbResponse dbResponse = _card.CardBalance(cardCommon); dbResponse.SetMessageInTempData(this, "Index"); return(RedirectToAction("Index")); }
public ActionResult AddCard(CardModel cardModel) { ModelState.Remove("Amount"); ModelState.Remove("CardNo"); if (ModelState.IsValid) { cardModel.ActionUser = Session["UserName"].ToString(); cardModel.UserId = cardModel.UserId.DecryptParameter(); cardModel.AgentId = cardModel.AgentId.DecryptParameter(); cardModel.UserName = Session["CardForUser"].ToString(); CardCommon cardCommon = cardModel.MapObject <CardCommon>(); CommonDbResponse dbResponse = _card.InsertCard(cardCommon); if (dbResponse.Code == 0) { dbResponse.SetMessageInTempData(this); return(RedirectToAction("Index", new { UserId = cardModel.UserId.EncryptParameter(), AgentId = cardModel.AgentId.EncryptParameter() })); } } return(View(cardModel)); }
public ActionResult CardUser(CardModel cardModel) { cardModel.Balance = Session["Balance"].ToString(); var cardType = _card.GetCardType(); foreach (var item in cardType.Where(kvp => kvp.Value.ToUpper() == "VIRTUAL CARD" || kvp.Value.ToUpper() == "PREPAID CARD").ToList()) { cardType.Remove(item.Key); } cardModel.CardTypeList = ApplicationUtilities.SetDDLValue(cardType as Dictionary <string, string>, cardModel.CardType, "--Card Type--"); if (cardModel.Type == "re") { ModelState.Remove("MobileNo"); } if (string.IsNullOrEmpty(cardModel.CardNo)) { ModelState.AddModelError("CardNo", "Card Number Required!"); return(View("CardUser", cardModel)); } else { IWalletUserBusiness _walletUserBusiness = new WalletUserBusiness(); var userinfo = _walletUserBusiness.UserInfo(cardModel.MobileNo); if (string.IsNullOrEmpty(userinfo.UserId)) { ModelState.AddModelError("MobileNo", "Invalid Mobile Number"); return(View("CardUser", cardModel)); } } cardModel.ActionUser = Session["UserId"].ToString(); CardCommon cardCommon = cardModel.MapObject <CardCommon>(); //CommonDbResponse dbResponse = _card.CardApproval(cardCommon); CommonDbResponse dbResponse = _card.CardUser(cardCommon); dbResponse.SetMessageInTempData(this, "Index"); return(RedirectToAction("Index")); }
public ActionResult CardApprovalDetail(CardModel cardModel, string btnApprove) { if (btnApprove.ToUpper() == "REJECT") { cardModel.RequestStatus = "Rejected"; } if (btnApprove.ToUpper() == "APPROVE") { cardModel.RequestStatus = "Approved"; } //Get user info from userName WalletUserInfo walletUser = _walletUserBusiness.UserInfo(cardModel.UserName); cardModel.UserId = walletUser.UserId; cardModel.AgentId = walletUser.AgentId; cardModel.ActionUser = Session["UserId"].ToString(); cardModel.CreatedIp = ApplicationUtilities.GetIP(); cardModel.CardType = _card.GetCardType().FirstOrDefault(x => x.Value == cardModel.CardType).Key; CardCommon cardCommon = cardModel.MapObject <CardCommon>(); CommonDbResponse dbResponse = _card.CardApproval(cardCommon); dbResponse.SetMessageInTempData(this); return(RedirectToAction("CardApprovalList")); }