private int SubmitEventLog(Plan_RunEvent_TrainDetail TrainDetail) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TAB_Plan_RunEvent_TrainDetail"); strSql.Append("(strRunEventGUID,dtEventTime,strTrainmanNumber1,strTrainmanNumber2,nTMIS,nKeHuo,strTrainNo,strTrainTypeName,strTrainNumber,dtCreateTime,nResultID,strResult,nEventID,strGUID,JiaoLuAndnStationNo)"); strSql.Append("values(@strRunEventGUID,@dtEventTime,@strTrainmanNumber1,@strTrainmanNumber2,@nTMIS,@nKeHuo,@strTrainNo,@strTrainTypeName,@strTrainNumber,@dtCreateTime,@nResultID,@strResult,@nEventID,@strGUID,@JiaoLuAndnStationNo)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@strRunEventGUID", TrainDetail.strRunEventGUID), new SqlParameter("@dtEventTime", TrainDetail.dtEventTime), new SqlParameter("@strTrainmanNumber1", TrainDetail.strTrainmanNumber1), new SqlParameter("@strTrainmanNumber2", TrainDetail.strTrainmanNumber2), new SqlParameter("@nTMIS", TrainDetail.nTMIS), new SqlParameter("@nKeHuo", TrainDetail.nKeHuo), new SqlParameter("@strTrainNo", TrainDetail.strTrainNo), new SqlParameter("@strTrainTypeName", TrainDetail.strTrainTypeName), new SqlParameter("@strTrainNumber", TrainDetail.strTrainNumber), new SqlParameter("@dtCreateTime", TrainDetail.dtCreateTime), new SqlParameter("@nResultID", TrainDetail.nResultID), new SqlParameter("@strResult", TrainDetail.strResult), new SqlParameter("@nEventID", TrainDetail.nEventID), new SqlParameter("@strGUID", TrainDetail.strGUID), new SqlParameter("@JiaoLuAndnStationNo", TrainDetail.JiaoLuAndnStationNo) }; return(Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.ConnString, CommandType.Text, strSql.ToString(), parameters))); }
public int SubmitRunEvent(RunEvent model) { int ErrCode = 0; string ErrInfo = ""; string eventGUID = Guid.NewGuid().ToString(); TrainmanPlan plan = new TrainmanPlan(); if (DBPlan.GetTrainPlanBriefByRange(model.strTrainmanNumber1, model.dtEventTime, plan)) { AddRunEvent(model, plan, eventGUID, ref ErrInfo, ref ErrCode); ErrCode = 0; } else { ErrCode = 0; ErrInfo = "没有指定乘务员的计划或机组信息"; } Plan_RunEvent_TrainDetail eventParam = new Plan_RunEvent_TrainDetail(); eventParam.strRunEventGUID = eventGUID; eventParam.dtEventTime = model.dtEventTime; eventParam.strTrainmanNumber1 = model.strTrainmanNumber1; eventParam.strTrainmanNumber2 = model.strTrainmanNumber2; eventParam.nTMIS = model.strStationName; eventParam.JiaoLuAndnStationNo = model.JiaoLuAndnStationNo; eventParam.nKeHuo = model.nKehuo; eventParam.strTrainNo = model.strTrainNo; eventParam.strTrainTypeName = model.strTrainTypeName; eventParam.strTrainNumber = model.strTrainNumber; eventParam.dtCreateTime = DateTime.Now; eventParam.nResultID = model.nResultID; eventParam.strResult = model.strResult; eventParam.nEventID = model.nEventID; eventParam.strGUID = Guid.NewGuid().ToString(); ////向TAB_Plan_RunEvent_Site中插入数据 SubmitEventLog(eventParam); return(ErrCode); }