/// <summary> /// 升级更新下载后未更新,通过读取数据库更新记录进行更新 /// </summary> /// <returns></returns> public string UpdateSoftware(out bool isForce) { string DowloadPath = string.Empty; isForce = false; var entityList = SoftwareVersionService.LoadEntities(x => x.LBBM == (int)LbblmType.Client && x.IsDownComplete.HasValue && x.IsDownComplete.Value).OrderByDescending(x => x.ID).FirstOrDefault(); if (entityList != null) { string clientVersion = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(); if (GetClientVersionToDouble(clientVersion) < GetClientVersionToDouble(entityList.Version)) { DowloadPath = entityList.DowloadPath; isForce = entityList.IsForceUpdate.HasValue && entityList.IsForceUpdate.Value; } } return(DowloadPath); }
/// <summary> /// 检查客户端、开票软件升级 /// </summary> /// <returns>true:相同,false:不同</returns> public bool CheckClientUpdate(int LBBM, out string serverClientVersion, out bool isForce) { serverClientVersion = string.Empty; string localVersion = string.Empty; isForce = false; try { var entity = SoftwareVersionService.LoadEntities(x => x.LBBM == LBBM && x.IsDownComplete == true).OrderByDescending(x => x.ID).FirstOrDefault(); if (LBBM == (int)LbblmType.Client) { localVersion = entity != null ? entity.Version : System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(); } string strRequest = new JavaScriptSerializer().Serialize(new { LBBM = LBBM.ToString() }); bool result = false; string errorMsg = string.Empty; serverClientVersion = WSInterface.GetResponse(strRequest, InterfaceType.CX, ref result, out errorMsg); if (result) { dynamic serverVersionResponse = new JsonSerializer().Deserialize <dynamic>(new JsonTextReader(new StringReader(serverClientVersion))); if (LBBM == (int)LbblmType.Client && GetClientVersionToDouble(localVersion) < GetClientVersionToDouble(serverVersionResponse.VERSION.ToString())) { serverClientVersion = serverVersionResponse.VERSION.ToString(); if (serverVersionResponse.QZSJBZ.ToString() == ForceUpdate.Force.GetHashCode().ToString()) { isForce = true; } return(false); } } return(true); } catch (Exception e) { Logging.Log4NetHelper.Error(typeof(MainWindowService), Message.CheckVersion + e.ToString()); } return(true); }