public ActionResult SubmitHotMarkRequest(string CardNo) { long ID = 0; if (IsDuplicateEntry(CardNo, "", "H", null, out ID)) { return(Json(new { IsSuccess = ID, ErrorMessage = CustomMessages.RequestAlreadyExists }, JsonRequestBehavior.AllowGet)); } bool flag = false; CustomerCardDataAccess obj = new CustomerCardDataAccess(); var AlreadyHot = obj.IsCardHotMarked(CardNo); if (AlreadyHot == "Success") { flag = CardHotMarkMethods.GenerateHotMarkRequest(CardNo); return(Json(new { IsSuccess = true, ErrorMessage = CustomMessages.Success }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, ErrorMessage = AlreadyHot }, JsonRequestBehavior.AllowGet)); } }
public ActionResult ApproveHotMarkRequest(string CardNo, long RequestId) { //var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(int.Parse(RequestId.ToString()), "P"); //Checking if Creator is same as Authorizer //if (getSystemRequest.CreatorID == StateHelper.UserId) //{ // return Json(new { IsSuccess = false, ErrorMessage = CustomMessages.SameCreatorAndsAuthorizer }, JsonRequestBehavior.AllowGet); //} bool CheckAuthorizerSame = new RequestDataAccess().CheckSameAuthorizer(StateHelper.UserId, Convert.ToInt32(RequestId)); if (CheckAuthorizerSame) { return(Json(new { IsSuccess = false, ErrorMessage = CustomMessages.SameCreatorAndsAuthorizer }, JsonRequestBehavior.AllowGet)); } else { bool flag = false; CustomerCardDataAccess result = new CustomerCardDataAccess(); var AlreadyHot = result.IsCardHotMarked(CardNo); if (AlreadyHot == "Success") { CardHotMarkMethods.AuthorizeRequest(CardNo, RequestId, "A"); flag = result.CardHotMark(CardNo); return(Json(new { IsSuccess = true, ErrorMessage = CustomMessages.Success }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, ErrorMessage = AlreadyHot }, JsonRequestBehavior.AllowGet)); } } }
public static CustomerCardVM GetCustomerCardByAccountNo(string accountNumber) { var query = new CustomerCardDataAccess().GetCustomerCardByAccountNo(accountNumber); if (query == null) { return(null); } return(new CustomerCardVM { CardNo = query.CardNo, CardTypeID = query.CardTypeID }); }
public ActionResult RejectMultipleHotMarkRequest(List <HotMarkVM> request) { bool flag = false; int rejectCardsCount = 0, successCardsCount = 0; CustomerCardDataAccess result = new CustomerCardDataAccess(); foreach (var item in request) { CardHotMarkMethods.AuthorizeRequest(item.CardNo, item.RequestId, "C"); flag = result.CardHotMark(item.CardNo); rejectCardsCount++; } return(Json(new { IsSuccess = false, ErrorMessage = string.Format(CustomMessages.MultipleHotmarkApproval, successCardsCount, rejectCardsCount) }, JsonRequestBehavior.AllowGet)); }
public ActionResult ApproveActiveMarkRequest(string CardNo, long RequestId) { bool flag = false; CustomerCardDataAccess result = new CustomerCardDataAccess(); var AlreadyHot = result.IsCardHotMarked(CardNo); if (AlreadyHot == "Card Already Hot Marked") { CardHotMarkMethods.AuthorizeRequest(CardNo, RequestId, "A"); flag = result.CardActiveMark(CardNo); return(Json(new { IsSuccess = true, ErrorMessage = CustomMessages.Success }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, ErrorMessage = AlreadyHot }, JsonRequestBehavior.AllowGet)); } }
public static CustomerCardVM GetCustomerCard(string request) { var data = new CustomerCardDataAccess().GetCustomerCard(request); if (data == null) { return(null); } return(new CustomerCardVM { AccountNo = data.AccountNo, CardExpiry = data.CardExpiry, CardIssuance = data.CardIssuance, CardNo = data.CardNo, CardStatusActive = data.CardStatusActive, CardTitle = data.CardTitle, CardTypeID = data.CardTypeID, ID = data.ID, Salutation = data.Salutation, WaiveCharges = data.WaiveCharges }); }
public ActionResult ApproveMultipleActiveMarkRequest(List <HotMarkVM> request) { bool flag = false; int rejectCardsCount = 0, successCardsCount = 0; CustomerCardDataAccess result = new CustomerCardDataAccess(); foreach (var item in request) { var AlreadyHot = result.IsCardHotMarked(item.CardNo); if (AlreadyHot == "Card Already Hot Marked") { CardHotMarkMethods.AuthorizeRequest(item.CardNo, item.RequestId, "A"); flag = result.CardActiveMark(item.CardNo); successCardsCount++; } else { rejectCardsCount++; } } return(Json(new { IsSuccess = false, ErrorMessage = string.Format(CustomMessages.MultipleActivemarkApproval, successCardsCount, rejectCardsCount) }, JsonRequestBehavior.AllowGet)); }
public ActionResult AutomaticHotMark(HttpPostedFileBase postedFile) { long ID = 0; CustomerCardDataAccess result = new CustomerCardDataAccess(); //flag = result.CardHotMark(CardNo); string filePath = string.Empty; try { //if (postedFile != null) //{ var filePathData = new FilePathDataAccess().GetFilePathByTypeID(((int)Constants.enPathType.Import).ToString()); string path = filePathData?.Path ?? @"C:\Users\Mohsin\Desktop\ImportedFile\"; string filename = "Hotmark.csv"; //string path = Server.MapPath("~/CardHotMark/"); int found = 0, notFound = 0, alreadyhot = 0, requestexist = 0; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } filePath = path + Path.GetFileName(filename); string extension = Path.GetExtension(filename); if (extension == ".csv" || extension == ".CSV") { //postedFile.SaveAs(filePath); string csvData = System.IO.File.ReadAllText(filePath).Replace("\r\n", "$$&$$"); //var data = csvData.Split('\n', '\r'); var data = csvData.Split(new[] { "$$&$$" }, StringSplitOptions.None).Where(e => !string.IsNullOrWhiteSpace(e)).Select(e => e.Trim()).ToArray(); var AllowedQuantity = ConfigurationManager.AppSettings["HotFile"]; int AllowedQuantityInt = Convert.ToInt32(AllowedQuantity); if (Convert.ToInt32(data.Count()) - 1 > AllowedQuantityInt) { return(Json("Please Upload maximum of " + AllowedQuantityInt + " records", JsonRequestBehavior.AllowGet)); } foreach (string row in data.Skip(1).ToList()) { //foreach (var item in row.Split(',')) //{ if (string.IsNullOrWhiteSpace(row)) { continue; } var datarow = row.Split(','); if (datarow.Length >= 2) { var cardno = datarow[0]; var expiry = new DateTime(int.Parse(datarow[1].Substring(0, 4)), int.Parse(datarow[1].Substring(4, 2)), int.Parse(datarow[1].Substring(6, 2)), 0, 0, 0); if (!string.IsNullOrEmpty(cardno)) { if (IsDuplicateEntry(cardno, "", "H", null, out ID)) { //notFound++; requestexist++; continue; } var AlreadyHot = new CustomerCardDataAccess().IsCardHotMarked(cardno); if (AlreadyHot == "Success") { var isSuccess = CardHotMarkMethods.GenerateHotMarkRequest(cardno, expiry); //var isSuccess = result.CardHotMark(cardno, expiry); if (!isSuccess) { notFound++; } else { found++; } } else { //notFound++; alreadyhot++; } } } else { return(Json("Please Select Valid .csv file", JsonRequestBehavior.AllowGet)); } //} } //TempData["mesage"] = "Sucessfully Retreived"; return(Json($"Succesfull: {found}, Card Data Not Found: {notFound},Card Already Hot: {alreadyhot},Request Already Exists: {requestexist}", JsonRequestBehavior.AllowGet)); } else { //TempData["mesage"] = "Please Select Valid .csv file"; return(Json("Please Select Valid .csv file", JsonRequestBehavior.AllowGet)); } //} } catch (Exception ex) { //TempData["mesage"] = "Path or File Not Found"; return(Json("Path or File Not Found", JsonRequestBehavior.AllowGet)); //throw ex; } // return View("CardHotMarkScreen"); }