public ActionResult AddUpdateAccountType(tbl_Account_Types request, int?RequestId = null) { if (IsDuplicateCode(request.ID, request.Code)) { return(Json(new { IsSuccess = false, ErrorMessage = CustomMessages.DuplicateAccountCode }, JsonRequestBehavior.AllowGet)); } //existing account type modification requests to be handled through System Request Section if (RequestId.HasValue /*request.ID != 0*/) { var getSystemRequest = new SystemRequestDataAccess().GetSystemRequest(RequestId.GetValueOrDefault(), "R"); var AccountTypeDetails = new AccountTypeDataAccess().GetAccountTypeDetailsById(request.ID); var existingJson = AccountTypeDetails == null ? null : CustomHelper.GetJson(AccountTypeDetails); var updatedJson = CustomHelper.GetJson(request); tbl_System_Requests row = new tbl_System_Requests(); if (RequestId.GetValueOrDefault() <= 0) { row = new tbl_System_Requests { AuthorizationStatus = "P", CreatorID = StateHelper.UserId, IsActive = true, ExistingData = existingJson, UpdatedData = updatedJson, RequestType = Constants.RequestTypes.AccountTypes_SystemRequest }; } else { row = getSystemRequest; row.CreatorID = StateHelper.UserId; row.AuthorizationStatus = "P"; row.AuthorizationComments = string.Empty; row.UpdatedData = updatedJson; row.ExistingData = existingJson; } var SystemRequestFlag = (RequestId.HasValue && RequestId.GetValueOrDefault() <= 0) ? new SystemRequestDataAccess().AddSystemRequest(row) : new SystemRequestDataAccess().UpdateSystemRequest(row); return(Json(new { IsSuccess = SystemRequestFlag, ErrorMessage = SystemRequestFlag == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = SystemRequestFlag }, JsonRequestBehavior.AllowGet)); } else { request.IsActive = true; //New Account Type var response = request.ID <= 0 ? new AccountTypeDataAccess().AddAccountType(request) : new AccountTypeDataAccess().UpdateAccountType(request); return(Json(new { IsSuccess = response, ErrorMessage = response == true ? string.Empty : CustomMessages.GenericErrorMessage, Response = response }, JsonRequestBehavior.AllowGet)); } }
public JsonResult SearchCardDetail(string CardNo) { CardTypesDataAccess obj = new CardTypesDataAccess(); List <CustomerAccountVM> lst = new List <CustomerAccountVM>(); NewCISSB.SONFETCHCARDINFOTypeGSONFETCHCARDINFODetailTypeMSONFETCHCARDINFODetailType resp = new NewCISSB.SONFETCHCARDINFOTypeGSONFETCHCARDINFODetailTypeMSONFETCHCARDINFODetailType(); lst = CardReportMethods.GetCustomerAccount(CardNo); if (lst.Count <= 0) { return(Json(new { Result = lst, ErrorMessage = CustomMessages.CardNotExists }, JsonRequestBehavior.AllowGet)); } else { var request = new RequestDataAccess().GetRequest(CardNo, lst.FirstOrDefault()?.AccountNo ?? string.Empty, lst.FirstOrDefault()?.CIF ?? string.Empty); var requestdata = new RequestVM { ID = request?.ID ?? 0, RequestType = request?.RequestType ?? string.Empty, Waive = request != null?request.WaiveCharges.GetValueOrDefault() : false }; var userlog = new UserLogDataAccess().GetUserLogByEntityId(request?.ID ?? 0, "tbl_Requests"); var creator = userlog.Where(e => e.EventName == "i").FirstOrDefault()?.tbl_Users?.UserName ?? string.Empty; var authorizer = userlog.Where(e => e.EventName == "A").OrderByDescending(e => e.ID).FirstOrDefault()?.tbl_Users?.UserName ?? string.Empty; try { resp = T24Methods.FetchAccount(lst.FirstOrDefault()?.AccountNo ?? string.Empty, lst.FirstOrDefault()?.CIF ?? string.Empty); } catch { resp = new NewCISSB.SONFETCHCARDINFOTypeGSONFETCHCARDINFODetailTypeMSONFETCHCARDINFODetailType(); } //var CardIssuance = lst.FirstOrDefault().CardIssuance.ToString(); //var CardExpiry = lst.FirstOrDefault().CardExpiry.ToString(); //var DOB = lst.FirstOrDefault().DateofBirth.ToString(); var CardTypes = obj.GetCardTypes("A"); CardTypes = (CardTypes.Where(s => s.ID == (lst.FirstOrDefault()?.CardTypeID ?? 0))).ToList(); var CardType = (CardTypes.Count > 0) ? CardTypes[0].Title : string.Empty; List <CustomerAccountVM> DelinkInfo = new List <CustomerAccountVM>(); //DelinkInfo = CommonMethods.GetAccountInfo(CardNo, lst.FirstOrDefault()?.AccountNo ?? "0"); var DelinkInfoStr = CommonMethods.GetLinkedAccounts(CardNo, lst.FirstOrDefault()?.AccountNo ?? "0"); var Product = new AccountTypeDataAccess().GetAccountTypeById(lst.FirstOrDefault().AccountTypeID ?? 0)?.Name ?? string.Empty; return(Json(new { Result = lst, /*CardIssuance=CardIssuance, CardExpiry= CardExpiry,DOB=DOB,*/ DelinkInfoStr = DelinkInfoStr, CardType = CardType, Product = Product, Request = requestdata, AccountResponse = resp, Creator = creator, Authorizer = authorizer, ErrorMessage = CustomMessages.Success }, JsonRequestBehavior.AllowGet)); } }
public bool IsDuplicateCode(int AccountTypeID1, string Code) { try { int AccountTypeID2 = new AccountTypeDataAccess().GetAccountTypeID(Code); if (AccountTypeID2 > 0 && AccountTypeID1 != AccountTypeID2) { return(true); } else { return(false); } } catch (Exception ex) { return(true); } }
public static AccountTypeVM GetAccountTypeById(int id, string authorizeStatus = default(string)) { var query = new AccountTypeDataAccess().GetAccountTypeById(id); if (!string.IsNullOrEmpty(authorizeStatus)) { query = (query?.AuthorizationStatus ?? string.Empty) == authorizeStatus ? query : null; } if (query == null) { return(null); } return(new AccountTypeVM { Code = query.Code, Description = query.Description, AuthorizationStatus = query.AuthorizationStatus, Name = query.Name, ID = query.ID, AuthorizationComments = query.AuthorizationComments, IsActive = query.IsActive }); }