public BanglaQr GetBanglaQrInfo(string mphone, string catId) { try { using (var connection = this.GetConnection()) { var dyParam = new OracleDynamicParameters(); dyParam.Add("V_MPHONE", OracleDbType.Varchar2, ParameterDirection.Input, mphone); dyParam.Add("V_CAT", OracleDbType.Varchar2, ParameterDirection.Input, catId); dyParam.Add("CUR_DATA", OracleDbType.RefCursor, ParameterDirection.Output); BanglaQr result = SqlMapper.Query <BanglaQr>(connection, dbUser + "SP_GET_BANQR_INFO", param: dyParam, commandType: CommandType.StoredProcedure).FirstOrDefault(); this.CloseConnection(connection); return(result); } } catch (Exception ex) { throw ex; } }
public string GetBanglaQrStream(string mphone, string catId) { BanglaQr banglaQr = kycRepository.GetBanglaQrInfo(mphone, catId); banglaQr.MerchantCatPadded = banglaQr.MerchantCategory.ToString("D4"); if (banglaQr.MerchantName.Length > 25) { banglaQr.MerchantName = banglaQr.MerchantName.Substring(0, 25); } if (string.IsNullOrEmpty(banglaQr.MerchantCity)) { banglaQr.MerchantCity = "."; } if (banglaQr.MerchantCity.Length > 15) { banglaQr.MerchantCity = banglaQr.MerchantCity.Substring(0, 15); } if (banglaQr.CategoryId == "M") { banglaQr.categoryType = "1"; } if (banglaQr.CategoryId == "CM") { banglaQr.categoryType = "2"; } else { banglaQr.categoryType = "0"; } if (IsBanglaQrValid(banglaQr)) { string qrStream = GetBanglaQrCode(banglaQr.MerchantMphone, banglaQr.MerchantCatPadded, banglaQr.MerchantName, banglaQr.MerchantCity, banglaQr.categoryType); return(qrStream); } else { return(null); } }
private bool IsBanglaQrValid(BanglaQr banglaQr) { if (string.IsNullOrEmpty(banglaQr.MerchantMphone) && banglaQr.MerchantMphone.Length == 13) { return(false); } else if (string.IsNullOrEmpty(banglaQr.MerchantName) && banglaQr.MerchantName.Length <= 25) { return(false); } else if (string.IsNullOrEmpty(banglaQr.MerchantCity) && banglaQr.MerchantCity.Length <= 15) { return(false); } else if (string.IsNullOrEmpty(banglaQr.MerchantCatPadded) && banglaQr.MerchantCatPadded.Length == 4) { return(false); } else { return(true); } }