/// <summary> /// 读取车辆信息 /// </summary> /// <param name="vinf"></param> /// <returns></returns> private bool getVehicleInfo(out vehicleInfo vinf) { vinf = new vehicleInfo(); try { StringBuilder temp = new StringBuilder(); temp.Length = 2048; ini.INIIO.GetPrivateProfileString("ExtLink", "ScanCode", "", temp, 2048, extlinkdir); vinf.scanCode = temp.ToString().Trim(); ini.INIIO.GetPrivateProfileString("ExtLink", "ScanOK", "", temp, 2048, extlinkdir); vinf.scanOK = temp.ToString().Trim(); ini.INIIO.GetPrivateProfileString("ExtLink", "TestDev", "9", temp, 2048, extlinkdir); vinf.testDev = (ENUM_EQUIP_TYPE)(int.Parse(temp.ToString().Trim())); ini.INIIO.GetPrivateProfileString("ExtLink", "CarType", "", temp, 2048, extlinkdir); vinf.carType = temp.ToString().Trim(); if (vinf.scanOK == "1") { LogMessage("获取到车辆信息:" + vinf.scanCode + "|" + vinf.scanOK + "|" + vinf.testDev + "|" + vinf.carType); return(true); } else { return(false); } } catch (Exception er) { return(false); } }
private void timer1_Tick(object sender, EventArgs e) { Msg(labelTime, panelTime, DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"), 2); if (childTest.controller.scanState == 0) { timerCount++; if (timerCount == 8) { timerCount = 0; Msg(labelOrder1, panelOrder1, "等待检测指令", 0); } else if (timerCount == 6) { Msg(labelOrder1, panelOrder1, "", 0); } } else { Msg(labelOrder1, panelOrder1, "系统正忙", 0); } if (childTest.controller.scanState == 0) { if (thisSysConfig.workMode == ENUM_WORK_MODE.WORK_MODE_NET)//联网模式下 { if (System.IO.File.Exists(extlinkdir)) { fileExistTime++; if (fileExistTime == 2) { fileExistTime = 0; vehicleInfo thisVehicleInfo_temp; if (getVehicleInfo(out thisVehicleInfo_temp)) { setScanOK(); thisVehicleInfo = thisVehicleInfo_temp; Msg(labelCLHP, panelCLHP, thisVehicleInfo.scanCode, 1); Msg(labelVehicleName, panelVehicleName, thisVehicleInfo.carType, 1); startTest(); } } } } else { } } }
public void UpdateClaimType(string xml) { var mitchellclaim = (MitchellClaim)Helper.CreateObject(xml, new MitchellClaim()); if (mitchellclaim.ClaimNumber == null) { throw new FaultException("Claimnumber should be provided to update a claim"); } using (MitchellClaimsDbEntities _db = new MitchellClaimsDbEntities()) { var claimval = (from claim in _db.mitchellClaims where claim.ClaimNumber == mitchellclaim.ClaimNumber select claim).FirstOrDefault(); if (claimval == null) { throw new FaultException("No claims found for specified claimnumber"); } if (claimval.LossInfoId != null) { if (mitchellclaim.LossInfo != null) { var lossinfo = claimval.lossInfo; if (mitchellclaim.LossInfo.CauseOfLoss != 0) { lossinfo.CauseOfLossId = (int)mitchellclaim.LossInfo.CauseOfLoss; } if (mitchellclaim.LossInfo.ReportedDate != DateTime.MinValue) { lossinfo.ReportedDate = mitchellclaim.LossInfo.ReportedDate; } if (mitchellclaim.LossInfo.LossDescription != null) { lossinfo.LossDescription = mitchellclaim.LossInfo.LossDescription; } _db.SaveChanges(); } } else { lossInfo _newlossinfo = null; if (mitchellclaim.LossInfo != null) { lossInfo _info = new lossInfo() { CauseOfLossId = (int)(mitchellclaim.LossInfo.CauseOfLoss), ReportedDate = mitchellclaim.LossInfo.ReportedDate, LossDescription = mitchellclaim.LossInfo.LossDescription }; _newlossinfo = _db.lossInfoes.Add(_info); claimval.LossInfoId = _newlossinfo.LossInfoId; _db.SaveChanges(); } } if (mitchellclaim.ClaimantFirstName != null) { claimval.ClaimantFirstName = mitchellclaim.ClaimantFirstName; } if (mitchellclaim.ClaimantLastName != null) { claimval.ClaimantLastName = mitchellclaim.ClaimantLastName; } if (mitchellclaim.Status != 0) { claimval.Status = (int)mitchellclaim.Status; } if (mitchellclaim.LossDate != DateTime.MinValue) { claimval.LossDate = mitchellclaim.LossDate; } if (mitchellclaim.AssignedAdjusterID != 0) { claimval.AssignedAdjusterID = mitchellclaim.AssignedAdjusterID; } _db.SaveChanges(); if (mitchellclaim.Vehicles.Count() != 0) { List <vehicleInfo> _vehicles = new List <vehicleInfo>(); foreach (var item in mitchellclaim.Vehicles) { var vehicle = (from auto in claimval.vehicleInfoes where auto.Vin == item.Vin select auto).FirstOrDefault(); if (vehicle != null) { if (item.ModelYear != 0) { vehicle.ModelYear = (int)item.ModelYear; } if (item.MakeDescription != null) { vehicle.MakeDescription = item.MakeDescription; } if (item.ModelDescription != null) { vehicle.ModelDescription = item.ModelDescription; } if (item.EngineDescription != null) { vehicle.EngineDescription = item.EngineDescription; } if (item.ExteriorColor != null) { vehicle.ExteriorColor = item.ExteriorColor; } if (item.LicPlate != null) { vehicle.LicPlate = item.LicPlate; } if (item.LicPlateState != null) { vehicle.LicPlateState = item.LicPlateState; } if (item.LicPlateExpDate != DateTime.MinValue) { vehicle.LicPlateExpDate = (DateTime)item.LicPlateExpDate; } if (item.DamageDescription != null) { vehicle.DamageDescription = item.DamageDescription; } if (item.Mileage != 0) { vehicle.Mileage = (int)item.Mileage; } } else { vehicleInfo _vehicle = new vehicleInfo() { Vin = item.Vin, ModelYear = item.ModelYear, MakeDescription = item.MakeDescription, ModelDescription = item.ModelDescription, EngineDescription = item.EngineDescription, ExteriorColor = item.ExteriorColor, LicPlate = item.LicPlate, LicPlateState = item.LicPlateState, LicPlateExpDate = item.LicPlateExpDate, DamageDescription = item.DamageDescription, Mileage = item.Mileage, ClaimNumber = claimval.ClaimNumber }; _db.vehicleInfoes.Add(_vehicle); } } _db.SaveChanges(); } } }
public void CreateNewClaimType(string xml) { var mitchellclaim = (MitchellClaim)Helper.CreateObject(xml, new MitchellClaim()); if (mitchellclaim.ClaimNumber == null || mitchellclaim.Vehicles.Count == 0) { throw new FaultException("Claimnumber or Vehicles should be provided to create a claim"); } using (MitchellClaimsDbEntities _db = new MitchellClaimsDbEntities()) { var checkclaim = _db.mitchellClaims.Where(x => x.ClaimNumber == mitchellclaim.ClaimNumber).FirstOrDefault(); if (checkclaim != null) { throw new FaultException("Cannot create duplicate claim numbers"); } lossInfo _newlossinfo = null; if (mitchellclaim.LossInfo != null) { lossInfo _info = new lossInfo() { CauseOfLossId = (int)(mitchellclaim.LossInfo.CauseOfLoss), ReportedDate = mitchellclaim.LossInfo.ReportedDate, LossDescription = mitchellclaim.LossInfo.LossDescription }; _newlossinfo = _db.lossInfoes.Add(_info); _db.SaveChanges(); } mitchellClaim _claim = new mitchellClaim() { ClaimNumber = mitchellclaim.ClaimNumber, ClaimantFirstName = mitchellclaim.ClaimantFirstName, ClaimantLastName = mitchellclaim.ClaimantLastName, Status = (int)mitchellclaim.Status, LossDate = mitchellclaim.LossDate, AssignedAdjusterID = mitchellclaim.AssignedAdjusterID }; var _newclaim = _db.mitchellClaims.Add(_claim); if (mitchellclaim.LossInfo != null) { _newclaim.LossInfoId = _newlossinfo.LossInfoId; } _db.SaveChanges(); foreach (var vehicle in mitchellclaim.Vehicles) { vehicleInfo _vehicle = new vehicleInfo() { Vin = vehicle.Vin, ModelYear = vehicle.ModelYear, MakeDescription = vehicle.MakeDescription, ModelDescription = vehicle.ModelDescription, EngineDescription = vehicle.EngineDescription, ExteriorColor = vehicle.EngineDescription, LicPlate = vehicle.LicPlate, LicPlateState = vehicle.LicPlateState, LicPlateExpDate = vehicle.LicPlateExpDate, DamageDescription = vehicle.DamageDescription, Mileage = vehicle.Mileage, ClaimNumber = mitchellclaim.ClaimNumber }; _db.vehicleInfoes.Add(_vehicle); } _db.SaveChanges(); } }