public object CheckNidValidWithIdType(string photoid, string type, int?idType) { try { return(kycService.CheckNidValidWithIdType(photoid, type, idType)); } catch (Exception ex) { return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString())); } }
public object SaveCustomer(Reginfo aReginfo, bool isEdit, string evnt) { int fourDigitRandomNo = new Random().Next(1000, 9999); try { object prevModel = null; object currentModel = null; object reginfoModel = null; Reginfo convertedModel = null; if (isEdit != true) { aReginfo.CatId = "C"; aReginfo.PinStatus = "N"; aReginfo.AcTypeCode = 2; aReginfo.RegSource = "P"; aReginfo.EntryDate = System.DateTime.Now; //aReginfo.RegDate = aReginfo.RegDate + DateTime.Now.TimeOfDay; aReginfo.RegDate = System.DateTime.Now; aReginfo.Mphone = aReginfo.Mphone.Trim(); aReginfo.PhotoId = aReginfo.PhotoId.Trim(); try { reginfoModel = kycService.GetRegInfoByMphone(aReginfo.Mphone); bool photoIdValid = (bool)kycService.CheckNidValidWithIdType(aReginfo.PhotoId, "C", aReginfo.PhotoIdTypeCode); if (!photoIdValid) { return("IDEXIST"); } if (reginfoModel == null) { if (string.IsNullOrEmpty(aReginfo.EntryBy)) { return(HttpStatusCode.Unauthorized); } if (aReginfo.Mphone.Length != 11) { return(HttpStatusCode.BadRequest); } _customerRepository.Add(aReginfo); kycService.UpdatePinNo(aReginfo.Mphone, fourDigitRandomNo.ToString()); kycService.InsertModelToAuditTrail(aReginfo, aReginfo.EntryBy, 3, 3, "Customer", aReginfo.Mphone, "Save successfully"); MessageService service = new MessageService(); service.SendMessage(new MessageModel() { Mphone = aReginfo.Mphone, MessageId = "999", MessageBody = "Congratulations! Your OK wallet has been opened successfully." + " Your Pin is " + fourDigitRandomNo.ToString() + ", please change PIN to activate your account, " }); } else { return("DATAEXIST"); } } catch (Exception ex) { throw ex; } return(HttpStatusCode.OK); } else { if (evnt == "reject") { var checkStatus = kycService.CheckPinStatus(aReginfo.Mphone); if (checkStatus.ToString() != "P") { aReginfo.UpdateDate = System.DateTime.Now; aReginfo.RegStatus = "R"; CustomerRequest customerRequest = new CustomerRequest { Mphone = aReginfo.Mphone, ReqDate = DateTime.Now, HandledBy = aReginfo.UpdateBy, Remarks = aReginfo.Remarks, Request = "Reject", Status = "Y" }; if (string.IsNullOrEmpty(aReginfo.UpdateBy)) { return(HttpStatusCode.Unauthorized); } customerRequestService.Add(customerRequest); prevModel = kycService.GetRegInfoByMphone(aReginfo.Mphone); _customerRepository.UpdateRegInfo(aReginfo); currentModel = kycService.GetRegInfoByMphone(aReginfo.Mphone); kycService.InsertUpdatedModelToAuditTrail(currentModel, prevModel, aReginfo.UpdateBy, 3, 4, "Customer", aReginfo.Mphone, "Reject successfully"); return(HttpStatusCode.OK); } return(HttpStatusCode.OK); } else if (evnt == "edit") { if (string.IsNullOrEmpty(aReginfo.UpdateBy)) { return(HttpStatusCode.Unauthorized); } aReginfo.UpdateDate = System.DateTime.Now; convertedModel = GetConvertedReginfoModel(aReginfo); prevModel = kycService.GetRegInfoByMphone(aReginfo.Mphone); if (!string.IsNullOrEmpty(convertedModel.PhotoId)) { string photoIdPrev = prevModel.GetType().GetProperty("PhotoId").GetValue(prevModel, null).ToString(); string photoIdTypeCodePrev = prevModel.GetType().GetProperty("PhotoIdTypeCode").GetValue(prevModel, null).ToString(); int photoIdTypeCodeIntPrev = Convert.ToInt32(photoIdTypeCodePrev); string photoIdCurrent = convertedModel.PhotoId; int? photoIdTypeCodeIntCurrent = convertedModel.PhotoIdTypeCode; if ((photoIdCurrent != photoIdPrev) || (photoIdTypeCodeIntPrev != photoIdTypeCodeIntCurrent)) { bool photoIdValid = (bool)kycService.CheckNidValidWithIdType(photoIdCurrent, "C", convertedModel.PhotoIdTypeCode); if (!photoIdValid) { return("IDEXIST"); } } } _customerRepository.UpdateRegInfo(convertedModel); currentModel = kycService.GetRegInfoByMphone(aReginfo.Mphone); kycService.InsertUpdatedModelToAuditTrail(currentModel, prevModel, aReginfo.UpdateBy, 3, 4, "Customer", aReginfo.Mphone, "Update successfully"); return(HttpStatusCode.OK); } else { var checkStatus = kycService.CheckPinStatus(aReginfo.Mphone); if (checkStatus.ToString() != "P") { aReginfo.RegStatus = "P"; aReginfo.AuthoDate = System.DateTime.Now; //aReginfo.RegDate = kycService.GetRegDataByMphoneCatID(aReginfo.Mphone, "C"); if (string.IsNullOrEmpty(aReginfo.AuthoBy)) { return(HttpStatusCode.Unauthorized); } prevModel = kycService.GetRegInfoByMphone(aReginfo.Mphone); _customerRepository.UpdateRegInfo(aReginfo); currentModel = kycService.GetRegInfoByMphone(aReginfo.Mphone); kycService.InsertUpdatedModelToAuditTrail(currentModel, prevModel, aReginfo.AuthoBy, 3, 4, "Customer", aReginfo.Mphone, "Register successfully"); MessageService service = new MessageService(); service.SendMessage(new MessageModel() { Mphone = aReginfo.Mphone, MessageId = "999", MessageBody = "Dear Customer, Your OK wallet has been Activated successfully. For query, please call at OBL Call Centre: 16269, " }); return(HttpStatusCode.OK); } else { return(HttpStatusCode.OK); } } } } catch (Exception ex) { throw ex; } }