public InvitationDetail SelectInvitationDetail(int Invpeopleid) { var sql = "select b.username as UserName,isnull(sum(c.investment_amount),0.00) as InvestedAmount,(select top 1 invest_time from hx_Bid_records where hx_Bid_records.investor_registerid = a.invpersonid order by invest_time desc) as invest_time, b.registration_time from hx_td_Userinvitation a left join hx_member_table b on a.invpersonid = b.registerid left join hx_Bid_records c on a.invpersonid = c.investor_registerid where a.Invpeopleid = @Invpeopleid group by a.invpersonid,b.username,b.registration_time order by invest_time desc,b.registration_time desc"; SqlParameter[] parameters = { new SqlParameter("@Invpeopleid", SqlDbType.Int, 4) }; parameters[0].Value = Invpeopleid; var ent = new InvitationDetail() { InvitationTotalAmount = "0.00", InvitedInvestedPeopleCount = "0", InvitedPeopleCount = "0" }; var ds = DbHelper.Query(sql, parameters); decimal invitationTotalAmount = 0.00M; int invitedPeopleCount = 0, invitedInvestedPeopleCount = 0; if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { InitInvitationDetailList(ds.Tables[0], ref invitedPeopleCount, ref invitedInvestedPeopleCount, ref invitationTotalAmount); } ent.InvitationTotalAmount = invitationTotalAmount.ToString("f2") + "元"; ent.InvitedPeopleCount = invitedPeopleCount.ToString() + "人"; ent.InvitedInvestedPeopleCount = invitedInvestedPeopleCount.ToString() + "人"; return(ent); }
public async Task <IActionResult> InvitationDetail(int invitationId) { ProcessSystemInfo(); Invatation invitation; var user = await _userManager.GetUserAsync(User); try { invitation = _context.Invatations.First(a => a.Id == invitationId); var employeeId = _context.EmployeeCvs.First(a => a.Id == invitation.EmployeeCvId).EmployeeId; if (user.Id != employeeId) { TempData["Error"] = "Please select correct invitation"; return(RedirectToAction("MyInvitations")); } } catch (InvalidOperationException) { TempData["Error"] = "Please select correct invitation"; return(RedirectToAction("MyInvitations")); } var jobProfile = _context.EmployerJobProfiles.First(a => a.Id == invitation.EmployerJobProfileId); var employer = _context.Employers.First(a => a.Id == jobProfile.EmployerId); var result = new InvitationDetail { SentDate = invitation.SentTime, CompanyDescription = employer.BriefDescription, JobDescription = jobProfile.Description, Title = jobProfile.Title, InvitationId = invitation.Id }; return(View(result)); }
public BasePage <List <UserInvestedStatistics> > SelectInvitationDetailPage(int Invpeopleid, int pageIndex, int pageSize = 12) { BasePage <List <UserInvestedStatistics> > result = new BasePage <List <UserInvestedStatistics> >() { pageCount = 0, recordCount = 0, rows = new List <UserInvestedStatistics>() }; var sql = "select b.username as UserName,isnull(sum(c.investment_amount),0.00) as InvestedAmount,(select top 1 invest_time from hx_Bid_records where hx_Bid_records.investor_registerid = a.invpersonid order by invest_time desc) as invest_time, b.registration_time from hx_td_Userinvitation a left join hx_member_table b on a.invpersonid = b.registerid left join hx_Bid_records c on a.invpersonid = c.investor_registerid where a.Invpeopleid = @Invpeopleid group by a.invpersonid,b.username,b.registration_time order by invest_time desc,b.registration_time desc"; SqlParameter[] parameters = { new SqlParameter("@Invpeopleid", SqlDbType.Int, 4) }; parameters[0].Value = Invpeopleid; var ent = new InvitationDetail() { InvitationTotalAmount = "0.00", InvitedInvestedPeopleCount = "0", InvitedPeopleCount = "0" }; var ds = DbHelper.Query(sql, parameters); decimal invitationTotalAmount = 0.00M; int invitedPeopleCount = 0, invitedInvestedPeopleCount = 0; if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var items = InitInvitationDetailList(ds.Tables[0], ref invitedPeopleCount, ref invitedInvestedPeopleCount, ref invitationTotalAmount); if (items.Count > 0) { result.pageCount = items.Count / pageSize; if (items.Count % pageSize > 0) { result.pageCount += 1; } result.recordCount = items.Count; if (pageIndex < 1) { pageIndex = 1; } result.rows = items.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } } return(result); }