/// <summary> /// 与控件无关的登录函数,主要得到LoginInfo实例,可放到全局函数中EagleExtension.Api /// </summary> private void login2server(bool isB2c, string b2cService, string b2cManager, string username, string password, LineProvider lp, EagleString.LoginResultBtoc.LOGIN_INFO_BTOC resB2c, EagleString.LoginInfo loginInfo) { loginInfo.borc = (isB2c ? LoginInfo.BORC.b2c : LoginInfo.BORC.b2b); if (isB2c) { EagleExtension.EagleExtension.LoginB2c(username, password, ref resB2c, b2cManager, b2cService); loginInfo.b2c.username = username; loginInfo.b2c.password = password; loginInfo.b2c.webservice = b2cService; loginInfo.b2c.website = b2cManager; loginInfo.b2c.lr = resB2c; } string loginb2bxml = ""; //here todo: get b2b webservice address EagleString.ServerCenterB2B scb2b = new ServerCenterB2B(); string b2bWebSite = ""; string b2bWebService = ""; scb2b.ServerAddressB2B(EagleFileIO.Server, lp, 0, ref b2bWebService, ref b2bWebSite); EagleWebService.kernalFunc kf = new EagleWebService.kernalFunc(b2bWebService); bool flagLogin = false; string b2buser = username; string b2bpass = password; if (isB2c) { b2buser = resB2c.mapuser; b2bpass = resB2c.mappass; } kf.LogIn(b2buser, b2bpass, ref loginb2bxml, ref flagLogin); if (!flagLogin) { throw new Exception("登录失败,请检查网络及用户名密码是否正确!"); } lr = new LoginResult(loginb2bxml); if (lr.EXPIRED) { throw new Exception("该B2B用户已失效!"); } if (lr.AGENT_STAT != 0) { throw new Exception("该B2B用户所在代理商已失效!"); } if (lr.USER_STAT != 0) { throw new Exception("该B2B用户状态已失效!"); } loginInfo.b2b.username = b2buser; loginInfo.b2b.password = b2bpass; loginInfo.b2b.webservice = b2bWebService; loginInfo.b2b.webside = b2bWebSite; loginInfo.b2b.lr = lr; }
/// <summary> /// 根据权限及PrintDesign.xml内容创建保险打印的快捷菜单(EagleString.Structs.I_HASH /// </summary> public static ContextMenuStrip MenuInsurance(EagleString.LoginResult lr) { ContextMenuStrip menu = new ContextMenuStrip(); EagleString.Structs.INSURANCE_HASH.Clear(); XmlDocument xd = new XmlDocument(); xd.Load(Application.StartupPath + "\\PrinterDesign.xml"); XmlNode xn = xd.SelectSingleNode("//printer/insurrances"); for (int i = 0; i < xn.ChildNodes.Count; ++i) { XmlNode node = xn.ChildNodes[i]; string code = node.SelectSingleNode("code").InnerText.Trim(); string name = node.SelectSingleNode("name_cn").InnerText.Trim(); if (lr.AuthorityOfFunction(code)) { EagleString.Structs.INSURANCE_HASH.Add(code, name); menu.Items.Add(name, null, new EventHandler(OpenInsur)); } } return(menu); }