public async Task <int> InsertNewAuditItemAsync( ContentURI uri, AccountToAudit audit) { int iId = 0; Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri); SqlParameter[] oPrams = { sqlIO.MakeInParam("@MemberId", SqlDbType.Int, 4, audit.MemberId), sqlIO.MakeInParam("@MemberRole", SqlDbType.NVarChar, 25, audit.MemberRole), sqlIO.MakeInParam("@ClubInUseId", SqlDbType.Int, 4, audit.ClubInUseId), sqlIO.MakeInParam("@ClubInUseAuthorizationLevel", SqlDbType.NVarChar, 25, audit.ClubInUseAuthorizationLevel), sqlIO.MakeInParam("@EditedDocURI", SqlDbType.NVarChar, 300, audit.EditedDocURI), sqlIO.MakeInParam("@EditedDocFullPath", SqlDbType.NVarChar, 400, audit.EditedDocFullPath), sqlIO.MakeInParam("@ServerSubAction", SqlDbType.NVarChar, 25, audit.ServerSubAction), sqlIO.MakeInParam("@EditDate", SqlDbType.Date, 4, audit.EditDate), sqlIO.MakeInParam("@AccountId", SqlDbType.Int, 4, audit.AccountId) }; iId = await sqlIO.RunProcIntAsync("0InsertAudit", oPrams); sqlIO.Dispose(); return(iId); }
public async Task <List <AccountToAudit> > GetAuditsByClubIdAsync( ContentURI uri, int accountId, int numberRecords) { List <AccountToAudit> colClubAudits = new List <AccountToAudit>(); if (accountId == 0) { //set default objects AccountToAudit atoa = new AccountToAudit(true); colClubAudits.Add(atoa); return(colClubAudits); } Helpers.SqlIOAsync sqlIO = new Helpers.SqlIOAsync(uri); SqlParameter[] colPrams = { sqlIO.MakeInParam("@AccountId", SqlDbType.Int, 4, accountId), sqlIO.MakeInParam("@Number", SqlDbType.Int, 4, numberRecords) }; SqlDataReader dataReader = await sqlIO.RunProcAsync( "0GetAuditsByClubId", colPrams); if (dataReader != null) { using (dataReader) { while (await dataReader.ReadAsync()) { AccountToAudit atoa = new AccountToAudit(true); atoa.PKId = dataReader.GetInt32(0); atoa.MemberId = dataReader.GetInt32(1); atoa.MemberRole = dataReader.GetString(2); atoa.ClubInUseId = dataReader.GetInt32(3); atoa.ClubInUseAuthorizationLevel = dataReader.GetString(4); atoa.EditedDocURI = dataReader.GetString(5); atoa.EditedDocFullPath = dataReader.GetString(6); atoa.ServerSubAction = dataReader.GetString(7); atoa.EditDate = dataReader.GetDateTime(8); atoa.AccountId = dataReader.GetInt32(9); atoa.Account = new Account(); atoa.Account.PKId = dataReader.GetInt32(10); atoa.Account.AccountName = dataReader.GetString(11); atoa.Account.AccountDesc = dataReader.GetString(12); atoa.Account.AccountLongDesc = dataReader.GetString(13); atoa.Account.AccountEmail = dataReader.GetString(14); atoa.Account.AccountURI = dataReader.GetString(15); atoa.Account.AccountClassId = dataReader.GetInt32(16); atoa.Account.GeoRegionId = dataReader.GetInt32(17); //not in db atoa.Account.ClubDocFullPath = string.Empty; atoa.Account.PrivateAuthorizationLevel = AccountHelper.AUTHORIZATION_LEVELS.none; atoa.Account.NetCost = 0; atoa.Account.TotalCost = 0; atoa.Account.URIFull = string.Empty; colClubAudits.Add(atoa); } } } else { //set default objects AccountToAudit aton = new AccountToAudit(true); colClubAudits.Add(aton); } sqlIO.Dispose(); return(colClubAudits); }