private DefaultPolicyQueryParameter getCondition() { DefaultPolicyQueryParameter parameter = new DefaultPolicyQueryParameter(); if (!string.IsNullOrWhiteSpace(ddlAirlines.SelectedValue)) { parameter.Airline = ddlAirlines.SelectedValue; } parameter.AdultProviderId = ucAudltProvider.CompanyId; parameter.ChildProviderId = ucChildProvider.CompanyId; return(parameter); }
public IEnumerable <NormalDefaultPolicyInfo> QueryDefaultList(DefaultPolicyQueryParameter parameter, Pagination pagination) { if (parameter == null) { throw new ArgumentException("parameter"); } if (pagination == null) { throw new ArgumentException("pagination"); } var result = new List <NormalDefaultPolicyInfo>(); ClearParameters(); AddParameter("@iAirline", parameter.Airline); AddParameter("@iAdultProviderName", parameter.AdultProviderName); AddParameter("@iChildProviderName", parameter.ChildProviderName); if (parameter.AdultProviderId.HasValue) { AddParameter("@iAdultProviderId", parameter.AdultProviderId.Value); } else { AddParameter("@iAdultProviderId", DBNull.Value); } if (parameter.ChildProviderId.HasValue) { AddParameter("@iChildProviderId", parameter.ChildProviderId.Value); } else { AddParameter("@iChildProviderId", DBNull.Value); } if (parameter.AdultCommission.HasValue) { AddParameter("@iAdultCommission", parameter.AdultCommission); } else { AddParameter("@iAdultCommission", DBNull.Value); } if (parameter.ChildCommission.HasValue) { AddParameter("@iChildCommission", parameter.ChildCommission); } else { AddParameter("@iChildCommission", DBNull.Value); } AddParameter("@iPageIndex", pagination.PageIndex); AddParameter("@iPageSize", pagination.PageSize); AddParameter("@iGetCount", pagination.GetRowCount); var totalCount = AddParameter("@oTotalCount"); totalCount.DbType = System.Data.DbType.Int32; totalCount.Direction = System.Data.ParameterDirection.Output; using (var reader = ExecuteReader("P_QueryDefaultPolicy", System.Data.CommandType.StoredProcedure)) { while (reader.Read()) { var item = new NormalDefaultPolicyInfo { Airline = reader.GetString(0), AdultProviderId = reader.GetGuid(1), AdultProviderName = reader.GetString(2), AdultProviderAbbreviateName = reader.GetString(3), AdultCommission = reader.GetDecimal(4), ChildProviderId = reader.GetGuid(5), ChildProviderName = reader.GetString(6), ChildProviderAbbreviateName = reader.GetString(7), ChildCommission = reader.GetDecimal(8) }; result.Add(item); } } if (pagination.GetRowCount) { pagination.RowCount = (int)totalCount.Value; } return(result); }