You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using Newtonsoft.Json; using Newtonsoft.Json.Linq; using OT.COM.LogisticsUtil; using OT.COM.SignalerMessage; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text;
namespace CounsellorBL { public class ServiceBase : MessageBase { public const string SERVICE = "service";
protected Dictionary<string, object> _dicInitData = null; public virtual CResponseMessage Init(CRequestMessage i_crm) { CResponseMessage crm = null; string sMsg = null;
try { do { if (null == i_crm) { sMsg = BaseExceptionWord.ex000047; //NO INIT DATA
break; } _dicInitData = i_crm.DATA; crm = new CSuccessResponseMessage(null, i_crm); } while (false); } catch (Exception ex) { sMsg = new Util().GetLastExceptionMsg(ex); }
if (null != sMsg) { crm = new CErrorResponseMessage(sMsg, null); }
return crm;
}
public CResponseMessage Entry(CRequestMessage i_crm) { string sMsg = null; CResponseMessage crm = null;
try { do { // Find Native Method
string sFunctionName = i_crm.TYPE;
if (null == sFunctionName) { //sMsg = string.Format("NO METHOD - {0}", sFunctionName);
sMsg = BaseExceptionWord.ex000051; //NO METHOD
break; }
MethodInfo mi = this.GetType().GetMethod(sFunctionName); if (null == mi) { //sMsg = string.Format("NO MATCH METHOD - {0}", sFunctionName);
sMsg = BaseExceptionWord.ex000052; //NO MATCH METHOD
break; }
object[] ao = { i_crm };
crm = (CResponseMessage)mi.Invoke(this, ao); } while (false);
} catch (Exception ex) { sMsg = new Util().GetLastExceptionMsg(ex); }
if (null != sMsg) { crm = new CErrorResponseMessage(sMsg, i_crm); }
return crm; }
public string MakeDebugFullDump(string i_sMsg, CRequestMessage i_crm) { string sRes = Environment.NewLine;
sRes += "**** Start Dump **************************" + Environment.NewLine; sRes += string.Format("Custom Message:{0}", i_sMsg) + Environment.NewLine; sRes += string.Format("Parameter Json:{0}", JsonConvert.SerializeObject(i_crm)) + Environment.NewLine; sRes += "Call Stack Dump:" + Environment.NewLine; sRes += Environment.StackTrace + Environment.NewLine; sRes += "*****End Dump *************************" + Environment.NewLine;
return sRes; }
public string JProperty2Dic(JObject i_jpData, ref Dictionary<string, object> io_dicData) { string sRes = null; Dictionary<string, object> dicRes = new Dictionary<string, object>();
try { foreach (JProperty property in i_jpData.Properties()) { JToken jv = property.Value; dicRes.Add(property.Name, jv.Value<string>()); } } catch (Exception ex) { sRes = new Util().GetLastExceptionMsg(ex); }
io_dicData = dicRes; return sRes; } }
}
|