/// <summary> /// This returns the primary key information. /// </summary> /// <param name="lidType"></param> /// <param name="lid"></param> /// <param name="lidPk"></param> /// <returns></returns> public async Task <DashboardPrimaryKeysModel> GetDashboardSearchPrimaryKeys(LidTypeEnum lidType, string lid, int?lidPk) { const string OutTerminalNbrParamName = "OutTerminalNbr"; const string OutMerchantIDParamName = "OutMerchantID"; const string OutCustIDParamName = "OutCustID"; const string OutputLidPkTypeParamName = "OutputLidPkType"; var response = await this._connectionFactory.GetConnection(async c => { var primaryKeyInfo = new DashboardPrimaryKeysModel(); var p = new DynamicParameters(); p.Add("InputLid", lid, DbType.String); p.Add("InputPk", lidPk, DbType.Int32); p.Add("InputType", (int)lidType, DbType.Int32); p.Add(OutTerminalNbrParamName, DbType.Int32, direction: ParameterDirection.Output); p.Add(OutMerchantIDParamName, DbType.Int32, direction: ParameterDirection.Output); p.Add(OutCustIDParamName, DbType.Int32, direction: ParameterDirection.Output); p.Add(OutputLidPkTypeParamName, DbType.Int32, direction: ParameterDirection.Output); //await c.QueryAsync<Wp.CIS.LynkSystems.Model.TransactionsInquiry>(sql: "[CISPlus].[uspCISPlusGetPrimaryKeys]", param: p, commandType: CommandType.StoredProcedure); await c.ExecuteAsync(sql: "[CISPlus].[uspCISPlusGetPrimaryKeys]", param: p, commandType: CommandType.StoredProcedure); primaryKeyInfo.TerminalNbr = p.Get <int?>(OutTerminalNbrParamName); primaryKeyInfo.MerchantID = p.Get <int?>(OutMerchantIDParamName); primaryKeyInfo.CustomerID = p.Get <int?>(OutCustIDParamName); primaryKeyInfo.LidType = (LidTypeEnum)p.Get <int?>(OutputLidPkTypeParamName); return(primaryKeyInfo); }); return(response); }
/// <summary> /// /// </summary> /// <param name="lidtype"></param> /// <param name="lid"></param> /// <param name="lidPk"></param> /// <returns></returns> public async Task <DashboardPrimaryKeysModel> GetDashboardSearchPrimaryKeys(LidTypeEnum lidtype, string lid, int?lidPk) { DashboardPrimaryKeysModel response = null; try { response = await this._dashboardRepository .GetDashboardSearchPrimaryKeys(lidtype, lid, lidPk); switch (response.LidType) { case LidTypeEnum.Customer: if (true == response.CustomerID.HasValue) { response.RecordFound = true; response.ConvertedLidPk = response.CustomerID; } else { response.RecordFound = false; } break; case LidTypeEnum.Merchant: if (true == response.MerchantID.HasValue) { response.RecordFound = true; response.ConvertedLidPk = response.MerchantID; } else { response.RecordFound = false; } break; case LidTypeEnum.Terminal: if (true == response.TerminalNbr.HasValue) { response.RecordFound = true; response.ConvertedLidPk = response.TerminalNbr; } else { response.RecordFound = false; } break; default: response.RecordFound = false; break; } } catch (Exception) { throw; } return(response); }