TestController.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. using Ant.Data;
  2. using Ant.ORM;
  3. using MES.Production.Entity;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Web;
  9. using System.Web.Mvc;
  10. namespace ChangFa.Machinery.WebPage.Controllers
  11. {
  12. public class TestController : Controller
  13. {
  14. MES.Production.Service.IService.ISystemManage SystemManage { get; set; }
  15. //
  16. // GET: /Test/
  17. /// <summary>
  18. /// 测试数据库是否联通
  19. /// </summary>
  20. public ActionResult Index()
  21. {
  22. try
  23. {
  24. string str = "Wrong";
  25. if (SystemManage.LoadAll(null).Any())
  26. str = "Success";
  27. Response.Write(str);
  28. try
  29. {
  30. using (this.SystemManage.Transaction)
  31. {
  32. Response.Write(this.SystemManage.LoadAll(null).Count());
  33. this.SystemManage.Commit();
  34. }
  35. }
  36. catch (Exception e) { this.SystemManage.Rollback(); }
  37. return View();
  38. }
  39. catch (Exception e) { throw e; }
  40. }
  41. /// <summary>
  42. ///
  43. /// </summary>
  44. /// <param name="sportid"></param>
  45. /// <param name="seid"></param>
  46. /// <param name="keysn"></param>
  47. /// <returns></returns>
  48. public ActionResult SporterMatchDetail(int? sportid, int? seid, string keysn)
  49. {
  50. SporterInfo sporterInfo = new SporterInfo();
  51. if (sportid != null)
  52. {
  53. using (AntORM orm = new AntORM())
  54. {
  55. try
  56. {
  57. orm.db = DataAccessFactory.CreateDataConnection("CyclingItem");
  58. RequestItemSqlModel request = new RequestItemSqlModel
  59. {
  60. newSt = new SqlNote() { Author = "季健国", NewSt = new System.Diagnostics.StackTrace(true), SqlDesc = "导出报名信息" },
  61. };
  62. string strsql = @"SELECT b.*,c.SmallEventName
  63. FROM YW_MatchReport as a
  64. LEFT JOIN YM_Sporter as b on a.SporterID=b.ID
  65. LEFT JOIN YW_ProjectEntry as c on a.PEID=c.ID
  66. LEFT JOIN YW_SportsEvent as d on a.SEPID=d.ID
  67. where a.SEPID=" + seid + " and b.ID=" + sportid + " and d.State<5";
  68. request.StrSql = strsql;
  69. var result = orm.GetDataTableList(request);
  70. if (result.IsSuccess)
  71. {
  72. string item = ""; DataRow drr = result.DataTable.Rows[0];
  73. sporterInfo.Name = drr["Name"].ToString();
  74. sporterInfo.SporterPicUrl = drr["SporterPicUrl"].ToString();
  75. sporterInfo.StudentNoPicUrl = drr["StudentNoPicUrl"].ToString();
  76. sporterInfo.IDCard = drr["IDCard"].ToString();
  77. sporterInfo.SchoolName = drr["SchoolName"].ToString();
  78. sporterInfo.StudentNo = drr["StudentNo"].ToString();
  79. foreach (DataRow dr in result.DataTable.Rows)
  80. {
  81. item = item + "," + dr["SmallEventName"].ToString();
  82. }
  83. sporterInfo.ItemList = string.Join(",", item.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
  84. }
  85. }
  86. catch (Exception e)
  87. {
  88. }
  89. }
  90. }
  91. return View(sporterInfo);
  92. }
  93. }
  94. }