/// <summary> /// 更新同步设置 /// </summary> /// <param name="set"></param> /// <returns></returns> public static bool UpdateStuLibSync(StuLibSyncSetting set) { IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService(); bool error = false; try { return(seatService.UpdateStuLibSync(set)); } catch (Exception ex) { error = true; SeatManageComm.WriteLog.Write("获取设置失败:" + ex.Message); return(false); } finally { ICommunicationObject ICommObjectService = seatService as ICommunicationObject; try { if (ICommObjectService.State == CommunicationState.Faulted) { ICommObjectService.Abort(); } else { ICommObjectService.Close(); } } catch { ICommObjectService.Abort(); } } }
public bool UpdateStuLibSync(StuLibSyncSetting set) { string strSet = set.ToString(); SqlParameter[] parameters = { new SqlParameter("@ServiceSet", SqlDbType.Text), new SqlParameter("@ServiceSetID", SqlDbType.Int, 4) }; parameters[0].Value = strSet; parameters[1].Value = 1; return(t_sm_service.Update(strSet, parameters)); }
/// <summary> /// 同步读者信息 /// </summary> public void SysnceReaderInfo(ref bool isUpdate) { try { StuLibSyncSetting syncSet = seatManageService.GetStuLibSync(); if (syncSet == null) { return; } if (syncSet.SyncMode != StudentSyncMode.OptionalSync) { return; } if (DateTime.Compare(DateTime.Parse(DateTime.Now.ToShortDateString() + " " + syncSet.SyncTime), DateTime.Now) < 0) { if (!isUpdate) { return; } addAmount = 0; updateAmount = 0; filedAmount = 0; IStuLibSync stuLibSync; try { stuLibSync = AssemblyFactory.CreateAssembly("IStuLibSync") as IStuLibSync; } catch { isUpdate = true; throw; } stuLibSync.StuLibSyncSet = syncSet; //同步开始执行事件 stuLibSync.Syncing += StuLibSync_Syncing; //同步结束事件 stuLibSync.Synced += StuLibSync_Synced; isUpdate = false; stuLibSync.Sync(); } else //如果时间过了,重新变为true; { isUpdate = true; } } catch (Exception ex) { WriteLog.Write(string.Format("读者信息同步:读者信息同步遇到异常:{0}", ex.Message)); } }
/// <summary> /// 更新同步设置 /// </summary> /// <param name="set"></param> /// <returns></returns> public static bool UpdateStuLibSync(StuLibSyncSetting set) { IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService(); bool error = false; try { return(seatService.UpdateStuLibSync(set)); } catch (Exception ex) { error = true; SeatManageComm.WriteLog.Write("获取设置失败:" + ex.Message); return(false); } }
/// <summary> /// 获取读者库同步设置 /// </summary> ///<param name="ID">设置编号</param> /// <returns></returns> public StuLibSyncSetting GetStuLibSync() { try { DataSet ds = t_sm_service.GetList(" ServiceSetID = 1", null); if (ds.Tables[0].Rows.Count > 0) { return(StuLibSyncSetting.Convert(ds.Tables[0].Rows[0]["ServiceSet"].ToString())); } else { return(null); } } catch { throw; } }
/// <summary> /// 连接测试 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void testsconn_Click(object sender, EventArgs e) { StuLibSyncSetting SyncSet = T_SM_SystemSet.GetStuLibSync(); if (SyncSet != null) { IStuLibSync StuLibSync = AssemblyFactory.CreateAssembly("IStuLibSync") as IStuLibSync;// SystemTerminalFactory.CreateStuLibSync(); StuLibSync.StuLibSyncSet = SyncSet; if (StuLibSync.LinkDataSourceTest()) { FineUI.Alert.Show("测试成功!"); } else { FineUI.Alert.Show("测试失败!"); } } else { FineUI.Alert.Show("获取设置失败!"); } }