private void DoLogin(string userCode, string password) { // btnOk.Enabled = false; lblMsg.Text = "登录中"; _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事件; #if V2X byte runMode = byte.Parse(strRunMode);//测试1 正式0 string objectId = null; string objectName = null; TreeNode theSelectedNode = ctvObjectNodes.TreeView.SelectedNode; if (theSelectedNode != null && theSelectedNode.Name != "default") { objectId = theSelectedNode.Name; objectName = theSelectedNode.Text; } else { objectName = "自动"; } HttpAdapter.postAsyncAsJSON(authEndPoint, new { RunMode = runMode, ObjectId = objectId, UserCode = userCode, PasswordHash = MD5Provider.Generate(password) }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { MerchantVar.UserCode = userCode; MerchantVar.Password = password; MerchantVar.LoadV2X(ret.ret); INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, userCode, Common.INI_FILE_PATH); INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_ID_SINCE_LAST, (objectId ?? "default"), Common.INI_FILE_PATH); INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_OBJECT_NAME_SINCE_LAST, objectName, Common.INI_FILE_PATH); this.DialogResult = DialogResult.OK; this.Close(); } else { lblMsg.Text = ret.ErrorMessage; this.UIInvoke(() => { btnOk.Enabled = true; }); } _tickTimer.Enabled = false; _tickTimer = null; }); #else HttpAdapter.postAsyncAsJSON(authEndPoint + "/AuthenticateMerchant", new AuthMerchantParam { StationCode = userCode, PasswordHash = MD5Provider.Generate(password) }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { //MessageBoxAdapter.ShowDebug(_MonitorId.ToString()); //dynamic ret = new { Error = "", Success = false }; //ret = JsonConvert.DeserializeObject(result); MerchantVar.Load(userCode, ret.ret); if ((bool)ret.Success) { INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, userCode, Common.INI_FILE_PATH); this.DialogResult = DialogResult.OK; this.Close(); } else { lblMsg.Text = ret.ErrorMessage; this.UIInvoke(() => { btnOk.Enabled = true; }); } _tickTimer.Enabled = false; _tickTimer = null; }); #endif }
private void frmLogin_Load(object sender, EventArgs e) { //lblProductName.Text = Properties.Settings.Default.ProductName; //lblProductVersionComment.Text = Properties.Settings.Default.ProductVersionComment; #if V2X 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); 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); #else authEndPoint = INIAdapter.ReadValue(Common.INI_SECTION_WEB, Common.INI_KEY_AUTH_END_POINT, Common.INI_FILE_PATH); authDataPoint = INIAdapter.ReadValue(Common.CFG_SECTION_WEB, Common.CFG_KEY_AUTH_DATA_POINT, Common.CFG_FILE_PATH); #endif strUserNameSinceLast = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INI_KEY_USER_NAME_SINCE_LAST, Common.INI_FILE_PATH); strRunMode = INIAdapter.ReadValue(Common.INI_SECTION_LOCAL, Common.INT_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; txtPassword.Focus(); } }
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事件; }
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); }
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 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 frmSplash_Load(object sender, EventArgs e) { InitForm(); 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) { isBreak = false; } else { isBreak = true; this.DialogResult = System.Windows.Forms.DialogResult.Cancel; return(false); } } else { icAPI.ExitIC(); } isBreak = false; return(true); #endregion }, () => { #region 获取业务服务器地址 lblLoadItems.Text = _LoadItem = "获取业务服务器地址"; isBreak = false; Application.DoEvents(); if (string.IsNullOrEmpty(SettingsVar.DataExchangePoint)) { frmBindingPA frm = new frmBindingPA(); frm.ShowDialog(); if (frm.DialogResult != System.Windows.Forms.DialogResult.OK) { isBreak = true; this.DialogResult = System.Windows.Forms.DialogResult.Cancel; return(false); } else { this.Activate(); } } return(true); #endregion }, () => { #region 连接到业务服务器 lblLoadItems.Text = _LoadItem = "连接到业务服务器"; isBreak = false; Application.DoEvents(); int errorCode = 0; HttpAdapter.postSyncAsJSON(SettingsVar.DataExchangePoint + "/Pam/PamService/PADeviceBindingForSelfServiceTerminal", new { PACode = SettingsVar.BindingPACode, MachineKey = Common.MachineKey, Action = "check" }.ToStringObjectDictionary(), new { ApplicationId = Common.APPLICATION_ID }.ToStringObjectDictionary(), (ret, res) => { if (!(bool)ret.Success) { errorCode = (int)ret.ErrorCode; lblError.Text = ret.ErrorCode; } }); if (errorCode == 53010 || errorCode == 53011) { //设备未绑定或已解绑 frmBindingPA frm = new frmBindingPA(); frm.ShowDialog(); if (frm.DialogResult != System.Windows.Forms.DialogResult.OK) { isBreak = true; this.DialogResult = System.Windows.Forms.DialogResult.Cancel; return(false); } } else if (errorCode == 53012) { //失效 MessageBoxAdapter.ShowError("您的设备使用期已到,请联系管理员!"); isBreak = true; this.DialogResult = System.Windows.Forms.DialogResult.Cancel; return(false); } return(true); #endregion }, () => { #region 更新机构信息 lblLoadItems.Text = _LoadItem = "更新机构信息"; isBreak = false; Application.DoEvents(); HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/GetPAStationInfo", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { dynamic item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(ret.ret.ToString())); PAStationInfo stationInfo = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <PAStationInfo>(); SettingsVar.BindingPAName = stationInfo.StationName; INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_BINDING_PA_NAME, SettingsVar.BindingPAName, Common.INI_FILE_PATH); } 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/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>()); } } 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 }, () => { #region 更新课程数据 lblLoadItems.Text = _LoadItem = "更新课程数据"; isBreak = false; Application.DoEvents(); HttpAdapter.getSyncTo(SettingsVar.DataExchangePoint + "/Pam/PamService/LoadStationCourseList", null, new { ApplicationId = Common.APPLICATION_ID, PACode = SettingsVar.BindingPACode }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { Data.Courses = new List <CourseInfo>(); foreach (var row in ret.rows) { dynamic item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(row.ToString())); Data.Courses.Add((item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <CourseInfo>()); } //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 pnlAssistToolbarTitle_MouseUp(object sender, MouseEventArgs e) { INIAdapter.WriteValue(Common.INI_SECTION_LOCAL, Common.INT_KEY_ASSIST_TOOLBAR_POSITION_LAST, pnlAssistToolbarContainer.Location.X.ToString() + "," + pnlAssistToolbarContainer.Location.Y.ToString(), Common.INI_FILE_PATH); }