/// <summary> /// Method Name: ProcessCardRegisterationResponse /// Method Description: process the back office response /// </summary> /// <param name="pResponse">Back office response</param> /// <param name="pContact">Contact</param> /// <param name="pCard">Card</param> /// <Author> Mena Armanyous</Author> /// <Modified on>1-Jan-2011</Modified> protected bool ProcessCardRegisterationResponse(BO_CardRegisterationResponse pResponse, out string pMessage) { try { Card pCard = NavigationState.RegisteredCard; Contact pContact = NavigationState.Contact; BackOfficeManager lBOMgr = new BackOfficeManager(); if (pResponse == null) { // other error // Display confirmation message page with explanation message SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.BONotConnected; //"CardManagement|BONotConnected"; return(false); // DisplayConfirmationMessage(lMsg, true); } else { if (pResponse.ResponseCode == lBOMgr.RES_APPLICATION_INSERTION_ERROR || pResponse.ResponseCode == lBOMgr.RES_APPLICATION_SELECTION_ERROR || pResponse.ResponseCode == lBOMgr.RES_ERROR) { // Application error // Display confirmation message page with inconvenience error message SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.BONotConnected; // "CardManagement|BONotConnected"; return(false); // DisplayConfirmationMessage(lMsg, true); } else if (pResponse.ResponseCode == lBOMgr.RES_REGISTERD_CARD) { // card already registered // Display confirmation message page with please register valid card number SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.CardRegisteredErrorMsg;// "CardManagement|CardRegisteredErrorMsg"; return(false); // DisplayConfirmationMessage(lMsg, true); } else if (pResponse.ResponseCode == lBOMgr.RES_INPUTS_ARE_BLANK || pResponse.ResponseCode == lBOMgr.RES_INPUT_FORMAT_ERROR) { // card already registered // Display confirmation message page with please register valid card number SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.InputsAreBlankErrorMsg; // "CardManagement|InputsAreBlankErrorMsg"; return(false); // DisplayConfirmationMessage(lMsg, true); } else if (pResponse.ResponseCode == lBOMgr.RES_SUCCESS) { // success // Save record to database pCard.CardRegistered.BackEnd_ID = pResponse.BackendID; if (NavigationState.TempCardHolderContact != null) { CloneContact(NavigationState.TempCardHolderContact, NavigationState.Contact); } if (_CardManager.IsCardRegistered(pCard.CardNumber)) { NavigationState.RegistrationResultMsg = "CardManagement|CardRegisteredErrorMsg_Registered"; SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.CardRegisteredErrorMsg_Registered; // "CardManagement|SavingErrorMsg"; return(false); } if (SaveCardRegisteration())//SaveCardRegisteration(pCard)) { //Auditing AuditManagerBase.CommonAuditParams commonAuditParam = new AuditManagerBase.CommonAuditParams(_NavigationState.Contact.Contact_ID, DateTime.Now, (int?)_NavigationState.Contact.Contact_ID, _NavigationState.RegisteredCard.Card_ID, "B/O Registration", "Contact:" + _NavigationState.Contact.Contact_ID); AuditManager.AuditBORegisteration(commonAuditParam, pResponse.ResponseCode, pResponse.ResponseCodePhrase); /////////////////////////////////////////// // Send Notification mail SendCardRegistrationConfirmationMail();// (pCard, pContact); // Saving card succeeded, display success message SessionManager.Set(enumSessionKeys.IsError, false); SessionManager.Set(enumSessionKeys.ConfirmationTitle, Resources.PagesTitles.Confirmation_Title); pMessage = Resources.CardManagement.SuccessMsg; //"CardManagement|SuccessMsg"; return(true); // DisplayConfirmationMessage(lMsg); } else { // saving card failed, display error message SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.SavingErrorMsg; // "CardManagement|SavingErrorMsg"; return(false); // DisplayConfirmationMessage(lMsg, true); } } else if (pResponse.ResponseCode == lBOMgr.RES_BLOCKED_CARD_PURSE || pResponse.ResponseCode == lBOMgr.RES_EXPIRED_CARD_PURSE || pResponse.ResponseCode == lBOMgr.RES_CLOSED_OFF_CARD_PURSE || pResponse.ResponseCode == lBOMgr.RES_BLACKLISTED_CARD_PURSE) { // card related error SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.CardErrorMsg + pResponse.ResponseCodePhrase; return(false); //DisplayConfirmationMessage(lMsg, true); } else if (pResponse.ResponseCode == lBOMgr.RES_PATRONS_RECORD_NOT_FOUND || pResponse.ResponseCode == lBOMgr.RES_NO_CARD_MASTER) { // card not exists in back office error // Display confirmation message page with explanation message SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.RegisterCard_Patrons_Record_Not_Found; // "CardManagement|RegisterCard_Patrons_Record_Not_Found"; return(false); //DisplayConfirmationMessage(lMsg, true); } else { // other error // Display confirmation message page with explanation message SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = Resources.CardManagement.BONotConnected; // "CardManagement|BONotConnected"; return(false); //DisplayConfirmationMessage(lMsg, true); } } } catch (Exception ex) { if (!ExceptionHandler.IsUserFriendly(ex)) { ex.Data.Add("PageName", "ContactInformation"); ex.Data.Add("EventName", "ProcessCardRegisterationResponse"); ExceptionHandler.handle(ex); } else { throw ex; } SessionManager.Set(enumSessionKeys.IsError, true); SessionManager.Set(enumSessionKeys.ConfirmationTitle, "Error"); pMessage = HttpContext.GetGlobalResourceObject("CardManagement", "InconvenienceErrorMsg").ToString(); return(false); } }
/// <summary> /// Perform the registration process /// </summary> /// <returns>If the operation completed successfully</returns> protected bool GoForRegisretingCard() { bool lRegisterCardCompleted = false; string lBackendID = _CardManager.GetBackendIDForCard(_NavigationState.RegisteredCard); #region Get Card profile //add the card profile to the cardregistered object _NavigationState.RegisteredCard.CardRegistered.CardProfileCode = _CardManager.GetCardProfileCode(_NavigationState.RegisteredCard.CardNumber); if (_NavigationState.RegisteredCard.CardRegistered.CardProfileCode == -1) { lRegisterCardCompleted = false; NavigationState.RegistrationResultMsg = "CardManagement|BONotConnected"; WriteLogEntry("GoForRegisretingCard", "Retrieving card profile for Card:" + _NavigationState.RegisteredCard.CardNumber + " Failed"); return(lRegisterCardCompleted); } #endregion #region Get card expiry date //add the expiry date to the card registered BO_CardOverviewResponse resOverview = _CardManager.GetCardDetails(_NavigationState.RegisteredCard.CardNumber); if (resOverview == null || resOverview.CardOverview == null) { lRegisterCardCompleted = false; NavigationState.RegistrationResultMsg = "CardManagement|BONotConnected"; WriteLogEntry("GoForRegisretingCard", "Retrieving card expiry date for Card:" + _NavigationState.RegisteredCard.CardNumber + " Failed"); return(lRegisterCardCompleted); } _NavigationState.RegisteredCard.CardRegistered.CardExpiryDate = resOverview.CardOverview.CardExpiryDate; #endregion WriteLogEntry("GoForRegisretingCard", _NavigationState.RegisteredCard.CardNumber + ":Backend ID:" + lBackendID); //if the backend id is existing on BO, just save it on DB without calling the registration BO if (lBackendID != string.Empty) { _NavigationState.RegisteredCard.CardRegistered.BackEnd_ID = lBackendID; if (NavigationState.TempCardHolderContact != null) { CloneContact(NavigationState.TempCardHolderContact, NavigationState.Contact); } if (_CardManager.IsCardRegistered(this._NavigationState.RegisteredCard.CardNumber)) { NavigationState.RegistrationResultMsg = "CardManagement|CardRegisteredErrorMsg_Registered"; lRegisterCardCompleted = false; } else { lRegisterCardCompleted = SaveCardRegisteration(); if (lRegisterCardCompleted) { NavigationState.RegistrationResultMsg = "CardManagement|SuccessMsg"; //Auditing AuditManagerBase.CommonAuditParams commonAuditParam = new AuditManagerBase.CommonAuditParams(_NavigationState.Contact.Contact_ID, DateTime.Now, (int?)_NavigationState.Contact.Contact_ID, _NavigationState.RegisteredCard.Card_ID, "B/O Registration", "Contact:" + _NavigationState.Contact.Contact_ID); AuditManager.AuditBORegisteration(commonAuditParam, "", "Personalized card registration on web portal"); //send confirmation mail SendCardRegistrationConfirmationMail(); } else { NavigationState.RegistrationResultMsg = "CardManagement|SavingErrorMsg"; } } } //Backend id is empty, so call the registration API else { string lMsg = string.Empty; lRegisterCardCompleted = RegisterCard(out lMsg); NavigationState.RegistrationResultMsg = lMsg; } WriteLogEntry("GoForRegisretingCard", _NavigationState.RegisteredCard.CardNumber + ":" + _NavigationState.RegistrationResultMsg); return(lRegisterCardCompleted); }