static WCFServer() { string inii = AppDomain.CurrentDomain.BaseDirectory + "webconfig.ini"; INIClass ini = new INIClass(inii); var wcf = ini.IniReadValue("服务平台地址", "ServiceAdd"); var met = ini.IniReadValue("服务平台主方法", "Method"); WCFaddr = wcf.ToString();//ini.IniReadValue(""); //"http://localhost/wacf//MediInfoHis.svc";//ConfigurationManager.AppSettings["WCFaddr"].ToString(); Method = met.ToString(); //"RunService";//ConfigurationManager.AppSettings["Method"].ToString(); //if (MethodMappings == null) //{ //MethodMappings = (Dictionary<string, string>)ConfigurationManager.GetSection("MethodMapping"); MethodMappings.Add("HIS1.Biz.RENYUANXX", "RENYUANXX_IN"); MethodMappings.Add("HIS1.Biz.RENYUANZC", "RENYUANZC_IN"); MethodMappings.Add("HIS1.Biz.GUAHAOKSXX", "GUAHAOKSXX_IN"); MethodMappings.Add("HIS1.Biz.GUAHAOYSXX", "GUAHAOYSXX_IN"); MethodMappings.Add("HIS1.Biz.GUAHAOCL", "GUAHAOCL_IN"); MethodMappings.Add("HIS1.Biz.MENZHENYJS", "MENZHENYJS_IN"); MethodMappings.Add("HIS1.Biz.GUAHAOTH", "GUAHAOTH_IN"); MethodMappings.Add("HIS1.Biz.MENZHENCFJL", "MENZHENCFJL_IN"); MethodMappings.Add("HIS1.Biz.MENZHENFYMX", "MENZHENFYMX_IN"); // } }
private void save_data() { INIClass ini_class = new INIClass("D:\\yinuo.ini"); ini_class.IniWriteValue("KaiPiao", "HeJi", total_value.ToString()); ini_class.IniWriteValue("KaiPiao", "ShuiEr", _lbl_total_shuier.Text); }
static private bool init() { /*创建webService对象*/ javaEncrypt = new LinkWS.javaEncrypt.serviceEncryptService(); webNCDC = new LinkWS.WebR_NCDC.SYConnWebService(); INIClass inicls = new INIClass(Service_NCSB.MyConfigFile); if (!inicls.ExistINIFile()) { return(false); } string WSip = inicls.IniReadValue("NCSB", "WS_IP"); string WSport = inicls.IniReadValue("NCSB", "WS_PORT"); string WStimeout = inicls.IniReadValue("NCSB", "WS_TIMEOUT"); if (WSip == "" || WSport == "") { return(false); } if (WStimeout == "") { WStimeout = "200000"; } webNCDC.Timeout = int.Parse(WStimeout); webNCDC.Url = "http://" + WSip + ":" + WSport + "/ysptsz/services/szWebService?wsdl"; return(true); }
static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (Common.IsAppRunning("LinkerMediaItemInterface")) { MessageBox.Show("程序正在运行,请先退出!", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } INIClass ini = new INIClass(Application.StartupPath + "\\config.ini"); Globals.X1ConnectionStr = ini.IniReadValue("conn", "x1"); Globals.DefaultDir = ini.IniReadValue("dir", "path"); Globals.Zone = int.Parse(ini.IniReadValue("zone", "zone")); Globals.RequestInterval = int.Parse(ini.IniReadValue("Interval", "RequestInterval")); Globals.LinkerMedia_DBID = ini.IniReadValue("LinkerMedia", "DBID"); Globals.LinkerMedia_UserName = ini.IniReadValue("LinkerMedia", "UserName"); Globals.LinkerMedia_UserID = ini.IniReadValue("LinkerMedia", "UserID"); Globals.BatchImport = int.Parse(ini.IniReadValue("ImportType", "BatchImport")); Application.Run(new FrmMain()); } catch (Exception ex) { LogService.WriteErr(ex.Message); } }
private void LoadSettings() { // Check if ini file exists if (File.Exists(iniFilePath)) { try { var iniFile = new INIClass(iniFilePath); radioButtonOverwriteOriginal.Checked = iniFile.ReadValue("", "OverwriteOriginal") == "True"; radioButtonUseDirectory.Checked = iniFile.ReadValue("", "OverwriteOriginal") != "True"; textBoxOutputDirectory.Text = iniFile.ReadValue("", "OutputDirectory"); numUpDownNoOfPasses.Value = decimal.Parse(iniFile.ReadValue("", "NoOfPasses")); numUpDownJpegQuality.Value = decimal.Parse(iniFile.ReadValue("", "JpegQuality")); checkBoxUseHighMemory.Checked = iniFile.ReadValue("", "UseHighMemory") == "True"; checkBoxRemoveImgMetaData.Checked = iniFile.ReadValue("", "RemoveImgMetaData") == "True"; } catch { ResetDefaultSettings(); } } // If not, then the application may be started for the first time else { ResetDefaultSettings(); SaveSettings(); } }
public void Init() { dbsqlite = new SQLiteClass(); DBPath = INIClass.readIniInfo(GlobalVar.INI_systemSect, GlobalVar.INI_sysDBFileName); if (DBPath.Trim() == "") { DBPath = "sysdb.db"; INIClass.wirteIniInfo(GlobalVar.INI_systemSect, GlobalVar.INI_sysLogFileName, DBPath); } FileInfo finfo = new FileInfo(DBPath); if (finfo.Exists) { dbsqlite.openDB(DBPath); } else { dbsqlite.createDB(DBPath); SQLiteTable tb = new SQLiteTable(GlobalVar.TBN_Global); tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_ID, true)); tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_Category, ColType.Text)); tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_Key, ColType.Text)); tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_Value, ColType.Text)); dbsqlite.createTable(tb); tb = new SQLiteTable(GlobalVar.TBN_Folder); tb.Columns.Add(new SQLiteColumn(GlobalVar.FCOL_FID, true)); tb.Columns.Add(new SQLiteColumn(GlobalVar.FCOL_Path, ColType.Text)); tb.Columns.Add(new SQLiteColumn(GlobalVar.FCOL_Recursive, ColType.Integer)); dbsqlite.createTable(tb); } }
/// <summary> /// 更新配置文件 /// </summary> private void UpdateConfig() { INIClass ini = new INIClass("D://train//train.ini"); ini.IniWriteValue("TermInfo", "deadline", this.txtDeadline.Text); ini.IniWriteValue("TermInfo", "inspectionInterval", this.txtInspectionInterval.Text); ini.IniWriteValue("TermInfo", "localListenPort", this.txtLocalListenPort.Text); ini.IniWriteValue("TermInfo", "localVedioPwd", this.txtUserName.Text); ini.IniWriteValue("TermInfo", "serialNum", this.txtSerialNum.Text); ini.IniWriteValue("TermInfo", "train", this.txtTrain.Text); ini.IniWriteValue("TermInfo", "localVedioUserName", this.txtUserName.Text); ini.IniWriteValue("TermInfo", "localVedioIp", this.txtVcrIP.Text); ini.IniWriteValue("TermInfo", "url", this.txtWebServiceUrl.Text); ini.IniWriteValue("TermInfo", "localVedioPort", this.txtVcrTcpPort.Text); ini.IniWriteValue("TermInfo", "connStringKey", this.txtConStr.Text); ini.IniWriteValue("TermInfo", "comPort", this.cmbComPort.Text); ini.IniWriteValue("TermInfo", "WaterFormula1 ", this.WaterFormula1_textBox.Text); ini.IniWriteValue("TermInfo", "WaterFormula2 ", this.WaterFormula2_textBox.Text); ini.IniWriteValue("TermInfo", "WaterFormula3 ", this.WaterFormula3_textBox.Text); ini.IniWriteValue("TermInfo", "OilFormula1", this.OilFormula1_textBox.Text); ini.IniWriteValue("TermInfo", "OilFormula2", this.OilFormula2_textBox.Text); ini.IniWriteValue("TermInfo", "OilFormula3", this.OilFormula3_textBox.Text); ini.IniWriteValue("TermInfo", "waterAlarm1Value", this.waterAlarm1textBox.Text); }
static private bool init() { webService = new LinkWS.WebR_NCSB.yhjypt(); INIClass inicls = new INIClass(Service_NCSB.MyConfigFile); if (!inicls.ExistINIFile()) { return(false); } string WSip = inicls.IniReadValue("NCSB", "WS_IP"); string WSport = inicls.IniReadValue("NCSB", "WS_PORT"); string WStimeout = inicls.IniReadValue("NCSB", "WS_TIMEOUT"); if (WSip == "" || WSport == "") { return(false); } if (WStimeout == "") { WStimeout = "200000"; } webService.Timeout = int.Parse(WStimeout); webService.Url = "http://" + WSip + ":" + WSport + "/yhjypt/yhjypt.asmx"; return(true); }
public Options() { string FileFath = System.IO.Directory.GetCurrentDirectory() + "\\INIConfig\\OptionsSave.ini"; iniClass = new INIClass(FileFath); InitializeComponent(); }
/// <summary> /// 复制文件夹下面的图片 /// </summary> /// <param name="path"></param> /// <param name="desPath"></param> private async Task <bool> PictureCopy(string path, string DesPath, string serialnumber, string VL_V_PathNO) { bool CopyStaeB = await Task.Run(() => { if (!Directory.Exists(path)) { //到FTP下载 string FileFath = Directory.GetCurrentDirectory() + "\\INIConfig\\OptionsSave.ini"; INIClass iniClass = new INIClass(FileFath); string URI = VL_V_PathNO; //iniClass.IniReadValue("PACSPicutrePath", "URI"); string USERID = iniClass.IniReadValue("PACSPicutrePath", "USERID"); string PASSWORD = iniClass.IniReadValue("PACSPicutrePath", "PASSWORD"); //string ftpPath = path.Replace("Z:\\", "").Replace(@"\", "/"); FtpHelper.fv_SetLink(URI, USERID, PASSWORD); //判断FTP上是否存在目录 //if (!FtpHelper.ftpIsExistsFile(ftpPath, URI)) //{ return false; } //下载文件 fV_FtpCopyFile(URI, serialnumber, DesPath); } else { //服务器下载 int i = 0; ProgressVa = 0; Dictionary <string, string> FileList = GetFile(path); FileListCount = FileList.Count; sourcePath = path; desPath = DesPath; foreach (var item in FileList) { Copying = item.Value; try { if (!Directory.Exists(desPath)) { Directory.CreateDirectory(desPath); } File.Copy(item.Key, desPath + item.Value, true); } catch (Exception ex) { i++; if (i > 5) { return(false); } } ProgressVa++; } } return(true); }); return(CopyStaeB); }
public string GetGasCardReaderRes(int res) { string strRes = ""; INIClass gasCardReaderIni = new INIClass(System.AppDomain.CurrentDomain.BaseDirectory + "GasCardReaderRes.ini"); strRes = gasCardReaderIni.IniReadValue("GasCardReader", res.ToString()); return(strRes); }
public bool ReadiniFile() { INIClass ini = new INIClass(@Application.StartupPath + "\\config.ini"); if (!ini.ExistINIFile()) { MessageBox.Show("not Exist INIFile!"); return(false); } GlobalVar.Port = Int32.Parse(ini.IniReadValue("TCP", "port")); return(true); }
public void Init(string dbPath) { dbsqlite.openDB(dbPath); m_Index.INDEX_DIR = INIClass.readIniInfo(GlobalVar.INI_indexSect, GlobalVar.INI_indexFolder); DataTable dt = dbsqlite.selectAll(GlobalVar.TBN_Folder); int i = 0; for (i = 0; i < dt.Rows.Count; i++) { m_Index.FolderDic[dt.Rows[i][GlobalVar.FCOL_Path].ToString()] = Convert.ToInt32(dt.Rows[i][GlobalVar.FCOL_Recursive]) == 0 ? false : true; } DocProcess docProc = DocProcess.GetInstance(); docProc.Register(new WordProc()); docProc.Register(new PdfProc()); docProc.Register(new TxtProc()); }
public UpdatePrecent(ServerInfor Infor) : this() { this.infor = Infor; this.ini = Infor.INI; cb_Start.Checked = this.infor._QuckLoad; this.App = this.infor.Application; this.remark = Infor.Remark; this.version = Infor.Version; if (Infor.UpdateName != "") { lbl_Title.Text = this.Text = Infor.UpdateName; } if (Infor.OtherInfo != "") { lbl_Other.Text = Infor.OtherInfo; } }
public NetOpt() { ClientInGroup = new Hashtable(); //listFileWaitRecv = new List<FileWaitObjcet>(); dicFileWait = new Dictionary <string, FileWaitObjcet>(); fileWaitMutex = new Mutex(false); //listFileRequest = new List<FileRequestObjcet>(); try { netc = new NetClass(); IPAddress localServiceIP = IPAddress.Parse(INIClass.readIniInfo(GlobalVar.INI_localServiceSect, GlobalVar.INI_localServiceIP)); int portLocalService; if (!Int32.TryParse(INIClass.readIniInfo(GlobalVar.INI_localServiceSect, GlobalVar.INI_localServicePort), out portLocalService)) { return; } netc.LocalServiceIEP = new IPEndPoint(localServiceIP, portLocalService); int portLocalFile; if (!Int32.TryParse(INIClass.readIniInfo(GlobalVar.INI_localServiceSect, GlobalVar.INI_localFileRecvPort), out portLocalFile)) { return; } netc.LocalFileRecvIEP = new IPEndPoint(localServiceIP, portLocalFile); IPAddress multiCastGroupIP = IPAddress.Parse(INIClass.readIniInfo(GlobalVar.INI_multiCastSect, GlobalVar.INI_multiCastGroupIP)); int portMultiCastGroup; if (!Int32.TryParse(INIClass.readIniInfo(GlobalVar.INI_multiCastSect, GlobalVar.INI_multiCastPort), out portMultiCastGroup)) { return; } netc.MultiCastGroupIEP = new IPEndPoint(multiCastGroupIP, portMultiCastGroup); recvTmpPath = INIClass.readIniInfo(GlobalVar.INI_systemSect, GlobalVar.INI_sysRecvTmpPath); netc.RecvMultiCast += RecvMultiCastCallBack; netc.RecvTCPString += RecvTCPStringCallBack; netc.RecvFile += FileRecvCallBack; netc.Start(); } catch (Exception e) { Debug.WriteLine(e.Message); } }
static public bool getConfigInfo() { try { INIClass inicls = new INIClass(Service_NCSB.MyConfigFile); if (!inicls.ExistINIFile()) { Service_NCSB.WriteLog("inicls错误"); return(false); } cfg_NCSB = new Cfg(); cfg_NCSB.WSip = inicls.IniReadValue("NCSB", "WS_IP"); cfg_NCSB.WSport = inicls.IniReadValue("NCSB", "WS_PORT"); cfg_NCSB.WStimeout = inicls.IniReadValue("NCSB", "WS_TIMEOUT"); cfg_NCSB.ftp_ip = inicls.IniReadValue("NCSB", "FTP_IP"); cfg_NCSB.ftp_user = inicls.IniReadValue("NCSB", "FTP_USER"); cfg_NCSB.ftp_passwd = inicls.IniReadValue("NCSB", "FTP_PASSWD"); cfg_NCSB.ftp_localpath = inicls.IniReadValue("NCSB", "FTP_LOCALPATH"); if (cfg_NCSB.ftp_ip == "" || cfg_NCSB.ftp_user == "" || cfg_NCSB.ftp_passwd == "") { Service_NCSB.WriteLog("ftp配置错误"); return(false); } if (cfg_NCSB.WSip == "" || cfg_NCSB.WSport == "") { Service_NCSB.WriteLog("WS配置错误"); return(false); } if (cfg_NCSB.WStimeout == "") { cfg_NCSB.WStimeout = "200000"; } } catch (Exception err) { Service_NCSB.WriteLog("getConfigInfo错误" + err.Message); return(false); } return(true); }
private void SaveSettings() { try { string iniFileDirectory = Path.GetDirectoryName(iniFilePath); if (!Directory.Exists(iniFileDirectory)) { Directory.CreateDirectory(iniFileDirectory); } var iniFile = new INIClass(iniFilePath); iniFile.WriteValue("", "OverwriteOriginal", radioButtonOverwriteOriginal.Checked.ToString()); iniFile.WriteValue("", "OverwriteOriginal", (!radioButtonUseDirectory.Checked).ToString()); iniFile.WriteValue("", "OutputDirectory", textBoxOutputDirectory.Text); iniFile.WriteValue("", "NoOfPasses", numUpDownNoOfPasses.Value.ToString()); iniFile.WriteValue("", "JpegQuality", numUpDownJpegQuality.Value.ToString()); iniFile.WriteValue("", "UseHighMemory", checkBoxUseHighMemory.Checked.ToString()); iniFile.WriteValue("", "RemoveImgMetaData", checkBoxRemoveImgMetaData.Checked.ToString()); } catch (Exception ex) { toolStripBottomStatus.Text = "ERROR: " + ex.Message; } }
protected override void OnEnter() { try { _isClick = false; //GetElementById("AdImage").SetAttribute("src", mPictures[m_currpicture]); //GetElementById("PublicFee").Click += new HtmlElementEventHandler(PublicFee_Click); //GetElementById("Gas").Click += new HtmlElementEventHandler(PublicFee_Click); //GetElementById("Water").Click += new HtmlElementEventHandler(PublicFee_Click); //GetElementById("TV").Click += new HtmlElementEventHandler(PublicFee_Click); //GetElementById("Power").Click += new HtmlElementEventHandler(Power_Click); //GetElementById("Mobile").Click += new HtmlElementEventHandler(Mobile_Click); //GetElementById("CreditCard").Click += new HtmlElementEventHandler(CreditCard_Click); //GetElementById("TrafficPolice").Click += new HtmlElementEventHandler(TrafficPolice_Click); //GetElementById("CarTicket").Click += CarTicket_Click; //SetManageEntryInfo("ManageEntry"); IsConDisplay(false); Log.Info("Version : " + Assembly.GetExecutingAssembly().GetName().Version.ToString()); INIClass gasCardReaderIni = new INIClass(AppDomain.CurrentDomain.BaseDirectory + "Versionfile.ini"); gasCardReaderIni.IniWriteValue("Version", "VersionNo", Assembly.GetExecutingAssembly().GetName().Version.ToString()); GetElementById("btnPay").Click += new HtmlElementEventHandler(btnPay_Click); //SetElement(MenuEnable.CreditCard, "CreditCard"); //SetElement(MenuEnable.TV, "TV"); //SetElement(MenuEnable.Gas, "Gas"); //SetElement(MenuEnable.Water, "Water"); //SetElement(MenuEnable.Power, "Power"); //SetElement(MenuEnable.Mobile, "Mobile"); //SetElement(MenuEnable.TrafficPolice, "TrafficPolice"); //SetElement(MenuEnable.CarTicket, "CarTicket"); } catch (Exception ex) { Log.Error("[" + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "][" + System.Reflection.MethodBase.GetCurrentMethod().Name + "] err" + ex); } }
static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (Common.IsAppRunning("Air5DurationTool")) { MessageBox.Show("程序正在运行,请先退出!", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } INIClass ini = new INIClass(Application.StartupPath + "\\config.ini"); Globals.Air5ConnectionStr = ini.IniReadValue("conn", "Air5"); Globals.Zone = int.Parse(ini.IniReadValue("zone", "zone")); Application.Run(new FrmMain()); } catch (Exception ex) { LogService.WriteErr(ex.Message); } }
public bool SetIndexDir(string path) { if (path.Trim() == "") { MessageBox.Show("请输入索引存储路径", "提示"); return(false); } DirectoryInfo dir = new DirectoryInfo(path.Trim()); if (dir.Exists) { m_Index.INDEX_DIR = dir.FullName; INIClass.wirteIniInfo(GlobalVar.INI_indexSect, GlobalVar.INI_indexFolder, m_Index.INDEX_DIR); MessageBox.Show("设置索引存储路径成功", "提示"); return(true); } else { MessageBox.Show("设置索引存储路径失败:路径不存在", "错误"); return(false); } }
protected override void OnEnter() { try { Esam.SetWorkmode(Esam.WorkMode.Default); InvokeScript("gettime"); SetManageEntryInfo("ManageEntry"); setBtnName("btnReturn", "btnHome"); Log.Info("Version : " + Assembly.GetExecutingAssembly().GetName().Version.ToString()); INIClass gasCardReaderIni = new INIClass(System.AppDomain.CurrentDomain.BaseDirectory + "Versionfile.ini"); gasCardReaderIni.IniWriteValue("Version", "VersionNo", Assembly.GetExecutingAssembly().GetName().Version.ToString()); //ConfigFile.WriteConfig("AppData", "Version", Assembly.GetExecutingAssembly().GetName().Version.ToString()); //GetElementById("ComComponnents").Style = "display: none"; setComponnents("ComComponnents", false, false, false); GetElementById("btnBuy").Click += new HtmlElementEventHandler(Buy_Click); GetElementById("btnQuery").Click += new HtmlElementEventHandler(Query_Click); } catch (Exception ex) { Log.Error("[" + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name + "][" + System.Reflection.MethodBase.GetCurrentMethod().Name + "] err" + ex); } }
private void doItem(DataRow item) { INIClass ini = new INIClass(Application.StartupPath + "\\config.ini"); string air5Str = ini.IniReadValue("conn", "air5_" + item["ChannelID"].ToString()); if (air5Str.Trim().Length == 0) { return; } using (SqlConnection conn = new SqlConnection(air5Str)) { string sql = "select (select top 1 CategoryName from Categories where CategoryID=items.Artist1 " + "or CategoryID=items.Artist3) as CreatorName,(select top 1 CategoryName from Categories " + "inner join Stacks on Categories.CategoryID=Stacks.StackID where Stacks.ItemID=items.ItemID) as ClassName," + "(select top 1 StationID from Stations where StationNumber = " + item["ChannelID"].ToString() + " ) as StationID," + "(select top 1 StationName from Stations where StationNumber = " + item["ChannelID"].ToString() + " ) as StationName," + item["ChannelID"].ToString() + "as ChannelID," + " * from items inner join StorageZone on items.SoundStorageID = StorageZone.StorageID " + "and StorageZone.ZoneID=" + Globals.Zone + " where ItemID='" + item["ProgramID"] + "'"; using (SqlDataAdapter sd = new SqlDataAdapter(sql, conn)) { DataTable dt = new DataTable(); sd.Fill(dt); foreach (DataRow row in dt.Rows) { Application.DoEvents(); string errorInfo = ""; //TreeListNode node = this.treeList_Export.AppendNode(new object[] { row["Title"], "获取到任务", DateTime.Now.ToString("yyy-MM-dd HH:mm:ss"), "" }, null, null); AppendMessageLine("任务获取成功,名称:" + row["Title"] + " 频率:" + row["StationName"]); LogService.Write("任务获取成功,名称:" + row["Title"] + " 频率:" + row["StationName"]); string source = ""; if (this.downLoadProgram(row, out source, out errorInfo)) { Application.DoEvents(); errorInfo = ""; //node.SetValue("treeListColumn2", "音频下载完成"); AppendMessageLine("音频下载成功!"); LogService.Write("音频下载成功!"); if (this.SaveXML(row, true, source, out errorInfo)) { //node.SetValue("treeListColumn2", "导出成功"); AppendMessageLine("导出成功"); LogService.Write("导出成功"); //node.SetValue("treeListColumn6", DateTime.Now.ToString("yyy-MM-dd HH:mm:ss")); if (this.deleteTask(item["ProgramID"].ToString())) { AppendMessageLine("删除任务成功\n\t"); LogService.Write("删除任务成功\n\t"); } else { AppendMessageLine("删除任务失败,ProgramID:" + row["ProgramID"].ToString() + "\n\t"); LogService.Write("删除任务失败,ProgramID:" + row["ProgramID"].ToString() + "\n\t"); } } else { //node.SetValue("treeListColumn2", "导出失败"); AppendMessageLine("导出失败,错误信息:" + errorInfo + "\n\t"); LogService.Write("导出失败,错误信息:" + errorInfo + "\n\t"); this.UpdateTaskStatus(item["ProgramID"].ToString(), -1); } } else { //node.SetValue("treeListColumn2", "音频下载失败"); AppendMessageLine("音频下载失败,错误信息:" + errorInfo + "\n\t"); LogService.Write("音频下载失败,错误信息:" + errorInfo + "\n\t"); this.UpdateTaskStatus(item["ProgramID"].ToString(), -1); } } } } }
private void BatchTask() { try { if (txtInfo.Text.Length > txtInfo.MaxLength) { txtInfo.Text = ""; } Application.DoEvents(); DataTable dtSys = GetSys(); if (dtSys == null || dtSys.Rows.Count <= 0) { AppendMessageLine("未获取到播出系统信息!"); LogService.Write("未获取到播出系统信息!"); return; } INIClass ini = new INIClass(Application.StartupPath + "\\config.ini"); foreach (DataRow sysRow in dtSys.Rows) { string FileDate = "1900-01-01 00:00:00.000"; string LastFileDate = "1900-01-01 00:00:00.000"; try { string air5Str = ini.IniReadValue("conn", sysRow["Keys"].ToString()); if (air5Str.Trim().Length == 0) { continue; } using (SqlConnection conn = new SqlConnection(air5Str)) { string strSysWorkGroupID = " select g.WorkgroupID,g.WorkgroupName,s.StationNumber from Workgroups g,Workgroup2Stations w2s,Stations s where g.WorkgroupID=w2s.WorkgroupID and s.StationID=w2s.StationID and w2s.InStations=1 and s.StationName='" + sysRow["Name"].ToString() + "' "; DataTable SysWorkGroupIDDT = new DataTable(); using (SqlDataAdapter sd = new SqlDataAdapter(strSysWorkGroupID, conn)) { sd.Fill(SysWorkGroupIDDT); } if (SysWorkGroupIDDT.Rows.Count <= 0) { continue; } FileDate = ini.IniReadValue("FileDate", sysRow["Keys"].ToString()); string strSQL = "select ItemID,FileDate from Items p where p.AudioExists=1 and p.WorkgroupID='" + SysWorkGroupIDDT.Rows[0]["WorkgroupID"].ToString() + "' and p.Released=1 and p.FileDate>'" + FileDate + "' and p.Deleted=0 and (p.CategoryType=5 OR p.CategoryType=11) order by FileDate"; DataTable ItemsDT = new DataTable(); using (SqlDataAdapter sd = new SqlDataAdapter(strSQL, conn)) { sd.Fill(ItemsDT); } if (ItemsDT.Rows.Count > 0) { AppendMessageLine("频率:《" + sysRow["Name"].ToString() + "》 共有" + ItemsDT.Rows.Count + "条数据需要导出(FileDate:" + FileDate + ")"); LogService.Write("频率:《" + sysRow["Name"].ToString() + "》 共有" + ItemsDT.Rows.Count + "条数据需要导出(FileDate:" + FileDate + ")"); foreach (DataRow item in ItemsDT.Rows) { try { LastFileDate = item["FileDate"].ToString(); if (Globals.myExportTasksManager.IsExistExportTask(item["ItemID"].ToString(), sysRow["Keys"].ToString())) { AppendMessageLine("任务已存在, ItemID:" + item["ItemID"].ToString() + " 频率:" + sysRow["Keys"].ToString()); LogService.Write("任务已存在, ItemID:" + item["ItemID"].ToString() + " 频率:" + sysRow["Keys"].ToString()); ini.IniWriteValue("FileDate", sysRow["Keys"].ToString(), LastFileDate); } else { doItem(sysRow["Keys"].ToString(), SysWorkGroupIDDT.Rows[0]["StationNumber"].ToString(), item["ItemID"].ToString(), conn); } } catch (Exception ex) { LogService.WriteErr("导出失败, ItemID:" + item["ItemID"].ToString() + " 频率:" + sysRow["Keys"].ToString() + "错误信息:" + ex.Message); continue; } } ini.IniWriteValue("FileDate", sysRow["Keys"].ToString(), LastFileDate); } else { AppendMessageLine("频率:《" + sysRow["Name"].ToString() + "》 共有" + ItemsDT.Rows.Count + "条数据需要导出(FileDate:" + FileDate + ")"); LogService.Write("频率:《" + sysRow["Name"].ToString() + "》 共有" + ItemsDT.Rows.Count + "条数据需要导出(FileDate:" + FileDate + ")"); } } } catch (Exception ex) { LogService.WriteErr("导出失败, 频率:" + sysRow["Keys"].ToString() + "错误信息:" + ex.Message); continue; } } if (!isStart) { AppendMessageLine("任务停止!"); LogService.Write("任务停止!"); return; } } catch (Exception ex) { AppendMessageLine("程序错误,方法:BatchTask 错误信息:" + ex.Message); LogService.WriteErr("程序错误,方法:BatchTask 错误信息:" + ex.Message); } finally { Globals.ExecuteStopDate = DateTime.Now; Common.FlushMemory(); } }
public static string szCall(string XmlPara01, string XmlPkg, ref string retcode) { /*aaz400:社保机构代码511300 tradeId:交易号 aae008:银行编号(测试定为103) inputXml:输入报文*/ string aaz400 = "511300", tradeId, aae008 = "103", reqseq, reqdate, inputXml, errinfo = "", strRecvXml = ""; //byte[]inputXml=new byte[128]; /*加密方式*/ int encryptKey = 2 | 4; INIClass iniKey = new INIClass(Service_NCSB.MyConfigFile); if (!iniKey.ExistINIFile()) { Service_NCSB.WriteLog("init 错误"); strRecvXml = ""; retcode = "0998"; return(strRecvXml); } /*配置密钥*/ string originalKey = iniKey.IniReadValue("KEY", "INIT_KEY"); string key = iniKey.IniReadValue("KEY", "NEW_KEY"); Service_NCSB.WriteLog("original key:[" + originalKey + "]"); Service_NCSB.WriteLog("new key:[" + key + "]"); if (key == "") { strRecvXml = ""; retcode = "9978"; return(strRecvXml); } if (!init()) { Service_NCSB.WriteLog("init 错误"); strRecvXml = ""; retcode = "0998"; return(strRecvXml); } XmlPara01 = "<Para01>" + XmlPara01 + "</Para01>"; Service_NCSB.WriteLog("XmlPara01[" + XmlPara01 + "]"); XmlDocument xReqPara = new XmlDocument(); try { xReqPara.InnerXml = XmlPara01; //aaz400 = xReqPara.SelectSingleNode("Para01/aaz400").InnerText; tradeId = xReqPara.SelectSingleNode("Para01/tradeId").InnerText; reqseq = xReqPara.SelectSingleNode("Para01/reqseq").InnerText; reqdate = xReqPara.SelectSingleNode("Para01/reqdate").InnerText; /*设置inputxml属性*/ XmlNode inputXmlNode = xReqPara.SelectSingleNode("Para01/inputxml"); XmlElement inputXmlElem = (XmlElement)inputXmlNode; inputXmlElem.SetAttribute("reqseq", reqseq); inputXmlElem.SetAttribute("reqdate", reqdate); inputXml = xReqPara.SelectSingleNode("Para01/inputxml").OuterXml; //Service_NCSB.WriteLog("aaz400[" + aaz400 + "]"); Service_NCSB.WriteLog("tradeId[" + tradeId + "]"); Service_NCSB.WriteLog("inputXml[" + inputXml + "]"); } catch (Exception err) { /*捕捉xml异常*/ Service_NCSB.WriteLog("Exception:[" + err.Message + "]"); strRecvXml = ""; retcode = "9996"; return(strRecvXml); } /*TODO:对帐处理*/ if (tradeId == "NC39006") { XmlDocument PkgXml = new XmlDocument(); PkgXml.InnerXml = XmlPkg; XmlNodeList fcNode = PkgXml.SelectNodes("ap/fc"); int fcLengh = fcNode.Count; XmlNode inputXmlNode = xReqPara.SelectSingleNode("Para01/inputxml"); //XmlElement inputXmlElem = (XmlElement)inputXmlNode; XmlElement rows = xReqPara.CreateElement("rows");//创建rows inputXmlNode.AppendChild(rows); for (int i = 0; i < fcLengh; i++) { XmlElement row = xReqPara.CreateElement("row"); string tmpfcXml = fcNode.Item(i).InnerXml; row.InnerXml = tmpfcXml; rows.AppendChild(row); } inputXml = xReqPara.SelectSingleNode("Para01/inputxml").OuterXml; Service_NCSB.WriteLog("inputXml[" + inputXml + "]"); //xReqPara.AppendChild(fcNode); //Service_NCSB.WriteLog("fc[") } /*签到*/ if (tradeId == "T0102") { /*新密钥*/ string newKey = ""; /*社保返回xml*/ string recvxmlDe = ""; try { /*加密方式*/ //int encryptKey = 2 | 4; /*加密xml*/ string encryptXmlKey = javaEncrypt.encrypt(inputXml, originalKey, encryptKey); /*调用*/ string recvxmlEn = webNCDC.szCall(aaz400, tradeId, encryptXmlKey, encryptKey.ToString(), aae008); Service_NCSB.WriteLog("签到返回加密[" + recvxmlEn + "]"); /*解密*/ recvxmlDe = javaEncrypt.decrypt(recvxmlEn, originalKey, encryptKey); Service_NCSB.WriteLog("签到返回解密[" + recvxmlDe + "]"); //recvxmlDe = "<result><code>1</code><message>成功</message><newkey>3333333311111111</newkey><sysdt>20161206161433</sysdt></result>"; } catch (Exception err) { /*捕捉签到调用及加解密异常*/ Service_NCSB.WriteLog("err=[" + err.Message + "]"); retcode = "0998"; strRecvXml = ""; return(strRecvXml); } xReqPara.LoadXml(recvxmlDe); /*判断社保返回结果*/ string returnCode = xReqPara.SelectSingleNode("result/code").InnerText; if (returnCode == "1") { newKey = xReqPara.SelectSingleNode("result/newkey").InnerText; Service_NCSB.WriteLog("newKey[" + newKey + "]"); iniKey.IniWriteValue("KEY", "NEW_KEY", newKey); } retcode = "0000"; recvxmlDe = xReqPara.SelectSingleNode("result").OuterXml; Service_NCSB.WriteLog("处理社保返回报文[" + recvxmlDe + "]"); return(recvxmlDe); } try { /*TODO:调用社保接口*/ //strRecvXml="<result><code>1</code><message></message><output><rows><row><aae001>2016</aae001><aae041>201601</aae041><aae042>201612</aae042></row></rows></output></result>"; //string keyEncrypt="1111111133333333"; //int entype = 2 | 4;//加密方式 string inputXmlEncrypt = javaEncrypt.encrypt(inputXml, key, encryptKey); //报文内容 Service_NCSB.WriteLog("加密inputXml[" + inputXmlEncrypt + "]"); string strTmpRecv = webNCDC.szCall(aaz400, tradeId, inputXmlEncrypt, encryptKey.ToString(), aae008); //得到社保原始报文 Service_NCSB.WriteLog("社保返回报文加密recvXml[" + strTmpRecv + "]"); strRecvXml = javaEncrypt.decrypt(strTmpRecv, key, encryptKey); Service_NCSB.WriteLog("社保返回报文解密[" + strRecvXml + "]"); } catch (Exception err) { /*捕捉webservice调用及加解密异常*/ Service_NCSB.WriteLog("err=[" + err.Message + "]"); retcode = "0998"; strRecvXml = ""; return(strRecvXml); } retcode = "0000"; xReqPara.LoadXml(strRecvXml); strRecvXml = xReqPara.SelectSingleNode("result").OuterXml; return(strRecvXml); }
/// <summary> /// 拷贝图片 /// </summary> /// <param name="PatientInfoList"></param> public async Task <bool> CopyPicture(BindingList <MDL.Mdl_MPatientInfo> mPatientInfo) { bool bif = false; BLL.BLL_BIsEnough bEnough = new BLL.BLL_BIsEnough(); string Reel = bEnough.f_listFiles(); List <MDL.Mdl_MPatientInfo> PatientInfoList1 = new List <MDL.Mdl_MPatientInfo>(); MDL.Mdl_MPatientInfo mPatientInfoll = new MDL.Mdl_MPatientInfo(); string FileFath = Directory.GetCurrentDirectory() + "\\INIConfig\\OptionsSave.ini"; INIClass iniClass = new INIClass(FileFath); if (string.IsNullOrEmpty(Reel)) { return(false); } try { string Md5result; if (!MainWindow.IsTwoINFO) { for (int i = 0; i < mPatientInfo.Count; i++) { #region ---------压缩文件返回MD5码 try { filename = "......"; descfile = "正在压缩,请等待"; comfile = "正在压缩,请等待"; string CompressUrl = string.Format("api/File/GetCompress_bool?&ProcessNumber={0}", mPatientInfo[i].VL_V_ProcessNumber); Md5result = httpClientHelper.GetResponse(CompressUrl); if (Md5result == "false") { return(false); } } catch (Exception ex) { return(false); } #endregion #region ---------下载文件 string url = @"api/File/GetDownload_bool"; descfile = url; string ProcessNumber = $"'{mPatientInfo[i].VL_V_ProcessNumber}'"; filename = mPatientInfo[i].VL_V_ProcessNumber + ".zip"; string UCardName = Tool.UCardCheck.UCardName;//优盘识别 if (string.IsNullOrEmpty(UCardName)) { return(false); } try { //优盘中文件下载位置 string localfile = $"{UCardName}Procedure\\IMAGE\\DICOM\\{mPatientInfo[i].VL_V_MODALITY}\\{mPatientInfo[i].VL_V_ProcessNumber}.zip"; comfile = localfile; System.Net.HttpWebResponse response = httpWebResponseHelper.HttpPost(url, ProcessNumber); //检查是否存在文件夹 string localfilePath = $"{UCardName}Procedure\\IMAGE\\DICOM\\{mPatientInfo[i].VL_V_MODALITY}"; if (false == System.IO.Directory.Exists(localfilePath)) { //创建文件夹 System.IO.Directory.CreateDirectory(localfilePath); } using (Stream readStream = response.GetResponseStream()) { bool b = Download(localfile, response.ContentLength, readStream); string md5F = getMD5Hash(localfile); if (md5F == Md5result) { } else { b = Download(localfile, response.ContentLength, readStream); string md5S = getMD5Hash(localfile); if (md5S != Md5result) { MessageBox.Show("校验出错,请重试!"); return(false); } } readStream.Close(); } response.Close(); } catch (Exception ex) { return(false); } #endregion #region ---------删除文件 try { ProgressVa = 500; string deleteUrl = string.Format("api/File/GetDelete_file?&ProcessNumber={0}", mPatientInfo[i].VL_V_ProcessNumber); string deledetbool = httpClientHelper.GetResponse(deleteUrl); return(Convert.ToBoolean(deledetbool)); } catch (Exception ex) { return(false); } #endregion } } else { try { //FPT文件下载 for (int i = 0; i < mPatientInfo.Count; i++) { PatientInfoList1.Add(mPatientInfo[i]); foreach (var item in PatientInfoList1) { //ProgressVa = 3; filename = item.VL_V_ProcessNumber + ".zip"; // mPatientInfoll.VL_V_PathNO = item.VL_V_PathNO; string compresss = iniClass.IniReadValue("DownloadPath", "DownloadPathL"); //图片保存的路径 string downloadpath = Directory.GetCurrentDirectory() + compresss; DateTime?timedate = item.VL_D_StudyDate; string time = timedate.Value.ToString("yyyyMMdd"); string mddality = item.VL_V_MODALITY; string ftp = iniClass.IniReadValue("PACSPicutrePath", "URI"); string downlodepath = ftp + "/" + mddality + "/" + time; mPatientInfoll.VL_V_PathNO = System.IO.Path.Combine(downlodepath, item.VL_V_ProcessNumber); string DesPath = string.Format("{0}\\{1}\\{2}\\", downloadpath, item.VL_V_MODALITY, item.VL_V_ProcessNumber); descfile = mPatientInfoll.VL_V_PathNO; if (false == System.IO.Directory.Exists(DesPath)) { //创建文件夹 System.IO.Directory.CreateDirectory(DesPath); } comfile = DesPath; bool PictureCopyB = await PictureCopy(mPatientInfoll.VL_V_PathNO, DesPath, item.VL_V_ProcessNumber, downlodepath); if (!PictureCopyB) { return(false); } //压缩文件 FileSystemInfo[] fileinfo = new DirectoryInfo(DesPath).GetFileSystemInfos(); List <string> sourceFileList = new List <string>(); foreach (FileSystemInfo il in fileinfo) { sourceFileList.Add(il.FullName); } //CompressHelper ch = new Base.Common.CompressHelper(); string TopPathName = iniClass.IniReadValue("DesPathName", "PathName"); if (!Directory.Exists(TopPathName)) { Directory.CreateDirectory(TopPathName); } string filenameq = TopPathName + "\\" + item.VL_V_ProcessNumber + ".zip"; //ch.CompressMulti(sourceFileList.ToArray(), filenameq); ZipFloClass Zc = new ZipFloClass(); //Base.Log.Log4Net.GetLog4Net().WriteLog("DEBUG", "FileURL:" + filename); comfile = filenameq; Zc.ZipFile(DesPath, filenameq); new System.Threading.Thread(delegate() { Directory.Delete(DesPath, true); }).Start(); //删除下载的dicm文件 //复制文件 string UDesPath = string.Format("{0}:\\Procedure\\IMAGE\\DICOM\\{1}\\", Reel, item.VL_V_MODALITY); comfile = UDesPath; if (!Directory.Exists(UDesPath)) { Directory.CreateDirectory(UDesPath); } DirectoryInfo dir = new DirectoryInfo(TopPathName); FileSystemInfo[] fileinfolll = dir.GetFileSystemInfos(); foreach (FileSystemInfo ippp in fileinfolll) { //不是文件夹即复制文件,true表示可以覆盖同名文件 File.Copy(ippp.FullName, UDesPath + "\\" + ippp.Name, true); ProgressVa = 500; } new System.Threading.Thread(delegate() { File.Delete(filenameq); }).Start(); //删除压缩文件 } } bif = true; } catch (Exception ex) { bif = false; } } return(true); } catch (Exception e) { return(bif); } }
private static String ConnectionStr = ""; //连接字符串 static ConnectionPool() { // // TODO: 在此处添加构造函数逻辑 // ConnectionStr = string.Format("Server={0};Database={1};Trusted_Connection=SSPI", INIClass.IniReadValue("Jav", "server"), INIClass.IniReadValue("Jav", "db")); size = 100; pool = new ArrayList(); }
static DataBaseManager() { con = string.Format("Server={0};Database={1};Trusted_Connection=SSPI", INIClass.IniReadValue("Jav", "server"), INIClass.IniReadValue("Jav", "db")); mycon = new SqlConnection(con); }