public static void Load(dynamic gov) { UserName = gov.UserName; CityId = gov.CityId; CityCode = gov.CityCode; CityName = gov.CityName; Area1 = gov.Area1; AreaCode1 = gov.AreaCode1; AreaName1 = gov.AreaName1; AccessPoint = gov.AccessPoint; AccessOfProvice = gov.AccessOfProvice; DataPointOfManage = gov.DataPointOfManage; AuthorizedModules = new List <dynamic>(); for (int i = 0; i < gov.AuthorizedModules.Count; i++) { AuthorizedModules.Add(gov.AuthorizedModules[i]); } HttpAdapter.getSyncTo(GovVar.DataPointOfManage + "/Sys/DatabaseConnectService/GetConnectId/" + GovVar.CityCode, (ret, res) => { if ((bool)ret.Success && ret.rows.Count > 0) { ConnectId = ret.rows[0].ConnectId.Value; } }); }
private void _DeleteWXButtonsToWeiXin(Action success, Action <int, string> fail) { string deleteCustomMenuUrl1 = string.Format(GlobalManager.TheWeiXinAPIOfV1[GlobalManager.APIGETKey_Cmu_DeleteCustomMenu], GlobalManager.TheServiceAccount.AccessToken); HttpAdapter.getSyncTo(deleteCustomMenuUrl1, (ret1, res1) => { int errCode1 = int.Parse(ret1.errcode.ToString()); string errMsg1 = ret1.errmsg.ToString(); if (errCode1 == 0) { if (success != null) { success(); } } else if (errCode1 == 42001 || errCode1 == 41001) { if (_RefreshAccessToken()) { string deleteCustomMenuUrl2 = string.Format(GlobalManager.TheWeiXinAPIOfV1[GlobalManager.APIGETKey_Cmu_DeleteCustomMenu], GlobalManager.TheServiceAccount.AccessToken); HttpAdapter.getSyncTo(deleteCustomMenuUrl2, (ret2, res2) => { int errCode2 = int.Parse(ret2.errcode.ToString()); string errMsg2 = ret2.errmsg.ToString(); if (errCode2 == 0) { if (success != null) { success(); } } else { if (fail != null) { fail(errCode2, errMsg2); } } }); } else { if (fail != null) { fail(GlobalManager.ERR_RefreshAccessTokenFaild, "刷新AccessToken失败"); } } } else { if (fail != null) { fail(errCode1, errMsg1); } } }); }
private void FetchData() { if (!isFetchingData) { if (datas == null) { datas = new List <WorkOrderInfo>(); } else { datas.Clear(); } new Action(() => { isFetchingData = true; if (MerchantVar.CurrentMerchant.AuthNodeInfos.Count > 0) { foreach (var nodeInfo in MerchantVar.CurrentMerchant.AuthNodeInfos) { //string url = nodeInfo.AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/GetWorkOrderToResponse"; string url = nodeInfo.AccessPoint + "/Oca/WorkOrderService/GetWorkOrderToResponse"; HttpAdapter.getSyncTo(url, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = nodeInfo.StationId }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { foreach (var row in ret.rows) { dynamic item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(row.ToString())); WorkOrderInfo dataItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <WorkOrderInfo>(); dataItem.DoStatusName = WorkOrderInfo.getDoStatusName(int.Parse(item.StringObjectDictionary.DoStatus)); dataItem.AccessPoint = nodeInfo.AccessPoint; dataItem.StationId = nodeInfo.StationId; datas.Add(dataItem); } } }); } } }).BeginInvoke(new AsyncCallback((ar) => { //AsyncResult result = (AsyncResult)ar; this.UIInvoke(() => { xLoadingPanel.Stop(); xSource.DataSource = datas; xSource.ResetBindings(false); }); isFetchingData = false; }), null); xLoadingPanel.Start(); } }
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; } }
public static dynamic getDictionaryItemList(string dictionaryItem) { string url = GovVar.DataPointOfManage + "/Share/AjaxData/GetDictionaryItem/" + dictionaryItem; dynamic dyDictionaryItem = null; HttpAdapter.getSyncTo(url, (ret, res) => { dyDictionaryItem = ret; }); return(dyDictionaryItem); }
//public static ArrayList getStreetAndCommunityInArea(string parentId, int levels) //{ // string url = GovVar.DataPointOfManage + "/Share/AjaxData/GetStreetAndCommunityInArea/" + parentId; // ArrayList arrList=new ArrayList(); // HttpAdapter.getSyncTo(url, (ret, res) => // { // foreach (var row in ret) { // if (row.Levels.Value == levels) { // arrList.Add(row); // } // } // }); // return arrList; //} public static dynamic getStreetAndCommunity(string parentId) { string url = GovVar.DataPointOfManage + "/Share/AjaxData/GetStreetAndCommunityInArea/" + parentId; dynamic dyStreetAndCommunity = null; HttpAdapter.getSyncTo(url, (ret, res) => { dyStreetAndCommunity = ret; }); return(dyStreetAndCommunity); }
//针对变化的格式 private void _RefreshWXUserInfo(string openId, Action <dynamic> success, Action <int, string> fail) { string getInfoOfNormalAccountUrl1 = string.Format(GlobalManager.TheWeiXinAPIOfV1[GlobalManager.APIGETKey_Meb_GetInfoOfNormalAccount], GlobalManager.TheServiceAccount.AccessToken, openId); HttpAdapter.getSyncTo(getInfoOfNormalAccountUrl1, (ret1, res1) => { if (ret1.errcode == null) { if (success != null) { success(ret1); } } else { int errCode = int.Parse(ret1.errcode.ToString()); string errMsg = ret1.errmsg.ToString(); if (errCode == 42001 || errCode == 41001) { //AccessToken过期或缺失 if (_RefreshAccessToken()) { string getInfoOfNormalAccountUrl2 = string.Format(GlobalManager.TheWeiXinAPIOfV1[GlobalManager.APIGETKey_Meb_GetInfoOfNormalAccount], GlobalManager.TheServiceAccount.AccessToken, openId); HttpAdapter.getSyncTo(getInfoOfNormalAccountUrl2, (ret2, res2) => { if (ret2.errcode == null) { if (success != null) { success(ret2); } } }); } else { if (fail != null) { fail(GlobalManager.ERR_RefreshAccessTokenFaild, "刷新AccessToken失败"); } } } else { if (fail != null) { fail(errCode, errMsg); } } } }); }
private bool _RefreshAccessToken() { string accessTokenUrl = string.Format(GlobalManager.TheWeiXinAPIOfV1[GlobalManager.APIGETKey_Bas_GetAccessToken], GlobalManager.TheServiceAccount.AppId, GlobalManager.TheServiceAccount.AppSecret); HttpAdapter.getSyncTo(accessTokenUrl, (ret, res) => { GlobalManager.TheServiceAccount.AccessToken = ret.access_token; BuilderFactory.DefaultBulder(GlobalManager.getConnectString()).Update <ServiceAccount>(new ServiceAccount { AccountCode = GlobalManager.TheServiceAccount.AccountCode, AccessToken = ret.access_token }); }); return(true); }
public Stream GetRemoteDataAsJSONP(string remoteUrl, string callback) { InvokeResult <string> result = new InvokeResult <string> { Success = true }; HttpAdapter.getSyncTo(remoteUrl, (ret, res) => { result.ret = JsonConvert.DeserializeObject(ret).ToString(); }); byte[] resultBytes = Encoding.UTF8.GetBytes(callback + "(" + result.ToJson() + ")"); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(resultBytes)); }
public Stream QueueMemberList(IpccQueue ipccQueue) { InvokeResult <string> result = new InvokeResult <string> { Success = true }; if (!string.IsNullOrEmpty(ipccQueue.RemoteUrl)) { IList <StringObjectDictionary> queueMembers = new List <StringObjectDictionary>(); if (ipccQueue.QueueNames != null && ipccQueue.QueueNames.Count > 0) { try { foreach (string item in ipccQueue.QueueNames) { HttpAdapter.getSyncTo(ipccQueue.RemoteUrl + item, (ret, res) => { dynamic agent = JsonConvert.DeserializeObject(ret); if (agent.success == "true" && agent.data != null) { foreach (var key in agent.data) { queueMembers.Add(new { queueName = item, uuid = key.uuid, cid_number = key.cid_number, cid_name = key.cid_name, join_time = key.join_time }.ToStringObjectDictionary()); } } }); } if (queueMembers.Count > 0) { result.ret = JsonConvert.SerializeObject(queueMembers); } else { result.ret = ""; } } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.ToString(); } } } byte[] resultBytes = Encoding.UTF8.GetBytes(result.ToJson()); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(resultBytes)); }
public Stream GetOpenIdByOAuth2AsJSONP(string code, string callback) { InvokeResult <string> result = new InvokeResult <string> { Success = true }; string accessTokenUrl = string.Format(GlobalManager.TheWeiXinAPIOfV1[GlobalManager.APIGETKey_OAuth2_GetAccessToken], GlobalManager.TheServiceAccount.AppId, GlobalManager.TheServiceAccount.AppSecret, code); HttpAdapter.getSyncTo(accessTokenUrl, (ret, res) => { result.ret = JsonConvert.DeserializeObject(ret).openid.ToString(); }); byte[] resultBytes = Encoding.UTF8.GetBytes(callback + "(" + result.ToJson() + ")"); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(resultBytes)); }
public InvokeResult <string> GetOpenIdByOAuth2(string code) { InvokeResult <string> result = new InvokeResult <string> { Success = true }; string accessTokenUrl = string.Format(GlobalManager.TheWeiXinAPIOfV1[GlobalManager.APIGETKey_OAuth2_GetAccessToken], GlobalManager.TheServiceAccount.AppId, GlobalManager.TheServiceAccount.AppSecret, code); GlobalManager.inputLogger.Info("GetOpenIdByOAuth2 invoke:" + accessTokenUrl); HttpAdapter.getSyncTo(accessTokenUrl, (ret, res) => { GlobalManager.inputLogger.Info("GetOpenIdByOAuth2 result: in "); result.ret = JsonConvert.DeserializeObject(ret).openid.ToString(); }); GlobalManager.inputLogger.Info("GetOpenIdByOAuth2 result:" + result.ret); return(result); }
private bool checkIDNo() { bool result = false; string strIDNo = txbIDNo.Text.Trim(); //新增和修改之前查看身份证号位数是否正确 if ((strIDNo.Length != 15) && (strIDNo.Length != 18)) { //MessageBox.Show("输入的身份证号位数错误"); } else { HttpAdapter.getSyncTo(GovVar.DataPointOfManage + "/Bas/ResidentBaseInfoService/IDNoDuplicatesForCS", null, new { ConnectId = GovVar.ConnectId, IDNo = strIDNo, Status = 0 }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success.Value) { string strResidentId = lblResidentId.Text; string strOldManName = ""; for (int i = 0; i < ret.rows.Count; i++) { dynamic item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(ret.rows[i].ToString())); ResidentBaseInfo dtItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <ResidentBaseInfo>(); if (dtItem.ResidentId.ToLower() != strResidentId.ToLower()) { strOldManName += dtItem.ResidentName; } } if (strOldManName == "") { result = true; } else { MessageBox.Show(strOldManName + "已使用此身份证号码"); } } else { MessageBox.Show("身份证号码验证失败"); } }); } return(result); }
private void _FetchServiceWorkOrderContinuously() { _FetchServiceWorkOrderThread = ThreadAdapter.DoCircleTask( () => { #region 执行任务=》获取需要同步到其他系统的工单 dOnAppendToOutput dc = new dOnAppendToOutput(_OnAppendToOutput); this.Invoke(dc, new object[] { "获取需要同步到其他系统的工单..." }); //同步请求 string url = _SourceAddress + "/p12/c07/A01/GetSyncOutWorkOrders"; HttpAdapter.getSyncTo(url, (result, response) => { if ((bool)result.Success) { this.Invoke(dc, new object[] { string.Format("###获取工单成功:{0}条 ", result.rows.Count) }); foreach (var row in result.rows) { queues.Enqueue(row); } } else { this.Invoke(dc, new object[] { string.Format("#####获取工单出错:{0} ", result.ErrorMessage) }); } }); #endregion }, 1000,//1秒执行一次 () => { return(!isEnableFetchServiceWorkOrder); }, //没有允许取数据则停止 () => { return(queues.Count > 0 || isPauseFetchServiceWorkOrder); } //当数据队列不为空则跳过 ); }
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 ReloadBookMeals() { this.UIDoOnceTask(() => { 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("更新配餐信息成功!"); } else { lblTip.Text = "更新配餐信息失败:" + (string)ret.ErrorCode; } }); }); }
public Stream GetRemoteData(Remote remote) { InvokeResult <string> result = new InvokeResult <string> { Success = true }; if (remote != null && !string.IsNullOrEmpty(remote.RemoteUrl)) { HttpAdapter.getSyncTo(remote.RemoteUrl, (ret, res) => { if (remote.RetType == "json") { result.ret = JsonConvert.DeserializeObject(ret).ToString(); } else { result.ret = ret.ToString(); } }); } byte[] resultBytes = Encoding.UTF8.GetBytes(result.ToJson()); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(resultBytes)); }
private void FetchReminderData() { if (MerchantVar.CurrentMerchant.AuthNodeInfos.Count > 0) { foreach (var nodeInfo in MerchantVar.CurrentMerchant.AuthNodeInfos) { string url = nodeInfo.AccessPoint + "/Pub/ReminderService/GetReminderStatGroupBySourceType"; if (SettingsVar.CurrentRemindType == RemindType.详细信息) { url = nodeInfo.AccessPoint + "/Pub/ReminderService/GetReminderItems"; } url += "/Oca_ServiceWorkOrder,WorkOrderId"; HttpAdapter.getSyncTo(url, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationId = nodeInfo.StationId }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { foreach (var row in ret.rows) { dynamic item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(row.ToString())); if (SettingsVar.CurrentRemindType == RemindType.详细信息) { WorkOrderReminderInfo dataItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <WorkOrderReminderInfo>(); if (queuesOfWorkOrderReminderInfo.Count(it => it.SourceType == dataItem.SourceType && it.SourceKey == dataItem.SourceKey) == 0) { //不存在 dataItem.AccessPoint = nodeInfo.AccessPoint; dataItem.StationId = nodeInfo.StationId; queuesOfWorkOrderReminderInfo.Enqueue(dataItem); } } else if (SettingsVar.CurrentRemindType == RemindType.统计信息) { WorkOrderReminderStatInfo dataItem = (item.StringObjectDictionary as IDictionary <string, object>).FromDynamic <WorkOrderReminderStatInfo>(); if (queuesOfWorkOrderReminderStatInfo.Count(it => it.SourceType == dataItem.SourceType) == 0) { dataItem.AccessPoint = nodeInfo.AccessPoint; dataItem.StationId = nodeInfo.StationId; queuesOfWorkOrderReminderStatInfo.Enqueue(dataItem); } else { WorkOrderReminderStatInfo xItem = queuesOfWorkOrderReminderStatInfo.SingleOrDefault(it => it.SourceType == dataItem.SourceType); if (xItem != null) { if (xItem.StationId == nodeInfo.StationId) { xItem.ReminderNum = dataItem.ReminderNum; } else { //不同区域 dataItem.AccessPoint = nodeInfo.AccessPoint; dataItem.StationId = nodeInfo.StationId; queuesOfWorkOrderReminderStatInfo.Enqueue(dataItem); } } } } } } }); } } }
private void FetchData() { new Action(() => { //string url = AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId; string url = AccessPoint + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId; HttpAdapter.getSyncTo(url, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = StationId }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(ret.ret.ToString())); LastError = null; } else { LastError = ret.ErrorMessage; } }); }).BeginInvoke(new AsyncCallback((ar) => { //AsyncResult result = (AsyncResult)ar; this.UIInvoke(() => { if (item != null) { int doStatus = int.Parse(item.StringObjectDictionary.DoStatus); IDictionary <string, object> dataItem = (item.StringObjectDictionary as IDictionary <string, object>); lblWorkOrderNo.Text = item.StringObjectDictionary.WorkOrderNo; lblOperatedByName.Text = item.StringObjectDictionary.OperatedByName; lblDoStatus.Text = WorkOrderInfo.getDoStatusName(doStatus); foreach (var key in dataItem.Keys) { Control[] controlsOfInfo = tlpInfo.Controls.Find("lbl" + key, true); if (controlsOfInfo.Length == 1) { (controlsOfInfo[0] as Label).Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]); if (key == "Gender") { (controlsOfInfo[0] as Label).Text = WorkOrderInfo.getGenderName(e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key])); } else if (key == "ServeFee" || key == "ServeFeeByGov" || key == "ServeFeeBySelf") { if (e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) != "") { (controlsOfInfo[0] as Label).Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) + "/小时"; } } } } } xLoadingPanel.Stop(); if (!string.IsNullOrEmpty(LastError)) { MessageBoxAdapter.ShowError(LastError); } }); }), null); xLoadingPanel.Start(); }
private void FetchData() { if (string.IsNullOrEmpty(stationId)) { return; } new Action(() => { if (!string.IsNullOrEmpty(stationId)) { string url = MerchantVar.CurrentMerchant.AuthNodeInfos.FirstOrDefault(s => s.StationId.ToString() == stationId).AccessPoint; if (!string.IsNullOrEmpty(url)) { //url = url.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/MerchantService/"; url = url + "/Oca/MerchantService/"; HttpAdapter.getSyncTo(url + stationId, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success && ret.instance != null && ret.instance.StationId != null) { item = ret.instance; LastError = null; } else { LastError = ret.ErrorMessage; } }); HttpAdapter.getSyncTo(url + "GetServeModes/" + stationId, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode }.ToStringObjectDictionary(), (ret, res) => { serverModeType = ret; }); HttpAdapter.getSyncTo(url + "GetServeItems/" + stationId, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode }.ToStringObjectDictionary(), (ret, res) => { serverItemType = ret; }); } } }).BeginInvoke(new AsyncCallback((ar) => { this.UIInvoke(() => { if (item != null) { foreach (var key in item) { if (pnlAcceptType.Name == ("pnl" + (string)key.Name)) { IEnumerable <CheckBox> cbxsAcceptType = pnlAcceptType.Controls.OfType <CheckBox>(); string[] cbxs = e0571.web.core.Utils.TypeConverter.ChangeString(key.Value).Split(','); if (cbxs.Length > 0) { foreach (var cbx in cbxsAcceptType) { foreach (string cb in cbxs) { if (cbx.Name == "cbx" + cb + "Of11019") { cbx.Checked = true; continue; } } } } } if (pnlSettlementPeriod.Name == ("pnl" + (string)key.Name)) { IEnumerable <RadioButton> rbsSettlementPeriod = pnlSettlementPeriod.Controls.OfType <RadioButton>(); foreach (var rb in rbsSettlementPeriod) { if (rb.Name == "rb" + e0571.web.core.Utils.TypeConverter.ChangeString(key.Value) + "Of00014") { rb.Checked = true; break; } } } if (pnlSettlementMode.Name == ("pnl" + (string)key.Name)) { IEnumerable <RadioButton> rbsSettlementMode = pnlSettlementMode.Controls.OfType <RadioButton>(); foreach (var rb in rbsSettlementMode) { if (rb.Name == "rb" + e0571.web.core.Utils.TypeConverter.ChangeString(key.Value) + "Of11025") { rb.Checked = true; break; } } } if (pnlWorkDay.Name == ("pnl" + (string)key.Name)) { IEnumerable <CheckBox> cbxsWorkDay = pnlWorkDay.Controls.OfType <CheckBox>(); string[] cbxs = e0571.web.core.Utils.TypeConverter.ChangeString(key.Value).Split(','); if (cbxs.Length > 0) { foreach (var cbx in cbxsWorkDay) { foreach (string cb in cbxs) { if (cbx.Name == "cbx_Day_" + cb) { cbx.Checked = true; continue; } } } } } if (dtpServeTimeBeginOfDay.Name == ("dtp" + (string)key.Name)) { dtpServeTimeBeginOfDay.Text = e0571.web.core.Utils.TypeConverter.ChangeString(key.Value); } if (dtpServeTimeEndOfDay.Name == ("dtp" + (string)key.Name)) { dtpServeTimeEndOfDay.Text = e0571.web.core.Utils.TypeConverter.ChangeString(key.Value); } if (txtServeTimeOfDayDescription.Name == ("txt" + (string)key.Name)) { txtServeTimeOfDayDescription.Text = e0571.web.core.Utils.TypeConverter.ChangeString(key.Value); } if (txtServeExtraComment.Name == ("txt" + (string)key.Name)) { txtServeExtraComment.Text = e0571.web.core.Utils.TypeConverter.ChangeString(key.Value); } } } if (serverModeType != null) { IEnumerable <CheckBox> cbxModeTypes = tabPage2.Controls.OfType <CheckBox>(); CheckBox cbxModeItem; foreach (var modeitem in serverModeType) { cbxModeItem = cbxModeTypes.FirstOrDefault(s => s.Name.IndexOf((string)modeitem.ServeMode) > -1); if (cbxModeItem != null) { cbxModeItem.Checked = true; } } } if (serverItemType != null) { serveControlList.Clear(); dymicFindControl(tlpServerItem); string name = ""; string txt = ""; foreach (var key in serverItemType) { name = (string)key.ServeItemB; txt = (string)key.ServeFee; foreach (var c in serveControlList) { if (c is CheckBox) { if (((CheckBox)c).Name.IndexOf(name) > -1) { ((CheckBox)c).Checked = true; } } if (c is UnderlineTextBox) { if (((UnderlineTextBox)c).Name.IndexOf(name) > -1) { ((UnderlineTextBox)c).Text = txt; } } } } } xLoadingPanel.Stop(); if (!string.IsNullOrEmpty(LastError)) { MessageBoxAdapter.ShowError(LastError); } }); }), null); xLoadingPanel.Start(); }
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); }); }
public Stream QueueAgentList(IpccQueue ipccQueue) { InvokeResult <string> result = new InvokeResult <string> { Success = true }; if (!string.IsNullOrEmpty(ipccQueue.RemoteUrl)) { IList <StringObjectDictionary> queueAgents = new List <StringObjectDictionary>(); if (ipccQueue.QueueNames != null && ipccQueue.QueueNames.Count > 0) { try { string agent_no = ""; foreach (string item in ipccQueue.QueueNames) { HttpAdapter.getSyncTo(ipccQueue.RemoteUrl + item, (ret, res) => { dynamic agent = JsonConvert.DeserializeObject(ret); if (agent.success == "true" && agent.data != null) { StringObjectDictionary sod; foreach (var key in agent.data) { agent_no = (string)key.agent_no; sod = queueAgents.FirstOrDefault(s => s["agent_no"].Equals(agent_no)); if (sod == null) { sod = new StringObjectDictionary(); sod.Add("agent_no", agent_no); sod.Add("uuid", key.uuid); sod.Add("status", key.status); sod.Add("cause", key.cause); sod.Add("state", key.state); sod.Add("last_offered_call", key.last_offered_call); sod.Add("last_status_change", key.last_status_change); sod.Add("no_answer_count", key.no_answer_count); sod.Add("answer_count", key.answer_count); sod.Add("ext", (item.IndexOf("999") > -1 ? 1 : 0)); sod.Add("queueName", new List <string>() { item }); queueAgents.Add(sod); } else { List <string> queueNames = (List <string>)sod.First(s => s.Key == "queueName").Value; if (queueNames != null) { queueNames.Add(item); } } } } }); } if (queueAgents.Count > 0) { result.ret = JsonConvert.SerializeObject(queueAgents); } else { result.ret = ""; } } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.ToString(); } } } byte[] resultBytes = Encoding.UTF8.GetBytes(result.ToJson()); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(resultBytes)); }
public Stream GetConferenceInfo(ConferenceInfo conferenceInfo) { InvokeResult <string> result = new InvokeResult <string> { Success = true }; if (!string.IsNullOrEmpty(conferenceInfo.ConferenceUrl)) { HttpAdapter.getSyncTo(conferenceInfo.ConferenceUrl, (ret, res) => { if (string.IsNullOrEmpty(conferenceInfo.ConferenceMemberUrl)) { result.ret = JsonConvert.DeserializeObject(ret).ToString(); //未获得获取会议室成员的URL,直接返回会议室列表 } else { List <StringObjectDictionary> conferencelist = new List <StringObjectDictionary>(); var conf_data = JsonConvert.DeserializeObject(ret); if ((bool)conf_data.success && conf_data.data != null) { StringObjectDictionary conference; foreach (var item in conf_data.data) { string confname = (string)item.conf_name; if (confname.IndexOf(conferenceInfo.ExtCode) > -1) //过滤出属于当前区域的会议室 { conference = new StringObjectDictionary(); conference.Add("conf_name", confname); conference.Add("uuid", item.uuid); conference.Add("members", item.members); conference.Add("runtimes", item.runtimes); string url = conferenceInfo.ConferenceMemberUrl + "&confname=" + confname; HttpAdapter.getSyncTo(url, (ret2, res2) => { var conf_data2 = JsonConvert.DeserializeObject(ret2); if (conf_data2.success == "true" && conf_data2.data != null) { List <StringObjectDictionary> sodlist = new List <StringObjectDictionary>(); StringObjectDictionary conferenceMember; foreach (var o in conf_data2.data) { conferenceMember = new StringObjectDictionary(); conferenceMember.Add("id", o.id); conferenceMember.Add("uuid", o.uuid); conferenceMember.Add("caller_name", o.caller_name); conferenceMember.Add("caller_number", o.caller_number); conferenceMember.Add("join_time", o.join_time); conferenceMember.Add("last_talking", o.last_talking); sodlist.Add(conferenceMember); } conference.Add("member_data", sodlist.ToArray()); } }); conferencelist.Add(conference); } } if (conferencelist.Count > 0) { result.ret = JsonConvert.SerializeObject(new { data = conferencelist }.ToStringObjectDictionary()); } else { result.ret = ""; } } } }); } byte[] resultBytes = Encoding.UTF8.GetBytes(result.ToJson()); WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; return(new MemoryStream(resultBytes)); }
private void FetchData() { new Action(() => { //string url = AccessPoint.Replace("http://115.236.175.110:17000/merchantservices", "http://localhost/SmartLife.CertManage.MerchantServices") + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId; string url = AccessPoint + "/Oca/WorkOrderService/GetWorkOrderInfo/" + WorkOrderId; HttpAdapter.getSyncTo(url, null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode, StationId = StationId }.ToStringObjectDictionary(), (ret, res) => { if ((bool)ret.Success) { item = new ExpandoObject(); DynamicAdapter.Parse(item, XElement.Parse(ret.ret.ToString())); LastError = null; } else { LastError = ret.ErrorMessage; } }); }).BeginInvoke(new AsyncCallback((ar) => { //AsyncResult result = (AsyncResult)ar; this.UIInvoke(() => { if (item != null) { int doStatus = int.Parse(item.StringObjectDictionary.DoStatus); IDictionary <string, object> dataItem = (item.StringObjectDictionary as IDictionary <string, object>); if (doStatus > 0 && doStatus < 4) { if (e0571.web.core.Utils.TypeConverter.ChangeString(dataItem["ServeResult"]) == "" || e0571.web.core.Utils.TypeConverter.ChangeString(dataItem["FeedbackToOldMan"]) == "" ) { //处置督办 txtServeManName.Visible = true; dtpServeBeginTime.Visible = true; dtpServeEndTime.Visible = true; IEnumerable <RadioButton> rbsOfServeResultName = pnlServeResultName.Controls.OfType <RadioButton>(); foreach (var rb in rbsOfServeResultName) { rb.Visible = true; } txtServeResultRemark.Visible = true; IEnumerable <RadioButton> rbsOfFeedbackToOldManName = pnlFeedbackToOldManName.Controls.OfType <RadioButton>(); foreach (var rb in rbsOfFeedbackToOldManName) { rb.Visible = true; } txtFeedbackRemarkToOldMan.Visible = true; } } else if (doStatus == 4) { btnOK.Visible = false; } else { btnPrint.Visible = false; btnOK.Text = "响应"; } lblWorkOrderNo.Text = item.StringObjectDictionary.WorkOrderNo; lblDoStatus.Text = WorkOrderInfo.getDoStatusName(doStatus); foreach (var key in dataItem.Keys) { Control[] controlsOfInfo = tlpInfo.Controls.Find("lbl" + key, true); if (controlsOfInfo.Length == 1) { (controlsOfInfo[0] as Label).Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]); if (key == "Gender") { (controlsOfInfo[0] as Label).Text = WorkOrderInfo.getGenderName(e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key])); } } //查找process内的主动控件 if (txtServeManName.Visible && txtServeManName.Name == ("txt" + key)) { txtServeManName.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]); txtServeManName.BackColor = Color.LightGreen; } if (dtpServeBeginTime.Visible && dtpServeBeginTime.Name == ("dtp" + key)) { dtpServeBeginTime.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]); } if (dtpServeEndTime.Visible && dtpServeEndTime.Name == ("dtp" + key)) { dtpServeEndTime.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]); } if (pnlServeResultName.Name == ("pnl" + key + "Name")) { IEnumerable <RadioButton> rbsOfServeResult = pnlServeResultName.Controls.OfType <RadioButton>().Where(x => x.Visible == true); if (rbsOfServeResult.Count() > 0) { pnlServeResultName.BackColor = Color.LightGreen; } foreach (var rb in rbsOfServeResult) { if (rb.Name == "rb" + e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) + "Of11016") { rb.Checked = true; break; } } } if (txtServeResultRemark.Visible && txtServeResultRemark.Name == ("txt" + key)) { txtServeResultRemark.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]); } if (pnlFeedbackToOldManName.Name == ("pnl" + key + "Name")) { IEnumerable <RadioButton> rbsOfReturnVisit = pnlFeedbackToOldManName.Controls.OfType <RadioButton>().Where(x => x.Visible == true); if (rbsOfReturnVisit.Count() > 0) { pnlFeedbackToOldManName.BackColor = Color.LightGreen; } foreach (var rb in rbsOfReturnVisit) { if (rb.Name == "rb" + e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]) + "Of11017") { rb.Checked = true; break; } } } if (txtFeedbackRemarkToOldMan.Visible && txtFeedbackRemarkToOldMan.Name == ("txt" + key)) { txtFeedbackRemarkToOldMan.Text = e0571.web.core.Utils.TypeConverter.ChangeString(dataItem[key]); } } } xLoadingPanel.Stop(); if (!string.IsNullOrEmpty(LastError)) { MessageBoxAdapter.ShowError(LastError); } }); }), null); xLoadingPanel.Start(); }
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 InitFormInfo() { string url = ""; //if (MerchantVar.CurrentMerchant.AuthNodeInfos.Count > 0) //{ // foreach (var nodeInfo in MerchantVar.CurrentMerchant.AuthNodeInfos) // { // if (nodeInfo.StationId.ToString() != stationid) // { // continue; // } // url = nodeInfo.AccessPoint ; // } //} if (MerchantVar.CurrentMerchant.AuthNodeInfos.Count > 0) { url = MerchantVar.CurrentMerchant.AuthNodeInfos.FirstOrDefault(s => s.StationId != null).AccessPoint; } //url = "http://localhost/SmartLife.CertManage.MerchantServices"; if (url != "") { new Action(() => { HttpAdapter.getSyncTo(url + "/Share/AjaxData/GetDictionaryItem/11012", null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode }.ToStringObjectDictionary(), (ret, res) => { serveItemA = ret; }); HttpAdapter.getSyncTo(url + "/Share/AjaxData/GetDictionaryItem/11013", null, new { ApplicationId = Common.APPLICATION_ID, Token = MerchantVar.CurrentMerchant.Token, StationCode = MerchantVar.StationCode }.ToStringObjectDictionary(), (ret, res) => { serveItemB = ret; }); }).BeginInvoke(new AsyncCallback((ar) => { this.UIInvoke(() => { if (serveItemA != null && serveItemB != null) { List <CheckBox> itemBList; List <UnderlineTextBox> txtBList; CheckBox cbxItem; UnderlineTextBox txtItem; int iRow = 1; foreach (var itemA in serveItemA) { itemBList = new List <CheckBox>(); txtBList = new List <UnderlineTextBox>(); int iflag = 0; int iRowHeight = 0; foreach (var itemB in serveItemB) { if (((string)itemB.ItemCode).Substring(0, 2) == (string)itemA.ItemCode) { //文本框 txtItem = new UnderlineTextBox(); txtItem.Name = "txt" + (string)itemB.ItemId + "of" + (string)itemA.ItemCode; txtItem.Text = "0"; txtItem.Visible = false; //复选框 cbxItem = new CheckBox(); cbxItem.AutoSize = true; cbxItem.Name = "cbx" + (string)itemB.ItemId + "of" + (string)itemA.ItemCode; cbxItem.Text = (string)itemB.ItemName; //cbxItem.Width = 180; iRowHeight = 6 + 24 * iflag; if (itemBList.Count % 2 == 0) { cbxItem.Location = new Point(6, iRowHeight); txtItem.Location = new Point(29 + cbxItem.Width, iRowHeight); } else { cbxItem.Location = new Point(176, iRowHeight); txtItem.Location = new Point(209 + cbxItem.Width + txtItem.Width, iRowHeight); iflag++; } cbxItem.CheckedChanged += cbxAll_CheckedChanged; itemBList.Add(cbxItem); txtBList.Add(txtItem); } } tlpServerItem.RowStyles.Clear(); tlpServerItem.RowStyles.Add(new RowStyle(SizeType.AutoSize)); Panel pItem = new Panel(); pItem.Name = "pnlServerItemA" + (string)itemA.ItemCode; pItem.Dock = DockStyle.Fill; pItem.AutoSize = true; tlpServerItem.Controls.Add(pItem, 0, iRow); cbxItem = new CheckBox(); cbxItem.AutoSize = true; cbxItem.Name = "cbx" + (string)itemA.ItemId + "of" + (string)itemA.ItemCode; cbxItem.Text = (string)itemA.ItemName; cbxItem.Dock = DockStyle.Fill; cbxItem.CheckedChanged += cbxAll_CheckedChanged; pItem.Controls.Add(cbxItem); pItem = new Panel(); pItem.Name = "pnlServerItemB" + (string)itemA.ItemCode; pItem.Height = 24 * ((itemBList.Count % 2) == 0 ? (itemBList.Count / 2) : (itemBList.Count / 2 + 1)); pItem.Dock = DockStyle.Fill; tlpServerItem.Controls.Add(pItem, 1, iRow); pItem.Controls.AddRange(itemBList.ToArray()); pItem.Controls.AddRange(txtBList.ToArray()); iRow++; } } xLoadingPanel.Stop(); }); }), null); xLoadingPanel.Start(); } }
//发送短信 private void _LoopForSendSms() { SendSms_CircleThread = ThreadAdapter.DoCircleTask(() => { string strUrl, strToken, strNodeId; foreach (var item in smsPointDic) { strUrl = item.Value.Url; strToken = item.Value.Token; strNodeId = item.Value.NodeId; HttpAdapter.getSyncTo(strUrl + "/Pub/SmsSendService/QueuedUnSendSms", null, new { ApplicationId = "CS001", Token = strToken, NodeId = strNodeId }.ToStringObjectDictionary(), (smsret, smsres) => { if ((bool)smsret.Success) { StringObjectDictionary sod; IDictionary <string, object> dic; string strItem = ""; DateTime scheduleTime = DateTime.Now; foreach (var row in smsret.rows) { sod = new StringObjectDictionary(); dynamic list = new ExpandoObject(); DynamicAdapter.Parse(list, System.Xml.Linq.XElement.Parse(row.ToString())); dic = list.StringObjectDictionary; strItem = e0571.web.core.Utils.TypeConverter.ChangeString(dic["SendCatalog"]); if (strItem == "0") { sod = sod.Union2(txtDictionary.ToStringObjectDictionary()); } strItem = e0571.web.core.Utils.TypeConverter.ChangeString(dic["Mobiles"]); if (string.IsNullOrEmpty(strItem)) { continue; } //跳过 sod.Add("UserNumber", strItem); //是否有预约时间 是-转化yyyyMMddHHmmss;否-空 strItem = e0571.web.core.Utils.TypeConverter.ChangeString(dic["ScheduleTime"], ""); sod.Add("ScheduleTime", strItem); if (!string.IsNullOrEmpty(strItem)) { if (DateTime.TryParse(strItem, out scheduleTime)) { sod["ScheduleTime"] = scheduleTime.ToString("yyyyMMddHHmmss"); } } strItem = e0571.web.core.Utils.TypeConverter.ChangeString(dic["SendContent"]); sod.Add("MessageContent", HttpUtility.UrlEncode(strItem, Encoding.GetEncoding("GBK"))); //批次号 strItem = e0571.web.core.Utils.TypeConverter.ChangeString(dic["BatchNum"]); sod.Add("SerialNumber", strItem); //发送HttpAdapter.postSyncAsForm Common.postSyncAsForm(smsEndPoint + "/Send.do", sod, null, (ret, res) => { Dictionary <string, string> retdict = Common.StrToDictionary(ret, '&'); if (retdict["result"] == "0") { this.Invoke(new Action <string, string>((p1, p2) => { lb_Send.Items.Add("[" + p1 + "] 成功发送 [" + p2 + "]"); }), new object[] { sod["UserNumber"], HttpUtility.UrlDecode((string)sod["MessageContent"], Encoding.GetEncoding("GBK")) }); //需要回执的短信 StringObjectDictionary sod2; if (!sendSmsDic.TryGetValue(strItem, out sod2)) { sod2 = new { SmsNodeId = strNodeId, SmsToken = strToken, SmsUrl = strUrl }.ToStringObjectDictionary(); sendSmsDic.TryAdd(strItem, sod2); } //更新成功发送数据 UpdateSmsSendStatus(new { Status = 1, Mobiles = ((string)sod["UserNumber"]), BatchNum = sod["SerialNumber"] }.ToStringObjectDictionary(), strUrl, strToken, strNodeId, 0); //发送成功 检查是否有发送失败数据 if (!string.IsNullOrEmpty(retdict["faillist"])) { string[] strMobiles = retdict["faillist"].Split(','); string mobiles = "'" + string.Join("','", strMobiles.Where(s => !string.IsNullOrEmpty(s))) + "'"; this.Invoke(new Action <string>(p1 => { lb_Send.Items.Add("[" + p1 + "] 无效号码"); }), new object[] { retdict["faillist"] }); UpdateSmsSendStatus(new { Status = 2, Mobiles = mobiles, BatchNum = sod["SerialNumber"] }.ToStringObjectDictionary(), strUrl, strToken, strNodeId, 0); } } else { this.Invoke(new Action <string, string>((p1, p2) => { lb_Send.Items.Add("[" + p1 + "] 发送失败[" + (smsRetCodeDic.ContainsKey(p2) ? smsRetCodeDic[p2] : "发送异常") + "]"); }), new object[] { (string)sod["UserNumber"], retdict["result"] }); //发送失败 UpdateSmsSendStatus(new { Status = 2, Mobiles = ((string)sod["UserNumber"]), BatchNum = sod["SerialNumber"] }.ToStringObjectDictionary(), strUrl, strToken, strNodeId, 0); } }); //回执 } } }); } }, 5000, () => { return(false); },//永远不停止 () => { return(!(smsPointDic.Count > 0)); }//未获取到节点时跳过 ); }
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); }); }