public static void RebuildBatchNo() { //string xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "WantongPay.xml"; string batchNo = SysConfigHelper.readerNode("WtBatchNo"); string newBatchNo = (Convert.ToInt32(batchNo) + 1).ToString(); SysConfigHelper.writerNode("WtBatchNo", newBatchNo); }
/// <summary> /// 获取支付流水号 /// </summary> /// <returns></returns> public static string GetOrderNo() { //string xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "WantongPay.xml"; string orderNo = SysConfigHelper.readerNode("WtOrderNo"); string newOrderNo = (Convert.ToInt32(orderNo) + 1).ToString(); SysConfigHelper.writerNode("WtOrderNo", newOrderNo); return(orderNo); }
/// <summary> /// 获取命令 /// </summary> /// <returns></returns> public static SystemOrder getSystemOrder() { Dictionary <String, String> parameters = new Dictionary <String, String>(); parameters.Add("t_id", ConfigurationManager.AppSettings["MechineNo"]); parameters.Add("id", id); string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("systemOrder"), parameters, null); log.Write("指令:" + jsonText); //反序列化JSON字符串,将JSON字符串转换成LIST列表 SystemOrder systemOrder = JsonConvert.DeserializeObject <SystemOrder>(jsonText); id = systemOrder.data.id; if (SysBLL.IsTest.Equals("正式")) // GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id"); { ComputerBLL.WriteOrderID(id); } else { SysConfigHelper.writerNode("sysOrderId", id); } return(systemOrder); }
/// <summary> /// 执行结果通知 /// </summary> /// <param name="info"></param> /// <returns></returns> public static bool SaveResualt(string info) { try { Dictionary <String, String> parameters = new Dictionary <String, String>(); parameters.Add("log.t_id", ConfigurationManager.AppSettings["MechineNo"]); parameters.Add("log.cmd_id", id); parameters.Add("log.cmd_result", info); string jsonText = HttpHelper.getHttp(SysConfigHelper.readerNode("systemOrderSaveResualt"), parameters, null); if (SysBLL.IsTest.Equals("正式")) // GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id"); { ComputerBLL.WriteOrderID(id); } else { SysConfigHelper.writerNode("sysOrderId", id); } //反序列化JSON字符串,将JSON字符串转换成LIST列表 return(true); }catch (Exception ex) { log.Write("error:SystemOrderAccess:SaveResualt(string info):" + ex.Message); } return(false); }
private void load() { try { ConfigSysParam.gifBusiness = GifBusiness.no; ComputerBLL.KillApplication("TabTip"); //支付方式默认为电子现金 PayStaticParam.payType = -1; //设置页面终端号 this.lblMechineNo.Text = "NO:" + ConfigurationManager.AppSettings["MechineNo"]; SysBLL.PasswordErrorInfo = "重要提示"; //软件版本号 this.lblVersion.Text = SysConfigHelper.readerNode("currentVersion"); loadThread = new Thread(delegate() { //如果有卡则退卡 MachCardBLL.backCard(); //禁止用户插卡 MachCardBLL.CancelWaitCard(); }); loadThread.Start(); SysBLL.IsOpenIndexForm = true; //初始化公积金查询参数 SysBLL.customerParam = null; SysBLL.customerParam = new wtPayModel.PublicFundModel.CustomerParam(); SysBLL.socialSecurityParam = null; SysBLL.socialSecurityParam = new wtPayModel.SocialSecurityModel.SocialSecurityParam(); BeiAnGGCardBLL.killRd(); Write(@"D:\appliaction\IsRestart.txt", "1"); Console.WriteLine(Read(@"D:\appliaction\IsRestart.txt")); if (SysBLL.isGcWindow == false) { gcWindowThread = new Thread(delegate() { try { while (true) { try { int sleepNum = Convert.ToInt32(SysConfigHelper.readerNode("Gcmp4PlayIntervalName")); Thread.Sleep(sleepNum); if (!System.IO.File.Exists("D:/payMedia/mp4/1.mp4")) { ComputerBLL.KillApplication("GCMp4"); continue; } System.Diagnostics.Process p = new System.Diagnostics.Process(); if (("0".Equals(SysConfigHelper.readerNode("isStopGCMp4"))) || ("2".Equals(SysConfigHelper.readerNode("isStopGCMp4")))) { p.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory + "GCMp4.exe"; p.Start(); SysConfigHelper.writerNode("isMainClose", "1"); } while (true) { System.Diagnostics.Process[] proList = System.Diagnostics.Process.GetProcesses(".");//获得本机的进程 bool iss = false; foreach (System.Diagnostics.Process pro in proList) { if ("GCMp4".Contains(pro.ProcessName)) { iss = true; break; } } if ("1".Equals(SysConfigHelper.readerNode("isStopGCMp4"))) { ComputerBLL.KillApplication("GCMp4"); } if (iss == false) { break; } Thread.Sleep(1000 * 5); } } catch (ThreadAbortException ae) { log.Write("error:1loadGCMp4:" + ae.Message); return; } catch (Exception ex) { log.Write("error:视屏循环播放:" + ex.Message + ex.InnerException); continue; } } } catch (ThreadAbortException ae) { log.Write("error:2loadGCMp4:" + ae.Message); return; } catch (Exception ex) { log.Write("error:2loadGCMp4:" + ex.Message); } }); gcWindowThread.Start(); } //隐藏Windows任务栏 SysBLL.ShowWindow(SysBLL.FindWindow("Shell_TrayWnd", null), SysBLL.SW_HIDE); } catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); } catch (Exception ex) { log.Write("error:首页load事件异常:" + ex.Message); } }
private void update() { try { GCResourceAccess gcaccess = new GCResourceAccess(); FindIsUpdateAdvInfo findIsUpdateAdvInfo = null; FindDownAdvInfo findDownAdvInfo = new FindDownAdvInfo(); WebClient myclient = new WebClient(); while (true) { try { //Thread.Sleep(1); Thread.Sleep((1000 * 60) * 10); // 是否更新广告 findIsUpdateAdvInfo = null; //是否更新广告 findIsUpdateAdvInfo = gcaccess.findIsUpdateAdv(); if (!"0".Equals(findIsUpdateAdvInfo.code)) { continue; } log.Write("----开始更新广告"); // 广告详情获取 GCResourceAccess.adv_id = findIsUpdateAdvInfo.data.id; //将id记录到本地 if (SysBLL.IsTest.Equals("正式")) // GCResourceAccess.adv_id = SysConfigHelper.readerNode("GcAdv_id"); { GcManage.WriteGCID(findIsUpdateAdvInfo.data.id); } else { SysConfigHelper.writerNode("GcAdv_id", findIsUpdateAdvInfo.data.id); } string m_id = ""; string m_name = ""; for (int i = 1; i <= 5; i++) { findDownAdvInfo = null; if (i == 3) { } if (i == 2) { for (int j = 0; j < GcManage.paths.Length; j++) { findDownAdvInfo = gcaccess.findDownAdv(i.ToString(), GcManage.paths[j]); if (findDownAdvInfo == null) { continue; } if ("0".Equals(findDownAdvInfo.code)) { m_id = findDownAdvInfo.data.m_id; m_name = findDownAdvInfo.data.m_name; //下载资源 ResourceDownload(findDownAdvInfo.data.data, i, myclient, GcManage.paths[j]); } } continue; } else { findDownAdvInfo = gcaccess.findDownAdv(i.ToString(), "0"); if (findDownAdvInfo == null) { continue; } if ("0".Equals(findDownAdvInfo.code)) { m_id = findDownAdvInfo.data.m_id; m_name = findDownAdvInfo.data.m_name; //下载资源 ResourceDownload(findDownAdvInfo.data.data, i, myclient, ""); } } } // 更新结果通知参数 gcaccess.recordAdvUpdateLog(m_id, m_name); while (true) { if (!SysBLL.IsOpenIndexForm) { continue; } if ("1".Equals(GcManage.ReadGCStateID())) { log.Write("广告更新完毕,执行重启"); //ComputerBLL.Restart(); break; } break; } } catch (ThreadAbortException e) { log.Write("error:PictureChangeUserControl:01:update:" + e.Message + e.InnerException); continue; } catch (Exception e) { log.Write("error:PictureChangeUserControl:02:update:" + e.Message + e.InnerException); continue; } } } catch (ThreadAbortException e) { log.Write("error:PictureChangeUserControl:03:update:" + e.Message + e.InnerException); } catch (Exception e) { log.Write("error:PictureChangeUserControl:04:update:" + e.Message + e.InnerException); } }
/// <summary> /// 下载资源 /// </summary> /// <param name="pathId"></param> /// <param name="type"></param> /// <param name="myclient"></param> public void ResourceDownload(string pathId, int type, WebClient myclient, string leftImgPath) { try { string mainPath = System.AppDomain.CurrentDomain.BaseDirectory; if (type == 1) { //timer.Stop(); //List<PicClass> pic = new List<PicClass>(); //pic.Add(new PicClass() { Image = string.Format(System.AppDomain.CurrentDomain.BaseDirectory + "/image/GCImage/temp/temp.png"), Site = 0.ToString() }); //listBoxPic.Dispatcher.Invoke(new setListbBoxNullDelegate(setListbBoxNull), listBoxPic, pic); //listBoxPic.Dispatcher.Invoke(new setListbBoxSelectDelegate(setListBoxSelect), listBoxPic, 0); Thread.Sleep(1000 * 3); SysBLL.deleteDirFile(System.AppDomain.CurrentDomain.BaseDirectory + "/image/GCImage/index"); //1、缴费系统主界面轮播图 string[] imgId = pathId.Split(','); log.Write("----更新首页轮播图:" + pathId); int count = GcManage.getImgMaxPath(GcManage.mainImgPath); count++; System.IO.Directory.CreateDirectory(GcManage.mainImgPath + "//" + count); for (int j = 0; j < imgId.Length; j++) { string path = SysConfigHelper.readerNode("downAdvName") + "?id=" + imgId[j]; myclient.DownloadFile(path, GcManage.mainImgPath + "//" + count + "//" + (j + 1) + ".png"); } IniPic(); GcManage.WriteGCStateID("1"); //IniPic(); //listBoxPic.Dispatcher.Invoke(new setListbBoxSelectDelegate(setListBoxSelect), listBoxPic, 0); //timer.Start(); } if (type == 2) { SysBLL.deleteDirFile(System.AppDomain.CurrentDomain.BaseDirectory + "/image/GCImage/leftImg/" + leftImgPath); log.Write("----更新左侧轮播图:" + pathId); int count = GcManage.getImgMaxPath(GcManage.leftImgPath + "//" + leftImgPath); count++; System.IO.Directory.CreateDirectory(GcManage.leftImgPath + "//" + leftImgPath + "//" + count); //2、缴费系统左侧轮播图 string[] imgId = pathId.Split(','); for (int j = 0; j < imgId.Length; j++) { myclient.DownloadFile(SysConfigHelper.readerNode("downAdvName") + "?id=" + imgId[j], GcManage.leftImgPath + "//" + leftImgPath + "//" + count + "//" + (j + 1) + ".png"); } GcManage.WriteGCStateID("1"); } if (type == 3) { SysConfigHelper.writerNode("mainTopInfo", pathId); } if (type == 4) { log.Write("----更新视屏广告:" + pathId); ComputerBLL.KillApplication("GCMp4"); Thread.Sleep(1000); SysBLL.deleteDirFile(GcManage.mp4Path); //4.视频广告 string[] imgId = pathId.Split(','); for (int j = 0; j < imgId.Length; j++) { myclient.DownloadFile(SysConfigHelper.readerNode("downAdvName") + "?id=" + imgId[j], System.AppDomain.CurrentDomain.BaseDirectory + "/mp4" + "//" + (j + 1) + ".mp4"); } GcManage.WriteGCStateID("1"); ComputerBLL.KillApplication("GCMp4"); GcManage.GcMp4FileIsExists(); ComputerBLL.StartApp(System.AppDomain.CurrentDomain.BaseDirectory + "GCMp4.exe"); } } catch (IOException e) { log.Write("error:PictureChangeUserControl:ResourceDownload:" + e.Message + e.InnerException); } catch (Exception e) { log.Write("error:PictureChangeUserControl:ResourceDownload:" + e.Message + e.InnerException); } }