public DataTransferObject.Organization.WithholdingView GetWithholding(WithholdingAccountType accountType, Guid company) { DataTransferObject.Organization.WithholdingView withholding = null; //[AccountNo] = @AccountNo AND string sql = "SELECT [AccountNo],[AccountType],[Time],[Status],[Amount],[Company] FROM [T_Withholding] WHERE [AccountType]=@AccountType AND [Company] = @Company "; using (DbOperator dbOperator = new DbOperator(Provider, ConnectionString)) { //dbOperator.AddParameter("AccountNo", withholdingView.AccountNo); dbOperator.AddParameter("AccountType", accountType); dbOperator.AddParameter("Company", company); using (System.Data.Common.DbDataReader reader = dbOperator.ExecuteReader(sql)) { if (reader.Read()) { withholding = new DataTransferObject.Organization.WithholdingView(); withholding.AccountNo = reader.GetString(0); withholding.AccountType = (WithholdingAccountType)reader.GetByte(1); withholding.Time = reader.GetDateTime(2); withholding.Status = (WithholdingProtocolStatus)reader.GetByte(3); withholding.Amount = reader.GetDecimal(4); withholding.Company = reader.GetGuid(5); } } } return(withholding); }
public EmergentOrder QueryEmergentOrder(decimal id, OrderIdType orderIdType) { string sql = "SELECT Id,[Type],Content,[Time],Account,OrderIdType FROM T_EmergentOrder WHERE Id=@Id AND OrderIdType =@OrderIdType"; EmergentOrder result = null; using (DbOperator dboperator = new DbOperator(Provider, ConnectionString)) { dboperator.AddParameter("Id", id); dboperator.AddParameter("OrderIdType", orderIdType); using (System.Data.Common.DbDataReader reader = dboperator.ExecuteReader(sql)) { if (reader.Read()) { result = new EmergentOrder(); result.Id = reader.GetDecimal(0); result.Type = (OrderStatus)reader.GetInt32(1); result.Content = reader.GetString(2); result.Time = reader.GetDateTime(3); result.Account = reader.GetString(4); result.OrderIdTypeValue = (OrderIdType)reader.GetByte(5); } } } return(result); }
public void MapProperties(System.Data.Common.DbDataReader dr) { ID = dr.GetLong("ID"); Invoice_ID = dr.GetString("Invoice_ID"); Payment_Type = (DepositType)dr.GetByte("Payment_Type"); Detail = dr.GetString("Detail"); Payment = dr.GetDouble("Payment"); Total_Payment = dr.GetDouble("Total_Payment"); Balance = dr.GetDouble("Balance"); Created_By = dr.GetLong("Created_By"); Updated_By = dr.GetLong("Updated_By"); Created_Date = dr.GetDateTime("Created_Date"); Updated_Date = dr.GetDateTime("Updated_Date"); Organization_ID = dr.GetLong("Organization_ID"); IsActive = dr.GetBoolean("IsActive"); IsDeleted = dr.GetBoolean("IsDeleted"); }
private static Domain.IncomeGroupLimitGroup loadIncomeGroup(System.Data.Common.DbDataReader reader) { Domain.IncomeGroupLimitGroup income = new Domain.IncomeGroupLimitGroup(); income.Limitation = new List <Domain.IncomeGroupLimit>(); Domain.IncomeGroupLimit limit = null; while (reader.Read()) { var currentId = reader.GetGuid(0); if (income.Id != currentId) { income.Id = currentId; income.CompanyId = reader.GetGuid(1); income.IncomeGroupId = reader.IsDBNull(2) ? (Guid?)null : reader.GetGuid(2); income.Remark = reader.GetString(3); income.Limitation = new List <Domain.IncomeGroupLimit>(); } var currlimitId = reader.GetGuid(4); if (!income.Limitation.Any(it => it.Id == currlimitId)) { limit = new Domain.IncomeGroupLimit(); limit.Id = currlimitId; limit.IncomeId = reader.GetGuid(5); limit.Type = (Common.Enums.PeriodType)reader.GetByte(6); limit.Price = reader.GetInt32(7); limit.Airlines = reader.GetString(12); limit.IsOwnerPolicy = reader.GetBoolean(13); limit.Period = new List <Domain.IncomeGroupPeriod>(); income.Limitation.Add(limit); } Domain.IncomeGroupPeriod period = new Domain.IncomeGroupPeriod(); period.DeductId = reader.GetGuid(8); period.StartPeriod = reader.GetDecimal(9); period.EndPeriod = reader.GetDecimal(10); period.Period = reader.GetDecimal(11); limit.Period.Add(period); } return(income); }