public HttpResponseMessage GetCustomerById(HttpRequestMessage reqObject) { dynamic WalletAccountNo = string.Empty; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _CustomerProfile = JsonConvert.DeserializeObject <CustomerAccProfile>(_requestedDataObject.BusinessData); WalletAccountNo = _CustomerProfile.WalletAccountNo; } dynamic result = null; if (!string.IsNullOrWhiteSpace(WalletAccountNo)) { //_CustomerProfile = new CustomerAccProfile(); result = _ICustomerAccProfileService.GetCustomerById(_CustomerProfile); } if (result != null) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "Customer Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public HttpResponseMessage DeleteCustomer(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _CustomerProfile = JsonConvert.DeserializeObject <CustomerAccProfile>(_requestedDataObject.BusinessData); } if (_CustomerProfile == null || string.IsNullOrWhiteSpace(_CustomerProfile.AccountProfileId)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "Customer TypeId Not Found..."); _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); } result = _ICustomerAccProfileService.DeleteCustomer(_CustomerProfile); if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been deleted successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been deleted"); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public HttpResponseMessage UpdateCustomer(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _CustomerProfile = JsonConvert.DeserializeObject <CustomerAccProfile>(_requestedDataObject.BusinessData); bool IsValid = ModelValidation.TryValidateModel(_CustomerProfile, out _modelErrorMsg); if (IsValid) { result = _ICustomerAccProfileService.UpdateCustomer(_CustomerProfile); } } if (!string.IsNullOrWhiteSpace(_modelErrorMsg)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, _modelErrorMsg); } else if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been updated successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been updated"); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public AccMaster GetBankAccInfoByWalletAccNo(AccMaster _AccInfo) { AccMaster _Acc_Info = new AccMaster(); CustomerAccProfile _CustomerAccProfile = new CustomerAccProfile(); try { var _accInfo = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _AccInfo.FromSystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); if (_accInfo != null) { if (_accInfo.AccTypeId == "004") { _CustomerAccProfile = _IUoW.Repository <CustomerAccProfile>().GetBy(x => x.SystemAccountNo == _accInfo.SystemAccountNo); if (_CustomerAccProfile != null) { _Acc_Info.FromSystemAccountNo = _CustomerAccProfile.BankAccountNo; } } } return(_Acc_Info); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetBankAccInfoByWalletAccNo(obj)", string.Empty); return(null); } }
public IEnumerable <CustomerAccProfile> GetCustomerById(CustomerAccProfile _CustomerProfile) { try { return(_IUoW.mTakaDbQuery().IndCustomerInfo_LQ(_CustomerProfile)); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetCustomerById(string)", string.Empty); return(null); } }
public HttpResponseMessage GetAccInfo(HttpRequestMessage reqObject) { try { var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; string WalletAccNo = string.Empty; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccInfo = JsonConvert.DeserializeObject <AccMaster>(_requestedDataObject.BusinessData, settings); WalletAccNo = _AccInfo.WalletAccountNo; } if (!string.IsNullOrWhiteSpace(WalletAccNo)) { _AccInfo = new AccMaster(); _AccInfo = _IAccInfoService.GetAccInfoForDetails(WalletAccNo); string accType = _AccInfo.AccTypeId; if (accType == "004") { _customerAccProfile = _IAccInfoService.GetCusAccInfoForDetails(WalletAccNo); } if (_customerAccProfile != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_customerAccProfile, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_customerAccProfile, "Data Not Found..."); } } //if (_AccInfo != null) //{ // _serviceResponse = _IDataManipulation.SetResponseObject(_AccInfo, "information has been fetched successfully"); //} //else //{ // _serviceResponse = _IDataManipulation.SetResponseObject(_AccInfo, "Data Not Found..."); //} _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); } catch (Exception ex) { } return(_response); }
public CustomerAccProfile GetCustomerAccProfileInfo(string AccountNo) { CustomerAccProfile Customer_Acc_Profile = new CustomerAccProfile(); try { Customer_Acc_Profile = _IUoW.Repository <CustomerAccProfile>().GetBy(x => x.WalletAccountNo == AccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); return(Customer_Acc_Profile); } catch (Exception ex) { throw ex; } }
public IEnumerable <CustomerAccProfile> GetCustomerBy(CustomerAccProfile _Customer) { try { var _UserInfo = _IUoW.Repository <CustomerAccProfile>().Get(x => x.WalletAccountNo == _Customer.WalletAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); return(_UserInfo); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetCustomerBy(obj)", string.Empty); return(null); } }
public int DeleteCustomer(CustomerAccProfile _Customer) { try { int result = 0; bool IsRecordExist; if (!string.IsNullOrWhiteSpace(_Customer.AccountProfileId)) { IsRecordExist = _IUoW.Repository <CustomerAccProfile>().IsRecordExist(x => x.AccountProfileId == _Customer.AccountProfileId); if (IsRecordExist) { var _oldCustomerProfile = _IUoW.Repository <CustomerAccProfile>().GetBy(x => x.AccountProfileId == _Customer.AccountProfileId); var _oldCustomerProfileForLog = ObjectCopier.DeepCopy(_oldCustomerProfile); _oldCustomerProfile.AuthStatusId = _Customer.AuthStatusId = "U"; _oldCustomerProfile.LastAction = _Customer.LastAction = "DEL"; _oldCustomerProfile.LastUpdateDT = _Customer.LastUpdateDT = System.DateTime.Now; result = _IUoW.Repository <CustomerAccProfile>().Update(_oldCustomerProfile); #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, _oldCustomerProfileForLog, _Customer, "DEL", "0001", _Customer.FunctionId, 1, "CustomerAccProfile", "MTK_ACC_CUSTOMER_PROFILE", "AccountProfileId", _Customer.AccountProfileId, _Customer.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } //result = _IUoW.Repository<CustomerProfile>().Delete(_Customer); return(result); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "DeleteCustomerProfile(obj)", string.Empty); return(0); } }
public HttpResponseMessage GetCustomerBy(HttpRequestMessage reqObject) { dynamic result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _CustomerProfile = JsonConvert.DeserializeObject <CustomerAccProfile>(_requestedDataObject.BusinessData); result = _ICustomerAccProfileService.GetCustomerBy(_CustomerProfile); } if (result != null) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been updated successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been updated"); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public HttpResponseMessage AccTypeWiseCustomer(HttpRequestMessage reqObject) { string AccTypeId = null; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _CustomerProfile = JsonConvert.DeserializeObject <CustomerAccProfile>(_requestedDataObject.BusinessData); AccTypeId = _CustomerProfile.AccTypeId; } var List_Customer = _ICustomerAccProfileService.AccTypeWiseCustomer(AccTypeId); if (List_Customer != null) { _serviceResponse = _IDataManipulation.ResopnseWhenDataFound(List_Customer, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.ResopnseWhenDataNotFound("Parent Account Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public int AddCustomer(CustomerAccProfile _Customer, APIServiceRequest _requestedDataObject) { try { string FunctionId = "090103003"; string FunctionName = "CustomerAccProfile"; string MainAuthFlag = string.Empty; string MonitoringId = "3"; var _max = _IUoW.Repository <CustomerAccProfile>().GetMaxValue(x => x.AccountProfileId); if (_max > 0) { _Customer.AccountProfileId = (_max + 1).ToString(); } else { _Customer.AccountProfileId = MonitoringId + (_max + 1).ToString().PadLeft(8, '0'); } if (_Customer.sameAsPeranent == "True") { _Customer.PermanentAddress1 = _Customer.PresentAddress1; _Customer.PermanentAddress2 = _Customer.PresentAddress2; _Customer.PermanentCountry = _Customer.CountryId; _Customer.PermanentDistrict = _Customer.PresentDistrict; _Customer.PermanentArea = _Customer.PresentArea; _Customer.PermanentCity = _Customer.PresentCity; _Customer.PermanentThana = _Customer.PresentThana; //_Customer.PermanentPhone = _Customer.PresentPhone; } //else { //_Customer.AuthStatusId = "U"; //_Customer.LastAction = "ADD"; //_Customer.AccountStatusId = "R"; //_Customer.MakeDT = Convert.ToDateTime(DateTime.Now.ToShortDateString()); //_Customer.MakeBy = "mtaka"; //} _Customer.SystemAccountNo = Guid.NewGuid().ToString(); _Customer.AuthStatusId = "U"; _Customer.LastAction = "ADD"; _Customer.AccountStatusId = "001"; _Customer.MakeDT = System.DateTime.Now; _Customer.MakeBy = "mtaka"; var result = _IUoW.Repository <CustomerAccProfile>().Add(_Customer); #region Auth Log if (result == 1) { string url = ConfigurationManager.AppSettings["LgurdaService_server"] + "/GetAuthPermissionByFunctionId/" + FunctionId + "/" + FunctionName + "?format=json"; using (WebClient wc = new WebClient()) { TransactionRules OBJ_TransactionRules = new TransactionRules(); var json = wc.DownloadString(url); OBJ_TransactionRules = JsonConvert.DeserializeObject <TransactionRules>(json); MainAuthFlag = OBJ_TransactionRules.GetAuthPermissionByFunctionIdResult; } if (MainAuthFlag == "1") { #region Data Store in Account Info if (result == 1) { _AccInfo = new AccMaster(); var _maxAccInfoId = _IUoW.Repository <AccMaster>().GetMaxValue(x => x.AccountId) + 1; _AccInfo.AccountId = _maxAccInfoId.ToString().PadLeft(3, '0'); //_AccInfo.AccProfileId = _Customer.AccountProfileId; _AccInfo.WalletAccountNo = _Customer.WalletAccountNo; _AccInfo.SystemAccountNo = _Customer.SystemAccountNo; //_AccInfo.AccNm = _Customer.CustomerNm; _AccInfo.AccTypeId = _Customer.AccTypeId; _AccInfo.BankAccountNo = _Customer.BankAccountNo; _AccInfo.TransDT = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy")); _AccInfo.AccountStatusId = "001"; _AccInfo.AuthStatusId = "U"; _AccInfo.LastAction = "ADD"; _AccInfo.MakeDT = System.DateTime.Now; _AccInfo.MakeBy = "mTaka"; _IUoW.Repository <AccMaster>().Add(_AccInfo); } #endregion _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, null, _Customer, "ADD", "0001", _Customer.FunctionId, 1, "CustomerAccProfile", "MTK_ACC_CUSTOMER_ACC_PROFILE", "AccountProfileId", _Customer.AccountProfileId, _Customer.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } if (MainAuthFlag == "0") { _IAuthLogService = new AuthLogService(); AuthLog _ObjAuthLog = new AuthLog(); _ObjAuthLog.TableNm = "MTK_ACC_CUSTOMER_ACC_PROFILE"; _ObjAuthLog.AuthStatusId = "A"; _ObjAuthLog.LastAction = "ADD"; _ObjAuthLog.FunctionId = FunctionId; _ObjAuthLog.TablePkColVal = _Customer.AccountProfileId; _ObjAuthLog.MainAuthFlag = MainAuthFlag; //_Customer.AccIdofAccInfo = _AccInfo.AccountId; result = _IAuthLogService.SetTableObject <CustomerAccProfile>(_IUoW, _ObjAuthLog, _Customer); if (result == 1) //For Creating User in Lguarda { string _UserId = _Customer.WalletAccountNo; string _MakeBy = _requestedDataObject.UserId; string _UserClassificationId = "2"; string _UserAreaId = "5"; string _UserAreaIdValue = _Customer.SystemAccountNo; string _UserDescription = "null"; string _BranchId = "null"; string _CustomerFatherNm = string.IsNullOrWhiteSpace(_Customer.FatherName) ? "null" : _Customer.FatherName; string _CustomerMotherNm = string.IsNullOrWhiteSpace(_Customer.MotherName) ? "null" : _Customer.MotherName; //string _CustomerDOB = (_Customer.CustomerDOB == null) ? "null" : DateTime.ParseExact(_Customer.CustomerDOB.ToString(), "dd-MM-yyyy", CultureInfo.InvariantCulture).ToString(); string _CustomerDOB = "null"; string _AccNo = _Customer.WalletAccountNo; string _MailAddress = string.IsNullOrWhiteSpace(_Customer.Email) ? "null" : _Customer.Email; string _MobNo = string.IsNullOrWhiteSpace(_Customer.AlternativeMblNo) ? _Customer.WalletAccountNo : _Customer.AlternativeMblNo; string _AuthenticationId = "5"; string _WorkCriteria = "2"; string _RoleId = "29"; string _RequestClientIP = string.IsNullOrWhiteSpace(_requestedDataObject.RequestClientIP) ? "null" : _requestedDataObject.RequestClientIP; string _RequestAppId = string.IsNullOrWhiteSpace(_requestedDataObject.RequestAppId) ? "09" : _requestedDataObject.RequestAppId; string url1 = ConfigurationManager.AppSettings["LgurdaService_server"] + "/Add_UserProfile/" + _UserId + "/" + _MakeBy + "/" + _UserClassificationId + "/" + _UserAreaId + "/" + _UserAreaIdValue + "/" + _Customer.UserName + "/" + _UserDescription + "/" + _BranchId + "/" + _AccNo + "/" + _CustomerFatherNm + "/" + _CustomerMotherNm + "/" + _CustomerDOB + "/" + _MailAddress + "/" + _MobNo + "/" + _AuthenticationId + "/" + _RequestClientIP + "/" + "null" + "/" + "null" + "/" + _WorkCriteria + "/" + _RequestAppId + "/" + "A" + "/" + _RoleId + "?format=json"; string lg_result = PostParameter(url1); result = (!string.IsNullOrWhiteSpace(lg_result) && lg_result.ToLower() == "true") ? 1 : 0; } } } #endregion //#region Auth Log //if (result == 1) //{ // _IAuthLogService = new AuthLogService(); // long _outMaxSlAuthLogDtl = 0; // result = _IAuthLogService.AddAuthLog(_IUoW, null, _Customer, "ADD", "0001", "090103003", 1, "MTK_ACC_CUSTOMER_ACC_PROFILE", "AccountProfileId", _Customer.AccountProfileId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); //} //#endregion if (result == 1) { _IUoW.Commit(); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddCustomer(obj)", string.Empty); return(0); } }