public List<ViolationModel> GetUnProcessedWebShow(SCParams scParams) { List<ViolationModel> listUnprocessed = new List<ViolationModel>(); if (scParams.CarFrame == "123123") { CarInfoModel isExistCarInfoModel = GetCarInfoDetailForiHeart(scParams.CarNumber); if (isExistCarInfoModel != null) scParams.CarFrame = isExistCarInfoModel.CarFrame; } try { string serverErrorMsg = ""; CarInfoModel isExistCarInfoModel = GetCarInfoDetail(scParams.CarNumber, scParams.CarFrame); if (isExistCarInfoModel == null) { isExistCarInfoModel = new CarInfoModel(); isExistCarInfoModel.CarFrame = scParams.CarFrame; isExistCarInfoModel.CarNumber = scParams.CarNumber; InsertCarInfo(isExistCarInfoModel); } else { scParams.CarFrame = isExistCarInfoModel.CarFrame; } bool isRefresh = NeedRefresh(scParams.CarNumber, scParams.CarFrame, "U"); if (isRefresh) { GetAllUnProcessed(scParams, ref listUnprocessed); if (listUnprocessed.Count > 0 && listUnprocessed[0].ViolationAddress == "车架号后6位不匹配") { serverErrorMsg = "车架号后6位不匹配"; } else { foreach (ViolationModel currentModel in listUnprocessed) { InsertCarTrafficViolation(currentModel); } UpdateRefreshDate(scParams.CarNumber, "U"); } } if (string.IsNullOrEmpty(serverErrorMsg)) { listUnprocessed = GetViolation(scParams.CarNumber, scParams.CarFrame, "U"); } else { listUnprocessed.Clear(); listUnprocessed.Add(new ViolationModel { ViolationAddress = "[ERROR]" + serverErrorMsg }); } } catch (Exception ex) { listUnprocessed.Clear(); listUnprocessed.Add(new ViolationModel { ViolationAddress = "[ERROR]" + ex.Message }); } return listUnprocessed; }
private void InsertCarInfo(CarInfoModel model) { SqlHelper helper = new SqlHelper(); int isSucc = helper.ExecuteNonQuery("P_CarInfo_I", model.CarNumber, model.CarFrame, model.CarOwner, DateTime.Now.AddDays(-1), DateTime.Now.AddDays(-1)); }
public List<SCModel> GetUnProcessed(SCParams scParams) { List<ViolationModel> listUnprocessed = new List<ViolationModel>(); List<SCModel> retListUnprocessed = new List<SCModel>(); try { string serverErrorMsg = ""; CarInfoModel isExistCarInfoModel = GetCarInfoDetail(scParams.CarNumber, scParams.CarFrame); if (isExistCarInfoModel == null) { isExistCarInfoModel = new CarInfoModel(); isExistCarInfoModel.CarFrame = scParams.CarFrame; isExistCarInfoModel.CarNumber = scParams.CarNumber; InsertCarInfo(isExistCarInfoModel); } else { scParams.CarFrame = isExistCarInfoModel.CarFrame; } bool isRefresh = NeedRefresh(scParams.CarNumber, scParams.CarFrame, "U"); if (isRefresh) { GetAllUnProcessed(scParams, ref listUnprocessed); if (listUnprocessed.Count > 0 && listUnprocessed[0].ViolationAddress == "车架号后6位不匹配") { serverErrorMsg = "车架号后6位不匹配"; } else { foreach (ViolationModel currentModel in listUnprocessed) { InsertCarTrafficViolation(currentModel); } UpdateRefreshDate(scParams.CarNumber, "U"); } } if (string.IsNullOrEmpty(serverErrorMsg)) { List<ViolationModel> dbListViolationModel = GetViolation(scParams.CarNumber, scParams.CarFrame, "U"); foreach (ViolationModel currentModel in dbListViolationModel) { retListUnprocessed.Add(new SCModel() { ViolationAddress = currentModel.ViolationAddress, ViolationDateTime = currentModel.ViolationDateTime, ViolationAmount = currentModel.ViolationAmount.ToString(), ViolationScore = currentModel.ViolationScore.ToString() }); } } else { retListUnprocessed.Add(new SCModel { ViolationAddress = "[ERROR]" + serverErrorMsg }); } } catch (Exception ex) { retListUnprocessed.Add(new SCModel { ViolationAddress = "[ERROR]" + ex.Message }); } return retListUnprocessed; }