public override void Sync() { MessageManage messageManage = new MessageManage(); Action<DataRow> actionAddLocalMessageFile = new Action<DataRow>((dr) => { string xxbh = dr["xxbh"].ToString(); string messageFtpPath = CommonManage.GetFtpMessagePath(); LogOperation.Append(sbLog, "从" + targetCode + "到" + localCode + "同步系统消息(" + xxbh + ")的文件。"); targetFtp.CopyDirectory(messageFtpPath, xxbh, localFtp, messageFtpPath, xxbh, null); }); Action<DataRow> actionAddTargetMessageFile = new Action<DataRow>((dr) => { string xxbh = dr["xxbh"].ToString(); string messageFtpPath = CommonManage.GetFtpMessagePath(); LogOperation.Append(sbLog, "从" + localCode + "到" + targetCode + "同步系统消息(" + xxbh + ")的文件。"); localFtp.CopyDirectory(messageFtpPath, xxbh, targetFtp, messageFtpPath, xxbh, null); }); Action<DataRow> actionDeleteLocalMessageFile = new Action<DataRow>((dr) => { string xxbh = dr["xxbh"].ToString(); LogOperation.Append(sbLog, "删除" + localCode + "的系统消息(" + xxbh + ")的文件。"); localFtp.DeleteDirectory(CommonManage.GetFtpMessagePath(xxbh)); }); Action<DataRow> actionDeleteTargetMessageFile = new Action<DataRow>((dr) => { string xxbh = dr["xxbh"].ToString(); LogOperation.Append(sbLog, "删除" + targetCode + "的系统消息(" + xxbh + ")的文件。"); targetFtp.DeleteDirectory(CommonManage.GetFtpMessagePath(xxbh)); }); LogOperation.WriteTitle(sbLog, "同步系统消息开始(从" + targetCode + "到" + localCode + ")。"); SyncXxbh(targetDb, localDb, localCode, actionAddLocalMessageFile, actionDeleteTargetMessageFile, actionDeleteLocalMessageFile); LogOperation.WriteTitle(sbLog, "同步系统消息结束(从" + targetCode + "到" + localCode + ")。"); LogOperation.WriteTitle(sbLog, "同步系统消息开始(从" + localCode + "到" + targetCode + ")。"); SyncXxbh(localDb, targetDb, targetCode, actionAddTargetMessageFile, actionDeleteLocalMessageFile, actionDeleteTargetMessageFile); LogOperation.WriteTitle(sbLog, "同步系统消息结束(从" + localCode + "到" + targetCode + ")。"); }
private void SendMessage(List<string> userId, string msg) { XTXX xtxx = new XTXX(); xtxx.XXBH = Guid.NewGuid().ToString(); xtxx.XXBT = "系统消息"; xtxx.XXNR = msg; xtxx.FSR = "0"; xtxx.FSSJ = DateTime.Now; xtxx.XXLX = "1"; xtxx.FSRSC = "1"; List<XTXXJS> xtxxjss = new List<XTXXJS>(); foreach (string sjr in userId) { xtxxjss.Add(new XTXXJS() { JSXXBH = xtxx.XXBH, JSR = sjr, JSRXZDM = "", YDZT = "0", JSRSC = "0" }); } MessageManage mess = new MessageManage(); mess.AddMessage(xtxx, xtxxjss); }