using Ant.Data; using Ant.ORM; using MES.Production.Entity; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.Mvc; namespace ChangFa.Machinery.WebPage.Controllers { public class TestController : Controller { MES.Production.Service.IService.ISystemManage SystemManage { get; set; } // // GET: /Test/ /// /// 测试数据库是否联通 /// public ActionResult Index() { try { string str = "Wrong"; if (SystemManage.LoadAll(null).Any()) str = "Success"; Response.Write(str); try { using (this.SystemManage.Transaction) { Response.Write(this.SystemManage.LoadAll(null).Count()); this.SystemManage.Commit(); } } catch (Exception e) { this.SystemManage.Rollback(); } return View(); } catch (Exception e) { throw e; } } /// /// /// /// /// /// /// public ActionResult SporterMatchDetail(int? sportid, int? seid, string keysn) { SporterInfo sporterInfo = new SporterInfo(); if (sportid != null) { using (AntORM orm = new AntORM()) { try { orm.db = DataAccessFactory.CreateDataConnection("CyclingItem"); RequestItemSqlModel request = new RequestItemSqlModel { newSt = new SqlNote() { Author = "季健国", NewSt = new System.Diagnostics.StackTrace(true), SqlDesc = "导出报名信息" }, }; string strsql = @"SELECT b.*,c.SmallEventName FROM YW_MatchReport as a LEFT JOIN YM_Sporter as b on a.SporterID=b.ID LEFT JOIN YW_ProjectEntry as c on a.PEID=c.ID LEFT JOIN YW_SportsEvent as d on a.SEPID=d.ID where a.SEPID=" + seid + " and b.ID=" + sportid + " and d.State<5"; request.StrSql = strsql; var result = orm.GetDataTableList(request); if (result.IsSuccess) { string item = ""; DataRow drr = result.DataTable.Rows[0]; sporterInfo.Name = drr["Name"].ToString(); sporterInfo.SporterPicUrl = drr["SporterPicUrl"].ToString(); sporterInfo.StudentNoPicUrl = drr["StudentNoPicUrl"].ToString(); sporterInfo.IDCard = drr["IDCard"].ToString(); sporterInfo.SchoolName = drr["SchoolName"].ToString(); sporterInfo.StudentNo = drr["StudentNo"].ToString(); foreach (DataRow dr in result.DataTable.Rows) { item = item + "," + dr["SmallEventName"].ToString(); } sporterInfo.ItemList = string.Join(",", item.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); } } catch (Exception e) { } } } return View(sporterInfo); } } }