private void Edit() { XIMInboundMessage message = _listViewCtrl.GetSelectedItem(); if (message == null) { return; } XIMInboundMessage testMessage = message.Clone(); testMessage.Rule.RuleID = message.Rule.RuleID; FormMessage <XIMInboundMessage> frm = new FormMessage <XIMInboundMessage>(testMessage, Program.ConfigMgt.Config.Messages, Program.ConfigMgt.Config.GWDataDBConnection, Program.Log); if (frm.ShowDialog(this) != DialogResult.OK) { return; } int index = Program.ConfigMgt.Config.Messages.IndexOf(message); if (index < 0) { return; } Program.ConfigMgt.Config.Messages.Remove(message); Program.ConfigMgt.Config.Messages.Insert(index, testMessage); _listViewCtrl.RefreshList(); _listViewCtrl.SelectItem(testMessage); }
private void Add() { FormMessage <XIMInboundMessage> frm = new FormMessage <XIMInboundMessage>(null, Program.ConfigMgt.Config.Messages, Program.ConfigMgt.Config.GWDataDBConnection, Program.Log); if (frm.ShowDialog(this) != DialogResult.OK) { return; } XIMInboundMessage message = frm.Message; if (message == null) { return; } Program.ConfigMgt.Config.Messages.Add(message); _listViewCtrl.RefreshList(); RefreshButtons(); }
private void Delete() { XIMInboundMessage message = _listViewCtrl.GetSelectedItem(); if (message == null) { return; } if (Program.ConfigMgt.Config.WarnBeforeDeleteChannel && MessageBox.Show(this, "Are you sure to delete this message mapping?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) != DialogResult.Yes) { return; } Program.ConfigMgt.Config.Messages.Remove(message); _listViewCtrl.RefreshList(); RefreshButtons(); }
private void Copy() { XIMInboundMessage message = _listViewCtrl.GetSelectedItem(); if (message == null) { return; } XIMInboundMessage newMessage = message.Clone(); FormMessage <XIMInboundMessage> frm = new FormMessage <XIMInboundMessage>(newMessage, Program.ConfigMgt.Config.Messages, Program.ConfigMgt.Config.GWDataDBConnection, Program.Log, true); if (frm.ShowDialog(this) != DialogResult.OK) { return; } Program.ConfigMgt.Config.Messages.Add(newMessage); _listViewCtrl.RefreshList(); _listViewCtrl.SelectItem(newMessage); }
private bool _entity_OnRequest(string receiveData, ref string sendData) { //receiveData = SocketHelper.DeleteEOF(receiveData, _entity.Config.ReceiveEndSign); //sendData = receiveData.Replace('#', '$'); //return; //using (StreamWriter sw = File.CreateText("d:\\msg.txt")) //{ // sw.Write(receiveData); //} string msgContent = XIMServerHelper.GetMessageContent(receiveData); if (msgContent == null || msgContent.Length < 1) { string strErrMsg = "Request message does not exist in request data"; Program.Log.Write(LogType.Warning, strErrMsg, XIMServerHelper.ModuleName); sendData = XIMServerHelper.GetResponseFailed(XIMTransformHelper.GetTransactionID(), strErrMsg, Program.ConfigMgt.Config.SocketConfig); return(false); } string strName = ""; string strQualifier = ""; string strTransactionID = ""; XIMInboundMessage msgConfig = XIMServerHelper.GetMessageConfiguration(msgContent, ref strName, ref strQualifier, ref strTransactionID); if (msgConfig == null) { string strErrMsg = "Cannot find mapping rule configuration for current message (Name:" + strName + ", Qualifier:" + strQualifier + ")."; Program.Log.Write(LogType.Warning, strErrMsg, XIMServerHelper.ModuleName); sendData = XIMServerHelper.GetResponseFailed(strTransactionID, strErrMsg, Program.ConfigMgt.Config.SocketConfig); return(false); } XMLTransformer transformer = XMLTransformer.CreateFromMessage(msgConfig); if (msgConfig == null) { string strErrMsg = "Cannot find mapping XSL file for current message (XSL File:" + msgConfig.XSLFileName + ")."; Program.Log.Write(LogType.Warning, strErrMsg, XIMServerHelper.ModuleName); sendData = XIMServerHelper.GetResponseFailed(strTransactionID, strErrMsg, Program.ConfigMgt.Config.SocketConfig); return(false); } List <XmlNode> nodeList = new List <XmlNode>(); XIMServerHelper.SplitItem(nodeList, msgContent); Program.Log.Write(nodeList.Count.ToString() + " XIM Item(s) are found in request message", XIMServerHelper.ModuleName); XIMServerHelper.SplitProcedureStep(nodeList); Program.Log.Write(nodeList.Count.ToString() + " XIM Item(s) splited by SPS are found in request message", XIMServerHelper.ModuleName); if (nodeList.Count > 0) { string[] dataSetXmlList = XIMServerHelper.Transform(transformer, nodeList); DataSet dataSet = XIMServerHelper.CreateDataSet(dataSetXmlList); if (dataSet == null) { string strErrMsg = "Failed to transform to Data Set for current message."; Program.Log.Write(LogType.Warning, strErrMsg, XIMServerHelper.ModuleName); sendData = XIMServerHelper.GetResponseFailed(strTransactionID, strErrMsg, Program.ConfigMgt.Config.SocketConfig); return(false); } if (_service.SaveData(msgConfig.Rule, dataSet)) { Program.Log.Write("Save to GC Gateway database succeeded."); sendData = XIMServerHelper.GetResponseSuccess(strTransactionID, Program.ConfigMgt.Config.SocketConfig); return(true); } else { string strErrMsg = "Save to GC Gateway database failed."; Program.Log.Write(LogType.Error, strErrMsg, XIMServerHelper.ModuleName); sendData = XIMServerHelper.GetResponseFailed(strTransactionID, strErrMsg, Program.ConfigMgt.Config.SocketConfig); return(false); } } return(false); }