/// <summary> /// 用户登陆 /// </summary> /// <param name="tradeAccount">登陆账号</param> /// <param name="tradePwd">登陆密码</param> /// <param name="mac">mac地址</param> /// <returns>Loginfo</returns> public Loginfo GetLogin(string tradeAccount, string tradePwd, string mac) { //实例化实体类 Loginfo loginfo = new Loginfo(); loginfo.LoginID = "-1"; try { tradePwd = Des3.Des3EncodeCBC(tradePwd); //判断用户是否存在 函数1 if (ComFunction.ListLogin(ref loginfo, tradeAccount, tradePwd, mac)) { loginfo.LoginID = System.Guid.NewGuid().ToString().Replace("-", ""); //如果存在 随机生存登陆标识 并更新到数据库 查询行情IP和PORT 返回实体类 ComFunction.ListLoginfo(ref loginfo, tradeAccount, tradePwd); } } catch (Exception ex) { ComFunction.WriteErr(ex); loginfo.LoginID = "-1"; } return(loginfo); }
public String AnalysisXml(string ReqXml) { string ResXml = string.Empty; string ReqCode = string.Empty; try { System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument(); xmldoc.LoadXml(ReqXml); //获取账号 string TradeAccount = xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradeAccount").InnerText; //获取密码并解码 string TradePwd = com.individual.helper.RsaHelper.Decrypt(xmldoc.SelectSingleNode("JTW91G/MsgData/DataBody/TradePwd").InnerText, RsaPrivateKey); //获取MAC地址 string Mac = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/Mac").InnerText; //请求指令 ReqCode = xmldoc.SelectSingleNode("JTW91G/MsgData/ReqHeader/ReqCode").InnerText; Trade.CTrade trade = new Trade.CTrade(); Loginfo lg = trade.GetLogin(TradeAccount, TradePwd, Mac); if ("-1" == lg.LoginID) { //登陆失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL002, ResCode.UL002Desc, string.Format("<DataBody></DataBody>")); } else { StringBuilder UserLimitInfo = new StringBuilder(); UserLimitInfo.AppendFormat("<MinTrade>{0}</MinTrade>", lg.TdUser.MinTrade); UserLimitInfo.AppendFormat("<OrderUnit>{0}</OrderUnit>", lg.TdUser.OrderUnit); UserLimitInfo.AppendFormat("<MaxTrade>{0}</MaxTrade>", lg.TdUser.MaxTrade); UserLimitInfo.AppendFormat("<PermitRcash>{0}</PermitRcash>", lg.TdUser.PermitRcash ? 1 : 0); UserLimitInfo.AppendFormat("<PermitCcash>{0}</PermitCcash>", lg.TdUser.PermitCcash ? 1 : 0); UserLimitInfo.AppendFormat("<PermitDhuo>{0}</PermitDhuo>", lg.TdUser.PermitDhuo ? 1 : 0); UserLimitInfo.AppendFormat("<PermitHshou>{0}</PermitHshou>", lg.TdUser.PermitHshou ? 1 : 0); UserLimitInfo.AppendFormat("<PermitRstore>{0}</PermitRstore>", lg.TdUser.PermitRstore ? 1 : 0); UserLimitInfo.AppendFormat("<PermitDelOrder>{0}</PermitDelOrder>", lg.TdUser.PermitDelOrder ? 1 : 0); //响应消息体 string DataBody = string.Format("<DataBody><LoginId>{0}</LoginId><QuotesAddressIP>{1}</QuotesAddressIP><QuotesPort>{2}</QuotesPort><UserLimitInfo>{3}</UserLimitInfo></DataBody>", lg.LoginID, lg.QuotesAddressIP, lg.QuotesPort, UserLimitInfo.ToString()); ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL001, ResCode.UL001Desc, DataBody); } } catch (Exception ex) { com.individual.helper.LogNet4.WriteErr(ex); //业务处理失败 ResXml = GssResXml.GetResXml(ReqCode, ResCode.UL005, ResCode.UL005Desc, string.Format("<DataBody></DataBody>")); } return(ResXml); }
private void WriteLog(WriteInDiskLogfile writeLog, string message, int lineNum, Type errorType, string controlName) { try { Loginfo info = new Loginfo(); info.ControlName = controlName; info.ErrorLineNum = lineNum; info.EventName = message; info.MainName = "GenericConnectionCore"; info.ExceptionName = errorType.ToString(); writeLog.Log(info); } catch (Exception ex) { writeLog.Log(string.Format("Error while attempting write in logfile.<-- {0} -->", ex.Message)); } }
/// <summary> /// 行情客户端用户登陆 /// </summary> /// <param name="tradeAccount">登陆账号</param> /// <param name="tradePwd">登陆密码</param> /// <param name="mac">mac地址</param> /// <returns>Loginfo</returns> public Loginfo GetLoginEx(string tradeAccount, string tradePwd, string mac) { //实例化实体类 Loginfo loginfo = new Loginfo(); loginfo.LoginID = "-1"; try { tradePwd = Des3.Des3EncodeCBC(tradePwd); //判断用户是否存在 函数1 if (ComFunction.ListLogin(ref loginfo, tradeAccount, tradePwd, mac)) { loginfo.LoginID = System.Guid.NewGuid().ToString().Replace("-", ""); loginfo.QuotesAddressIP = ComFunction.ip; loginfo.QuotesPort = Convert.ToInt32(ComFunction.port); } } catch (Exception ex) { ComFunction.WriteErr(ex); loginfo.LoginID = "-1"; } return(loginfo); }
private void treeView_remoteWell_AfterSelect(object sender, TreeViewEventArgs e) { try { if (treeView_remoteWell.SelectedNode != null) { String strSelectedid = e.Node.ToolTipText; String strSelectedname = e.Node.Text; switch (e.Node.Level)//TreeView层数 { //通过工区节点 获取工区包含的井节点信息 case 0: Wellinfo.Clear(); WellidList.Clear(); WellnameList.Clear(); RegionId = strSelectedid; RegionName = strSelectedname; Wellinfo = GetWellListByRegionId(RegionId); for (int i = 0; i < WellnameList.Count; i++) { if (!getChildNodeList(e.Node).Contains(WellnameList[i])) { TreeNode wellnode = new TreeNode(WellnameList[i]); wellnode.ToolTipText = WellidList[i]; e.Node.Nodes.Add(wellnode); } } SelectedNodeLevel = 0; break; //通过井节点 获取井包含的井次信息 case 1: Loginfo.Clear(); LogidList.Clear(); LognameList.Clear(); WellId = strSelectedid; WellName = strSelectedname; Loginfo = GetLogListByWellId(WellId); for (int i = 0; i < LognameList.Count; i++) { if (!getChildNodeList(e.Node).Contains(LognameList[i])) { TreeNode lognode = new TreeNode(LognameList[i]); lognode.ToolTipText = LogidList[i]; e.Node.Nodes.Add(lognode); } } SelectedNodeLevel = 1; break; //选择井次 case 2: LogName = e.Node.Text; LogId = e.Node.ToolTipText; SelectedNodeLevel = 2; break; } initialNodeMap(); } } catch (Exception ex) { Debug.WriteLine(ex.Message + "\r\t <====== RemoteWell.cs-->treeView_remoteWell_AfterSelect() ,Error!======>"); } }