static void Main() { TaskBarAdapter.CheckCreated(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PrepareAppEnvironment(); string authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); string smsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); DialogResult dr = DialogResult.OK; if (string.IsNullOrEmpty(authEndPoint) || string.IsNullOrEmpty(smsEndPoint)) { frmSetting frmS = new frmSetting(); frmS.SectionSettingsSave += new dSectionSettingsSave((o, ce) => { INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, ce.AuthEndPoint, Common.INI_FILE_PATH); INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, ce.SmsEndPoint, Common.INI_FILE_PATH); INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_ISMG_END_POINT, ce.IsmgEndPoint, Common.INI_FILE_PATH); }); dr = frmS.ShowDialog(); } if (dr == DialogResult.OK) { Application.Run(new frmMain()); } }
private void frmMain_Load(object sender, EventArgs e) { authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); authSmsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTHSMS_END_POINT, Common.INI_FILE_PATH); smsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); smsRetCodeDic = Common.GetEnumDesc(new SmsStatusEnum()); Dictionary <string, string> txtSmsSettingDic = Common.StrToDictionary(INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_TXT_SMS_SETTING, Common.INI_FILE_PATH), '&'); if (txtSmsSettingDic.Count > 2) { //默认发送短信参数 txtDictionary.Add("SpCode", txtSmsSettingDic["SpCode"]); txtDictionary.Add("LoginName", txtSmsSettingDic["LoginName"]); txtDictionary.Add("Password", txtSmsSettingDic["Password"]); txtDictionary.Add("f", "1"); _LoopForAuth(); _LoopForGetSmsPoint(); _LoopForSendSms(); _LoopForReportSms(); _LoopForReplySms(); _LoopForReplyConfirmSms(); _LoopForUiSendSms(); _LoopForUiGetms(); } }
private void FetchAccessPoints(Action success) { sendReminderUrl = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SEND_REMINDER_POINT, Common.INI_FILE_PATH); strRunMode = INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH); string authEndPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_END_POINT, Common.CFG_FILE_PATH); //异步认证 byte runMode = byte.Parse(strRunMode);//测试1 正式0 HttpAdapter.postAsyncAsJSON(authEndPoint, new { RunMode = runMode }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { foreach (var accessPoint in ret.ret.AccessPoints) { accessPointParts.Add(new AccessPointPart { ObjectId = accessPoint.ObjectId.ToString(), Url = accessPoint.Url.ToString() }); } if (success != null) { success(); } } else { MessageBoxAdapter.ShowError(ret.ErrorMessage); } }); }
private void InitForm() { Util.SetBtnTransparency(btnOK); lblTechSupport.Text = Properties.Settings.Default.Company; txtUserName.Text = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, Common.INI_FILE_PATH); }
private void frmSettings_Load(object sender, EventArgs e) { //初始化运行模式 List <KeyValuePair <object, string> > listKeyValue = new List <KeyValuePair <object, string> >(); listKeyValue.Add(new KeyValuePair <object, string>("0", "外网模式")); listKeyValue.Add(new KeyValuePair <object, string>("2", "内网模式")); listKeyValue.Add(new KeyValuePair <object, string>("1", "测试模式")); cbbRunMode.DataSource = listKeyValue; cbbRunMode.DisplayMember = "value"; cbbRunMode.ValueMember = "key"; string defaultSelectMode = INIAdapter.ReadValue(Common.INI_SECTION_SMARTCARE, Common.INI_KEY_RUNMODE, Common.INI_FILE_PATH); if (string.IsNullOrEmpty(defaultSelectMode)) { cbbRunMode.SelectedValue = "0"; } else { cbbRunMode.SelectedValue = defaultSelectMode; } //初始化连接数据 txtCallCenterNodeAddress.Text = INIAdapter.ReadValue(Common.INI_SECTION_CALLCENTER, Common.INI_KEY_CALLCENTER_NODE_ADDRESS, Common.INI_FILE_PATH); }
static void Main() { //TaskBarAdapter.CheckCreated(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); PrepareAppEnvironment(); string remindType = INIAdapter.ReadValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, Common.INI_FILE_PATH); if (string.IsNullOrEmpty(remindType)) { SettingsVar.CurrentRemindType = RemindType.提醒; INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, ((int)SettingsVar.CurrentRemindType).ToString(), Common.INI_FILE_PATH); } else { SettingsVar.CurrentRemindType = e0571.web.core.Utils.EnumAdapter.GetEnum <RemindType>(remindType); } #if V2X SettingsVar.CurrentYYRemindFlag = INIAdapter.ReadValue(Common.INI_SECTION_BIZ, Common.INI_KEY_YYREMIND_FLAG, Common.INI_FILE_PATH) == "1" ? 1 : 0; INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_YYREMIND_FLAG, SettingsVar.CurrentYYRemindFlag.ToString(), Common.INI_FILE_PATH); frmLogin frm = new frmLogin(); frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { Application.Run(new frmMainV2X()); } #else //http://localhost/SmartLife.Auth.Merchant.Services/v1/AuthenticateMerchant string authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); DialogResult dr = DialogResult.OK; if (string.IsNullOrEmpty(authEndPoint)) { frmSettings frmS = new frmSettings(); frmS.SectionWebSettingsSave += new dSectionWebSettingsSave((o, ce) => { INIAdapter.WriteValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, ce.AuthEndPoint, Common.INI_FILE_PATH); }); frmS.SectionBizSettingsSave += new dSectionBizSettingsSave((o, ce) => { SettingsVar.CurrentRemindType = ce.Type; INIAdapter.WriteValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, ((int)ce.Type).ToString(), Common.INI_FILE_PATH); }); dr = frmS.ShowDialog(); } if (dr == DialogResult.OK) { frmLogin frm = new frmLogin(); frm.ShowDialog(); if (frm.DialogResult == DialogResult.OK) { Application.Run(new frmMain()); } } #endif }
private void frmLogin_Load(object sender, EventArgs e) { lblProductName.Text = Properties.Settings.Default.ProductName; lblProductVersionComment.Text = Properties.Settings.Default.ProductVersionComment; authEndPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_END_POINT, Common.CFG_FILE_PATH); authDataPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_DATA_POINT, Common.CFG_FILE_PATH); strUserNameSinceLast = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, Common.INI_FILE_PATH); strObjectIdSinceLast = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_ID_SINCE_LAST, Common.INI_FILE_PATH); strObjectNameSinceLast = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_NAME_SINCE_LAST, Common.INI_FILE_PATH); strRunMode = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH); string strDeployNodeObjects = INIAdapter.ReadValue(Common.INI_SECTION_DATA, Common.INI_KEY_DEPLOY_NODE_OBJECTS, Common.INI_FILE_PATH); if (strDeployNodeObjects == "") { btnOk.Enabled = false; //远程获取deployNodeObjects ThreadAdapter.DoOnceTask(() => { HttpAdapter.getSyncTo(authDataPoint + "/GetDeployNodeObjects", (ret, res) => { if ((bool)ret.Success) { strDeployNodeObjects = JsonConvert.SerializeObject(ret.rows); INIAdapter.WriteValue(Common.INI_SECTION_DATA, Common.INI_KEY_DEPLOY_NODE_OBJECTS, strDeployNodeObjects, Common.INI_FILE_PATH); this.UIInvoke(() => { btnOk.Enabled = true; }); BindDeployNodeObjects(strDeployNodeObjects); } else { this.UIInvoke(() => { btnOk.Enabled = true; }); } }); }); } else { BindDeployNodeObjects(strDeployNodeObjects); } if (strRunMode == "") { strRunMode = "0"; } if (!string.IsNullOrEmpty(strUserNameSinceLast)) { txtUserName.Text = strUserNameSinceLast; } }
private void frmSettings_Load(object sender, EventArgs e) { txtAuthEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); cbRemindType.DataSource = EnumAdapter.ToListItem(typeof(RemindType)).ToList(); cbRemindType.ValueMember = "Value"; cbRemindType.DisplayMember = "Text"; string s = INIAdapter.ReadValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, Common.INI_FILE_PATH); cbRemindType.SelectedValue = Convert.ToInt32(INIAdapter.ReadValue(Common.INI_SECTION_BIZ, Common.INI_KEY_REMIND_TYPE, Common.INI_FILE_PATH)); }
//客户端回调模式设置 public string SwitchClientRunMode() { string cmsRunMode = INIAdapter.ReadValue(Common.INI_SECTION_SMARTCARE, Common.INI_KEY_RUNMODE, Common.INI_FILE_PATH); if (!string.IsNullOrEmpty(cmsRunMode)) { return(cmsRunMode); } return(""); }
private void frmLogin_Load(object sender, EventArgs e) { authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); strUserNameSinceLast = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, Common.INI_FILE_PATH); if (!string.IsNullOrEmpty(strUserNameSinceLast)) { txtUserName.Text = strUserNameSinceLast; txtPassword.Focus(); } }
private void cbbRunMode_SelectedIndexChanged(object sender, EventArgs e) { string strSelectValue = (string)((KeyValuePair <object, string>)cbbRunMode.SelectedItem).Key; txtRemoteHost.Text = INIAdapter.ReadValue(Common.INI_SECTION_SMARTCARE, Common.GetValueByFiledsName("INI_KEY_CMSHOST_" + strSelectValue), Common.INI_FILE_PATH); txtVirPath.Text = INIAdapter.ReadValue(Common.INI_SECTION_SMARTCARE, Common.GetValueByFiledsName("INI_KEY_VIRPATH_" + strSelectValue), Common.INI_FILE_PATH); if (txtVirPath.Text.StartsWith("/")) { txtVirPath.Text = txtVirPath.Text.Substring(1); } }
private void frmMain120701_Load(object sender, EventArgs e) { this.Top = 0; this.Left = 0; this.Width = Screen.PrimaryScreen.WorkingArea.Width; this.Height = Screen.PrimaryScreen.WorkingArea.Height - 5; this.MaximumSize = new Size(Width, Height); Text = Properties.Settings.Default.ProductName + " " + Assembly.GetEntryAssembly().GetName().Version.ToString(); _SourceAddress = INIAdapter.ReadValue(Common.INI_SECTION_SYNC, Common.INI_KEY_SOURCE_BASE_ADDRESS, Common.INI_FILE_PATH); _TargetAddressToSaveOrder = INIAdapter.ReadValue(Common.INI_SECTION_SYNC, Common.INI_KEY_TARGET_ADDRESS_TO_SAVE_ORDER, Common.INI_FILE_PATH); }
private void frmSendSms_Load(object sender, EventArgs e) { //初始化 authSmsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTHSMS_END_POINT, Common.INI_FILE_PATH); smsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); txtDictionary = BaseUtility.StrToDictionary(INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_TXT_SMS_SETTING_LAST, Common.INI_FILE_PATH), '&'); orderDictionary = BaseUtility.StrToDictionary(INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_ORDER_SMS_SETTING_LAST, Common.INI_FILE_PATH), '&'); smsRetCodeDic = BaseUtility.GetEnumDesc(new SmsStatusEnum()); //开始执行 _tickTimer = new System.Timers.Timer(5 * 1000); _tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object source, System.Timers.ElapsedEventArgs ee) { _tickTimer.Enabled = false; HttpUtility.getAsyncTo(authSmsEndPoint + "/GetCityDeployNodes", null, null, new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { string url; foreach (var item in ret.rows) { url = (string)item.AccessPoint;//"http://localhost/SmartLife.CertManage.SmsServices";// HttpUtility.postSyncAsJSON(url.Replace("115.236.175.110", "localhost") + "/Pub/SmsSendService/QueuedSendSms", null, new { Status = "0" }.ToStringObjectDictionary(), new { ApplicationId = "CS001", Token = item.Token, NodeId = item.NodeId }.ToStringObjectDictionary(), (smsret, smsres) => { if ((bool)smsret.Success) { QueuedSendSms(smsret.rows, url, item.Token, item.NodeId); } }); } this.UIInvoke(() => { if (sb_retStatus.Length > 0) { if (this.tb_SendSms.Lines.Length > 1000) { int iline = tb_SendSms.GetFirstCharIndexFromLine(1); tb_SendSms.Text = tb_SendSms.Text.Remove(0, iline); } this.tb_SendSms.AppendText(sb_retStatus.ToString()); sb_retStatus.Remove(0, sb_retStatus.Length); } }); } }); _tickTimer.Enabled = true; }); //到达时间的时候执行事件; _tickTimer.AutoReset = true; //设置是执行一次(false)还是一直执行(true); _tickTimer.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件; }
static void PrepareAppEnvironment() { Assembly assem = Assembly.GetExecutingAssembly(); log4net.Config.XmlConfigurator.Configure(assem.GetManifestResourceStream("SmartLife.Client.PensionAgency.Order.log4net.config")); SettingsVar.BindingPACode = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_CODE, Common.INI_FILE_PATH); SettingsVar.RunMode = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH); if (SettingsVar.RunMode == "") { SettingsVar.RunMode = "0"; INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, SettingsVar.RunMode, Common.INI_FILE_PATH); } }
private SqlConnection Connect(string DataBase) { INIAdapter iniAdt = new INIAdapter(Application.StartupPath + "\\sjsys.ini"); SqlConnection conn; if (!iniAdt.Exists()) { throw (iniAdt.INIException); } else { string DataSource, InitialCatalog, UserID, Password; DataSource = iniAdt.ReadValue(DataBase, "DataSource"); InitialCatalog = iniAdt.ReadValue(DataBase, "InitialCatalog"); UserID = iniAdt.ReadValue(DataBase, "UserID"); Password = iniAdt.ReadValue(DataBase, "Password"); StringEncrypt.DecodeString(Password, out Password); conn = new SqlConnection(); conn.ConnectionString = @"Data Source=" + DataSource + ";Initial Catalog=" + InitialCatalog + ";User ID=" + UserID + ";Password=" + Password; } return(conn); }
private void frmSetting_Load(object sender, EventArgs e) { txtAuthEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); txtAuthSmsEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTHSMS_END_POINT, Common.INI_FILE_PATH); txtSmsEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); Dictionary <string, string> txtDictionary = Common.StrToDictionary(INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_TXT_SMS_SETTING, Common.INI_FILE_PATH), '&'); if (txtDictionary.Count > 2) { txt_SpCode.Text = txtDictionary["SpCode"]; txt_LoginName.Text = txtDictionary["LoginName"]; txt_Password.Text = txtDictionary["Password"]; } }
private void frmMain_Load(object sender, EventArgs e) { authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); smsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); ismgEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_ISMG_END_POINT, Common.INI_FILE_PATH); lblMsg.Show(); _tickTimer = new System.Timers.Timer(1 * 200); _tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object source, System.Timers.ElapsedEventArgs ee) { BeginInvoke(new Action(() => { if (lblMsg.Text.IndexOf(".") == -1) { lblMsg.Text += "."; } else if (lblMsg.Text.IndexOf(".") + 5 == lblMsg.Text.Length) { lblMsg.Text = lblMsg.Text.Substring(0, lblMsg.Text.Length - 5); } else { lblMsg.Text += "."; } })); }); //到达时间的时候执行事件; _tickTimer.AutoReset = true; //设置是执行一次(false)还是一直执行(true); _tickTimer.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件; HttpAdapter.optionsAsyncTo(authEndPoint + "/", new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) => { if (ret != "ok") { MessageBoxAdapter.ShowError("无效的认证节点"); return; } this.UIInvoke(() => { lblMsg.Hide(); }); _tickTimer.Enabled = false; _tickTimer = null; InitSms(); }); }
public static void Upgrade() { string updateFolder = AppDomain.CurrentDomain.BaseDirectory + Common.APPLICATION_ID; FileAdapter.EnsurePath(updateFolder); FileAdapter.Copy(Updater.AppName, updateFolder + @"\" + Updater.AppName, true); foreach (var file in Updater.DepandenceFiles) { FileAdapter.Copy(file, AppDomain.CurrentDomain.BaseDirectory + Common.APPLICATION_ID + @"\" + file, true); } string updateEndPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_UPDATE_END_POINT, Common.CFG_FILE_PATH); string args = String.Format("-n {0} -v {1} -c {2}", AppAdapter.GetName(), VersionAdapter.GetPureVersion(VersionType.ASSEMBLY), updateEndPoint + "/" + Common.APPLICATION_ID); System.Diagnostics.Process.Start(updateFolder + @"\" + Updater.AppName, args); }
private void frmSettings_Load(object sender, EventArgs e) { txtPlatformAddress.Text = INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_PLATFORM_ADDRESS, Common.INI_FILE_PATH); chkServiceOnlineFlag.Checked = INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_SERVICE_ONLINE, Common.INI_FILE_PATH) == "1"; cbxPlayTone.Checked = INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_PLAY_TONE, Common.INI_FILE_PATH) == "1"; if (INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_PLAY_TONE_STIME, Common.INI_FILE_PATH) != "") { dtpStart.Value = DateTime.Parse(INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_PLAY_TONE_STIME, Common.INI_FILE_PATH)); } if (INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_PLAY_TONE_ETIME, Common.INI_FILE_PATH) != "") { dtpEnd.Value = DateTime.Parse(INIAdapter.ReadValue(Common.INI_SECTION_SYSTEM, Common.INI_KEY_PLAY_TONE_ETIME, Common.INI_FILE_PATH)); } callCenterIP = TheMotherWin.GetCallCenterIP(); btnTestSpeed.Enabled = callCenterIP != ""; }
static void PrepareAppEnvironment() { Assembly assem = Assembly.GetExecutingAssembly(); log4net.Config.XmlConfigurator.Configure(assem.GetManifestResourceStream("SmartLife.Client.PensionAgency.SelfService.log4net.config")); SettingsVar.BindingPACode = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_CODE, Common.INI_FILE_PATH); SettingsVar.BindingPAName = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_NAME, Common.INI_FILE_PATH); SettingsVar.DataExchangePoint = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_DATA_EXCHANGE_POINT, Common.INI_FILE_PATH); SettingsVar.RunMode = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, Common.INI_FILE_PATH); if (SettingsVar.RunMode == "") { SettingsVar.RunMode = "0"; INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_RUN_MODE, SettingsVar.RunMode, Common.INI_FILE_PATH); } Common.MachineKey = ZPCrypto.GetMachineKey(MachineHardwareType.CPU | MachineHardwareType.HARDDISK | MachineHardwareType.MAINBOARD); }
private void btnUpdate_Click(object sender, EventArgs e) { string delegateApplicationId = "PM001";//Common.APPLICATION_ID string updateFolder = AppDomain.CurrentDomain.BaseDirectory + delegateApplicationId; win.core.utils.FileAdapter.EnsurePath(updateFolder); win.core.utils.FileAdapter.Copy(Updater.AppName, updateFolder + @"\" + Updater.AppName, true); foreach (var file in Updater.DepandenceFiles) { win.core.utils.FileAdapter.Copy(file, AppDomain.CurrentDomain.BaseDirectory + delegateApplicationId + @"\" + file, true); } string updateEndPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_UPDATE_END_POINT, Common.CFG_FILE_PATH); string args = String.Format("-n {0} -v {1} -c {2}", AppAdapter.GetName(), VersionAdapter.GetPureVersion(VersionType.ASSEMBLY), updateEndPoint + "/" + delegateApplicationId); System.Diagnostics.Process.Start(updateFolder + @"\" + Updater.AppName, args); }
private void ReadSettings() { string strAssistToolbarFlag = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_ASSIST_TOOLBAR_FLAG, Common.INI_FILE_PATH); if (!string.IsNullOrEmpty(strAssistToolbarFlag)) { assistToolbarState = EnumAdapter.GetEnum <CheckState>(strAssistToolbarFlag); } string strAssistToolbarPositionLast = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_ASSIST_TOOLBAR_POSITION_LAST, Common.INI_FILE_PATH); if (!string.IsNullOrEmpty(strAssistToolbarPositionLast)) { string[] positions = strAssistToolbarPositionLast.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); pnlAssistToolbarContainer.Location = new Point(int.Parse(positions[0]), int.Parse(positions[1])); } else { pnlAssistToolbarContainer.Location = new Point(pnlMain.Width - pnlAssistToolbarContainer.Width, 0); } }
private void btnAreaSync_Click(object sender, EventArgs e) { //远程获取deployNodeObjects string authDataPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_DATA_POINT, Common.CFG_FILE_PATH); ThreadAdapter.DoOnceTask(() => { HttpAdapter.getSyncTo(authDataPoint + "/GetDeployNodeObjects", (ret, res) => { if ((bool)ret.Success) { string strDeployNodeObjects = JsonConvert.SerializeObject(ret.rows); INIAdapter.WriteValue(Common.INI_SECTION_DATA, Common.INI_KEY_DEPLOY_NODE_OBJECTS, strDeployNodeObjects, Common.INI_FILE_PATH); MessageBoxAdapter.ShowInfo("区域同步成功"); } else { MessageBoxAdapter.ShowError(ret.ErrorMessage.ToString()); } }); }); }
private void frmSetting_Load(object sender, EventArgs e) { txtAuthEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); txtAuthSmsEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTHSMS_END_POINT, Common.INI_FILE_PATH); tb_SmsEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); string txtSmsSetting = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_TXT_SMS_SETTING_LAST, Common.INI_FILE_PATH); string orderSmsSetting = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_ORDER_SMS_SETTING_LAST, Common.INI_FILE_PATH); Dictionary <string, string> dict = BaseUtility.StrToDictionary(txtSmsSetting, '&'); if (dict.Count > 2) { tb_Txt_SpCode.Text = dict["SpCode"]; tb_Txt_LoginName.Text = dict["LoginName"]; tb_Txt_Password.Text = BaseUtility.DecryptDES(dict["Password"]); } dict = BaseUtility.StrToDictionary(orderSmsSetting, '&'); if (dict.Count > 2) { tb_Digital_SpCode.Text = dict["SpCode"]; tb_Digital_LoginName.Text = dict["LoginName"]; tb_Digital_Password.Text = BaseUtility.DecryptDES(dict["Password"]); } }
private void frmMain_Load(object sender, EventArgs e) { authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); lblMsg.Show(); _tickTimer = new System.Timers.Timer(1 * 200); _tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object source, System.Timers.ElapsedEventArgs ee) { BeginInvoke(new Action(() => { if (lblMsg.Text.IndexOf(".") == -1) { lblMsg.Text += "."; } else if (lblMsg.Text.IndexOf(".") + 5 == lblMsg.Text.Length) { lblMsg.Text = lblMsg.Text.Substring(0, lblMsg.Text.Length - 5); } else { lblMsg.Text += "."; } })); }); //到达时间的时候执行事件; _tickTimer.AutoReset = true; //设置是执行一次(false)还是一直执行(true); _tickTimer.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件; HttpUtility.optionsAsyncTo(authEndPoint + "/", null, new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (ret, res) => { if (ret != "ok") { MessageBoxAdapter.ShowError("无效的认证节点"); return; } this.UIInvoke(() => { AnchorStyles anS = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); frmSendSms fmSendSms = new frmSendSms(); fmSendSms.FormBorderStyle = FormBorderStyle.None; fmSendSms.TopLevel = false; fmSendSms.Parent = this; fmSendSms.Anchor = anS; fmSendSms.Size = this.panel1.Size; this.panel1.Controls.Add(fmSendSms);//将子窗体载入panel fmSendSms.Show(); frmGetSms fmGetSms = new frmGetSms(); fmGetSms.FormBorderStyle = FormBorderStyle.None; fmGetSms.TopLevel = false; fmGetSms.Parent = this; fmGetSms.Anchor = anS; fmGetSms.Size = this.panel2.Size; this.panel2.Controls.Add(fmGetSms);//将子窗体载入panel fmGetSms.Show(); lblMsg.Hide(); }); _tickTimer.Enabled = false; _tickTimer = null; }); }
private void DoLogin(string userCode, string password) { // btnOK.SafeButtonEnable(false); this.UIDoStepTasks(new List <Func <bool> >() { () => { #region 检查硬件环境 lblLoadItems.Text = _LoadItem = "检查硬件环境"; Application.DoEvents(); API icAPI = new API(); icAPI.InitIC(); if (icAPI.IcDev < 0) { if (MessageBoxAdapter.ShowConfirm("初始化IC读卡设备失败,请确认是否已连接IC读卡设备!是否要跳过该步骤?") == System.Windows.Forms.DialogResult.OK) { btnOK.SafeButtonEnable(true); isBreak = false; } else { isBreak = true; return(false); } } else { icAPI.ExitIC(); } isBreak = false; return(true); #endregion }, () => { #region 读取服务机构编码 lblLoadItems.Text = _LoadItem = "读取服务机构编码"; isBreak = false; Application.DoEvents(); if (string.IsNullOrEmpty(SettingsVar.BindingPACode)) { frmBindingPA frm = new frmBindingPA(); frm.ShowDialog(); if (frm.DialogResult != System.Windows.Forms.DialogResult.OK) { isBreak = true; this.DialogResult = System.Windows.Forms.DialogResult.Cancel; btnOK.SafeButtonEnable(true); return(false); } else { this.Activate(); } } return(true); #endregion }, () => { #region 用户认证 lblLoadItems.Text = _LoadItem = "用户认证"; isBreak = false; Application.DoEvents(); string authEndPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_END_POINT, Common.CFG_FILE_PATH); string objectId = SettingsVar.BindingPACode.Substring(2, 6); HttpAdapter.postSyncAsJSON(authEndPoint, new { RunMode = SettingsVar.RunMode, ObjectId = objectId, UserCode = userCode, PasswordHash = MD5Provider.Generate(password) }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { Data.UserId = Guid.Parse((string)ret.ret.UserId); SettingsVar.DataExchangePoint = (string)ret.ret.AccessPoint; INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, userCode, Common.INI_FILE_PATH); } else { MessageBoxAdapter.ShowError((string)ret.ErrorMessage); isBreak = true; btnOK.SafeButtonEnable(true); } }); if (isBreak) { return(false); } return(true); #endregion }, () => { #region 更新老人数据 lblLoadItems.Text = _LoadItem = "更新老人数据"; isBreak = false; Application.DoEvents(); HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/GetOldManInfoForSelfServiceMachine", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { Data.OldMans = new List <OldManInfo>(); foreach (var row in ret.rows) { dynamic item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(row.ToString())); Data.OldMans.Add((item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <OldManInfo>()); } //MessageBoxAdapter.ShowInfo("老人:" + Data.OldMans.Count.ToString()); } else { isBreak = true; lblError.Text = ret.ErrorCode; } }); if (isBreak) { return(false); } return(true); #endregion }, () => { #region 更新配餐数据 lblLoadItems.Text = _LoadItem = "更新配餐数据"; isBreak = false; Application.DoEvents(); HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/GetOldManBookMealForToday", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { Data.BookMeals = new List <BookMealInfo>(); foreach (var row in ret.rows) { dynamic item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(row.ToString())); Data.BookMeals.Add((item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <BookMealInfo>()); } //MessageBoxAdapter.ShowInfo("订餐:" + Data.BookMeals.Count.ToString()); } else { isBreak = true; lblError.Text = ret.ErrorCode; } }); if (isBreak) { return(false); } return(true); #endregion }, () => { allLoaded = true; this.DialogResult = System.Windows.Forms.DialogResult.OK; return(true); } }, Common.msDelay); lblLoadItems.UIDoCircleTask(() => { if (dotNum == 3) { lblLoadItems.Text = _LoadItem; dotNum = 0; } else { lblLoadItems.Text += "."; dotNum++; } }, Common.msDot, () => { return(allLoaded || isBreak); }); }
private void frmSetting_Load(object sender, EventArgs e) { txtAuthEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); txtSmsEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); txtISMGEndPoint.Text = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_ISMG_END_POINT, Common.INI_FILE_PATH); }
public Welcome(bool CheckUpdate) { //2012-09-03 LiuQi 启动时检查是否有word进程 Process[] process; process = Process.GetProcesses(); foreach (Process p in process) { try { if (p.Id != 0 && p.Modules != null && p.Modules.Count > 0) { System.Diagnostics.ProcessModule pm = p.Modules[0]; if (pm.ModuleName.ToLower() == "winword.exe") { MessageBox.Show("其他程序影响电子病历正常使用须关闭!", "提示"); p.Kill(); break; } } } catch { } } InitializeComponent(); //开始日志 udt.jj.LoadlogAdapter(); if (ini.ReadValue("System", "CheckClient").Trim() == true.ToString()) { CheckClient(); } try { tLoadData = new Thread(LoadData); tShowStatus = new Thread(ShowStatus); if (ini.ReadValue("System", "LiveUpdate").Trim() == true.ToString()) { try { pUpdate.StartInfo.FileName = Application.StartupPath + "\\liveupdate.exe"; pUpdate.StartInfo.Arguments = "-liveupdate[" + FileMethod.GetFileName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName) + "]"; pUpdate.Start(); } catch (Win32Exception) { ini.WriteValue("System", "LiveUpdate", false.ToString()); MessageBox.Show(this, "启动自动更新程序失败,自动更新功能已关闭,若要重新开启此功能请联系系统管理员或重新安装。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1); } } else { } ThisAddIn.logon = new Logon(); } catch (Exception ex) { Globals.logAdapter.Record("EX756987457748", ex.Message + ">>" + ex.ToString(), true); MessageBox.Show(ex.ToString()); } }
private void BindingPA() { string bindingPACode = txtBindingCode.Text.Trim(); ObjectId = bindingPACode.Substring(2, 6); if (ObjectId.Length < 6) { MessageBoxAdapter.ShowError("无效的PA码"); return; } string authDataPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_DATA_POINT, Common.CFG_FILE_PATH); this.UIDoStepTasks(new List <Func <bool> >() { () => { lblLoadItems.Text = _LoadItem = "获取业务服务器地址"; isBreak = false; HttpAdapter.getSyncTo(authDataPoint + string.Format("/GetDeployNode/{0},{1},IC001", ObjectId, SettingsVar.RunMode), null, new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { SettingsVar.DataExchangePoint = (string)ret.ret.AccessPoint; INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_DATA_EXCHANGE_POINT, SettingsVar.DataExchangePoint, Common.INI_FILE_PATH); } else { isBreak = true; MessageBoxAdapter.ShowError((string)ret.ErrorMessage); } }); if (isBreak) { return(false); } return(true); }, () => { lblLoadItems.Text = _LoadItem = "绑定设备"; isBreak = false; HttpAdapter.postSyncAsJSON(SettingsVar.DataExchangePoint + "/Pam/PamService/PADeviceBindingForSelfServiceTerminal", new { PACode = bindingPACode, MachineKey = Common.MachineKey, Action = "binding" }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { SettingsVar.BindingPACode = bindingPACode; INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_CODE, SettingsVar.BindingPACode, Common.INI_FILE_PATH); } else { MessageBoxAdapter.ShowError((string)ret.ErrorCode); } }); if (isBreak) { return(false); } return(true); }, () => { allLoaded = true; this.DialogResult = System.Windows.Forms.DialogResult.OK; return(true); } }, Common.msDelay); lblLoadItems.UIDoCircleTask(() => { if (dotNum == 3) { lblLoadItems.Text = _LoadItem; dotNum = 0; } else { lblLoadItems.Text += "."; dotNum++; } }, Common.msDot, () => { return(allLoaded || isBreak); }); }
private void frmGetSms_Load(object sender, EventArgs e) { authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); smsEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_SMS_END_POINT, Common.INI_FILE_PATH); orderDictionary = BaseUtility.StrToDictionary(INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_ORDER_SMS_SETTING_LAST, Common.INI_FILE_PATH), '&'); string lastReplyId = "0"; StringBuilder sb_getSmsInfo = new StringBuilder(); _tickTimer = new System.Timers.Timer(5 * 1000); _tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(delegate(object source, System.Timers.ElapsedEventArgs ee) { _tickTimer.Enabled = false; HttpUtility.postSyncAsForm(smsEndPoint + "/reply.do", Encoding.Default, new { SpCode = orderDictionary["SpCode"], LoginName = orderDictionary["LoginName"], Password = BaseUtility.DecryptDES(orderDictionary["Password"]) }.ToStringObjectDictionary(), null, (ret, res) => { //ret = "replys=[{\"mdn\":\"13282147242\",\"content\":\"103/002/118.872887/28.970322/113.992516/22.528885/1000.000000/姓名/20\",\"reply_time\":\"2013-10-31 14:43:22\",}]"; Dictionary <string, string> dictionary = BaseUtility.StrToDictionary(ret, '&'); if (dictionary.ContainsKey("replys")) { string itemNo; string content; string replays = dictionary["replys"]; //比较最后一个回复ID号,没有新内容不执行发送,否则截取要发送的内容进行发送 if (!lastReplyId.Equals(dictionary["id"])) { lastReplyId = dictionary["id"];//保存最后一个ID号 dynamic dynJson = Newtonsoft.Json.JsonConvert.DeserializeObject(replays); foreach (var item in dynJson) { itemNo = Convert.ToString(item.mdn); content = (string)item.content; if (string.IsNullOrEmpty(content) || content.Split('/').Length < 1) { continue; } if (string.IsNullOrEmpty(itemNo)) { continue; } HttpUtility.postSyncAsJSON(authEndPoint + "/AuthenticateUnicomMobileNo", null, new { MobileNo = itemNo }.ToStringObjectDictionary(), new { ApplicationId = "CS001" }.ToStringObjectDictionary(), (httpret, httpres) => { if ((bool)httpret.Success) { ArrayList arr = BaseUtility.StrSplitToArray(content); string strflag = (string)arr[0]; string url = httpret.ret.AccessPoint;//"http://localhost/SmartLife.CertManage.SmsServices";// if (strflag == "102" || strflag == "103" || strflag == "104") { HttpUtility.postSyncAsJSON(url + "/Oca/OldManLocateInfoService/CreateLocateByCall", null, new { LocateTime = item.reply_time, LongitudeS = arr[2], LatitudeS = arr[3] }.ToStringObjectDictionary(), new { ApplicationId = "CS001", Token = httpret.ret.Token, MobileNo = itemNo }.ToStringObjectDictionary(), (locret, locres) => { if ((bool)locret.Success) { sb_getSmsInfo.Append("成功插入" + itemNo + " : " + strflag + "," + arr[2] + "|" + arr[3] + "\r\n"); } }); } if (strflag == "105" || strflag == "104") { string reminderContent = (strflag == "104" ? "超出警戒范围报警" : "电压低于20%报警"); HttpUtility.postSyncAsJSON(url + "/Pub/ReminderService/CreateReminderByCall", null, new { LastTime = item.reply_time, SourceType = strflag, RemindContent = reminderContent }.ToStringObjectDictionary(), new { ApplicationId = "CS001", Token = httpret.ret.Token, MobileNo = itemNo }.ToStringObjectDictionary(), (remret, remres) => { if ((bool)remret.Success) { sb_getSmsInfo.Append("成功插入" + itemNo + " : " + strflag + "," + reminderContent + "\r\n"); } }); } } }); } this.UIInvoke(() => { if (this.tb_GetSms.Lines.Length > 1000) { int iline = tb_GetSms.GetFirstCharIndexFromLine(1); tb_GetSms.Text = tb_GetSms.Text.Remove(0, iline); } this.tb_GetSms.AppendText(sb_getSmsInfo.ToString()); sb_getSmsInfo.Remove(0, sb_getSmsInfo.Length); }); } } }); HttpUtility.postAsyncAsForm(smsEndPoint + "/replyConfirm.do", Encoding.Default, new { SpCode = orderDictionary["SpCode"], LoginName = orderDictionary["LoginName"], Password = BaseUtility.DecryptDES(orderDictionary["Password"]), id = lastReplyId }.ToStringObjectDictionary(), null, (ret, res) => { string requestweb = (string)ret; if (requestweb.Contains("result=0")) { sb_getSmsInfo.Append("上行回复内容确认成功! \r\n"); } this.UIInvoke(() => { if (this.tb_GetSms.Lines.Length > 1000) { int iline = tb_GetSms.GetFirstCharIndexFromLine(1); tb_GetSms.Text = tb_GetSms.Text.Remove(0, iline); } this.tb_GetSms.AppendText(sb_getSmsInfo.ToString()); sb_getSmsInfo.Remove(0, sb_getSmsInfo.Length); }); }); _tickTimer.Enabled = true; }); ////到达时间的时候执行事件; _tickTimer.AutoReset = true; //设置是执行一次(false)还是一直执行(true); _tickTimer.Enabled = true; //是否执行System.Timers.Timer.Elapsed事件; }