private void GetAllAgent() { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1103Codes.GetAllAgent; //Service11031Client client = new Service11031Client(); Service11031Client client = new Service11031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11031")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } for (int i = 0; i < webReturn.ListData.Count; i++) { strList.Add(webReturn.ListData[i]); } } catch (Exception ex) { ShowException(ex.Message); } }
private void ModifyAgentPassword() { GlobalParamInfo GlobalParam = new GlobalParamInfo(); try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)RequestCode.WSGetGlobalParamList; webRequest.ListData.Add("11"); webRequest.ListData.Add("11010501"); webRequest.ListData.Add(string.Empty); Service11012Client client = new Service11012Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", webReturn.Code, webReturn.Message)); return; } OperationReturn optReturn = XMLHelper.DeserializeObject <GlobalParamInfo>(webReturn.ListData[0]); if (!optReturn.Result) { ShowException(string.Format("InitColumnData Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } GlobalParam = optReturn.Data as GlobalParamInfo; if (GlobalParam == null) { return; } } catch (Exception ex) { ShowException(ex.Message); } try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1103Codes.UPAgentPwd; webRequest.ListData.Add(mCurrentItem.ObjID.ToString()); // webRequest.ListData.Add(mCurrentItem.Name.ToString()); webRequest.ListData.Add(GlobalParam.ParamValue.Substring(8));//新密码 // Service11031Client client = new Service11031Client(); Service11031Client client = new Service11031Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11031")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (webReturn.Result) { CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("S1103030", "Modify Sucessed")); #region 写操作日志 string msg_success = string.Format("{0} {1} :{2}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString("FO1103004"), mCurrentItem.Name); CurrentApp.WriteOperationLog("1103004", ConstValue.OPT_RESULT_SUCCESS, msg_success); #endregion } else//失败 { ShowException(string.Format("{0}:{1}", CurrentApp.GetLanguageInfo("S1103031", webReturn.Message), webReturn.Message)); #region 写操作日志 string msg_Fail = string.Format("{0} {1} :{2}", CurrentApp.Session.UserInfo.UserName, Utils.FormatOptLogString("FO1103004"), mCurrentItem.Name); CurrentApp.WriteOperationLog("1103004".ToString(), ConstValue.OPT_RESULT_FAIL, msg_Fail); #endregion } } catch (Exception ex) { ShowException(ex.Message); } }
private void DeleteAgent() { try { var item = TvObjects.SelectedItem as ObjectItem; if (item == null) { item = TreeViewOrgAgent.SelectedItem as ObjectItem; if (item == null) { return; } } if (item.ObjType != ConstValue.RESOURCE_AGENT) { return; } var agentInfo = item.Data as AgentInfo; if (agentInfo == null) { return; } var result = MessageBox.Show(string.Format("Confirm delete agent?\r\n\r\n{0}", agentInfo.AgentID), CurrentApp.AppTitle, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result != MessageBoxResult.Yes) { return; } OperationReturn optReturn; optReturn = XMLHelper.SeriallizeObject(agentInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } string strInfo = optReturn.Data.ToString(); int errCode = 0; string strMsg = string.Empty; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (s, de) => { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1103Codes.ModifyAgent; webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString()); webRequest.ListData.Add("2"); webRequest.ListData.Add(strInfo); Service11031Client client = new Service11031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11031")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { errCode = webReturn.Code; strMsg = webReturn.Message; return; } if (webReturn.ListData == null || webReturn.ListData.Count < 1) { errCode = Defines.RET_PARAM_INVALID; strMsg = string.Format("WS return fail."); return; } string strSerialID = webReturn.ListData[0]; CurrentApp.WriteLog("DeleteAgent", string.Format("End.\t{0}", strSerialID)); } catch (Exception ex) { errCode = Defines.RET_FAIL; strMsg = ex.Message; } }; worker.RunWorkerCompleted += (s, re) => { worker.Dispose(); if (errCode > 0) { ShowException(string.Format("{0}\t{1}", errCode, strMsg)); return; } ShowInformation(string.Format("Delete agent successful!")); ReloadData(); }; worker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }
private void ModifyAgentOrg() { if (AgentItem == null) { return; } var agentInfo = AgentItem.Data as AgentInfo; List <string> listObjectState = new List <string>(); ModifyAgentOrg(mRootItem, ref listObjectState); int errCode = 0; string strMsg = string.Empty; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (s, de) => { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1103Codes.ModifyAgentORGC; webRequest.ListData.Add(agentInfo.SerialID.ToString()); //// webRequest.ListData.Add(listObjectState.Count().ToString()); if (listObjectState.Count >= 2) { // MessageBox.Show("您不能选择多个机构。。"); MessageBox.Show(CurrentApp.GetLanguageInfo("S1103039", "您不能选择多个机构。。")); return; } else { for (int i = 0; i < listObjectState.Count(); i++) { webRequest.ListData.Add(listObjectState[i]); } } // Service11031Client client = new Service11031Client(); Service11031Client client = new Service11031Client( WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress( CurrentApp.Session.AppServerInfo, "Service11031")); WebHelper.SetServiceClient(client); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { errCode = webReturn.Code; strMsg = webReturn.Message; return; } } catch (Exception ex) { errCode = Defines.RET_FAIL; strMsg = ex.Message; } }; worker.RunWorkerCompleted += (s, re) => { worker.Dispose(); if (errCode > 0) { ShowException(string.Format("{0}\t{1}", errCode, strMsg)); return; } ShowInformation(string.Format("Modify agnet successful!")); if (PageParent != null) { PageParent.ReloadData(); } var panel = Parent as PopupPanel; if (panel != null) { panel.IsOpen = false; } }; worker.RunWorkerAsync(); }
private void ModifyAgent() { try { if (AgentItem == null) { return; } var agentInfo = AgentItem.Data as AgentInfo; if (agentInfo == null) { return; } if (string.IsNullOrEmpty(TxtAgentID.Text)) { ShowException(string.Format("AgentID empty!")); return; } if (TxtAgentID.Text.Length > 128) { CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("S1103040", "Add content should not exceed 120 characters.")); return; } else { agentInfo.AgentID = TxtAgentID.Text; } if (TxtAgentName.Text.Length > 128) { CurrentApp.ShowInfoMessage(CurrentApp.GetLanguageInfo("S1103040", "Add content should not exceed 120 characters.")); return; } else { agentInfo.AgentName = TxtAgentName.Text; } agentInfo.State = RadioStateEnable.IsChecked == true ? 1 : 2; agentInfo.Tenure = ComboBoxTenure.SelectedIndex; OperationReturn optReturn; optReturn = XMLHelper.SeriallizeObject(agentInfo); if (!optReturn.Result) { ShowException(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } string strInfo = optReturn.Data.ToString(); int errCode = 0; string strMsg = string.Empty; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (s, de) => { try { WebRequest webRequest = new WebRequest(); webRequest.Session = CurrentApp.Session; webRequest.Code = (int)S1103Codes.ModifyAgent; webRequest.ListData.Add(CurrentApp.Session.UserInfo.UserID.ToString()); webRequest.ListData.Add("3"); webRequest.ListData.Add(strInfo); //Service11031Client client = new Service11031Client(); Service11031Client client = new Service11031Client(WebHelper.CreateBasicHttpBinding(CurrentApp.Session), WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11031")); WebReturn webReturn = client.DoOperation(webRequest); client.Close(); if (!webReturn.Result) { errCode = webReturn.Code; strMsg = webReturn.Message; return; } if (webReturn.ListData == null || webReturn.ListData.Count < 1) { errCode = Defines.RET_PARAM_INVALID; strMsg = string.Format("WS return fail."); return; } string strSerialID = webReturn.ListData[0]; CurrentApp.WriteLog("ModifyAgent", string.Format("End.\t{0}", strSerialID)); } catch (Exception ex) { errCode = Defines.RET_FAIL; strMsg = ex.Message; } }; worker.RunWorkerCompleted += (s, re) => { worker.Dispose(); if (errCode > 0) { ShowException(string.Format("{0}\t{1}", errCode, strMsg)); return; } ShowInformation(string.Format("Modify agnet successful!")); if (PageParent != null) { PageParent.ReloadData(); } var panel = Parent as PopupPanel; if (panel != null) { panel.IsOpen = false; } }; worker.RunWorkerAsync(); } catch (Exception ex) { ShowException(ex.Message); } }