private void MainForm_Load(object sender, EventArgs e) { TrayHelper trayHelper = new TrayHelper(this); WebOcxAccess.init(this.axCryptCtl1); if (ConfigManager.Instance.Config.license == null) { ConfigManager.Instance.Config.license = Guid.NewGuid().ToString("B"); } String sh = ConfigManager.Instance.Config.sh; String password = ConfigManager.Instance.Config.password; String license = ConfigManager.Instance.Config.license; String PT_PWD = ConfigManager.Instance.Config.PT_PWD; if (sh != null) { usedShLabel.Text = sh; shBox.Text = sh; } if (password != null) { passwordBox.Text = password; passwordBox2.Text = password; } if (PT_PWD != null) { PT_PWD_textBox.Text = PT_PWD; PT_PWD_textBox2.Text = PT_PWD; } if (ConfigManager.Instance.Config.taskServerIP != null) { taskServerIPBox.Text = ConfigManager.Instance.Config.taskServerIP; } if (ConfigManager.Instance.Config.taskServerPort != null) { taskServerPortBox.Text = ConfigManager.Instance.Config.taskServerPort; } if (ConfigManager.Instance.Config.sh != null && ConfigManager.Instance.Config.PT_PWD != null && ConfigManager.Instance.Config.password != null && ConfigManager.Instance.Config.taskServerIP != null && ConfigManager.Instance.Config.taskServerPort != null) { TokenTask.tockenTaskRequestThreadInit(); } }
private void MainForm_Load(object sender, EventArgs e) { //TypeSelect form = new TypeSelect(); //DialogResult result = form.ShowDialog(); //if(result == DialogResult.OK) //{ // ConfigManager.Instance.Config.clientType = "USB"; //}else //{ // ConfigManager.Instance.Config.clientType = "PC"; //} TrayHelper trayHelper = new TrayHelper(this); WebOcxAccess.init(this.axCryptCtl1); if (ConfigManager.Instance.Config.license == null) { ConfigManager.Instance.Config.license = Guid.NewGuid().ToString("B"); } String taskServerIP = ConfigManager.Instance.Config.taskServerIP; String taskServerPort = ConfigManager.Instance.Config.taskServerPort; if (taskServerIP != null) { taskServerIPBox.Text = taskServerIP; } if (taskServerPort != null) { taskServerPortBox.Text = taskServerPort; } String controlVersion = ConfigManager.Instance.Config.controlVersion; if ("baiwang".Equals(controlVersion)) { baiwangRadioButton.Checked = true; } if (taskServerIP != null && taskServerPort != null) { TokenTask.tockenTaskRequestThreadInit(); } }
public TaskSocketMessage getTocken( String ym, String ymbb, String sh, String password, String rwId, String ptPassword) { log.Info(String.Format("ym:{0};ymbb:{1}", ym, ymbb)); TaskSocketMessage return_tsm = new TaskSocketMessage(); return_tsm.type = TaskHandle.POST_TOKEN; return_tsm.parameters["rwid"] = rwId; if (ymbb == null || ymbb == "") { ymbb = "3.0.09"; } String oxcSh = null; try { oxcSh = WebOcxAccess.openAndGetCert(password); } catch (Exception e) { log.Error(e.Message, e); return_tsm.parameters["code"] = CODE_OCX_ERROR; return_tsm.parameters["msg"] = "控件不可用"; return(return_tsm); } if (sh != null && !oxcSh.Equals(sh)) { return_tsm.parameters["code"] = CODE_SH_ERROR; return_tsm.parameters["msg"] = "税号不一致!,当前税号:" + oxcSh; return(return_tsm); } if (sh == null) { sh = oxcSh; } return_tsm.parameters["sh"] = sh; String clientHello = WebOcxAccess.clientHello(); //String clientHello = "306E0201033055310B300906035504061302636E310D300B060355040B1E0400430041310D300B06035504081E0453174EAC3119301706035504031E104E2D56FD7A0E52A18BA48BC14E2D5FC3310D300B06035504071E0453174EAC02070201000001A087A209310702010102020402";//;= WebOcxAccess.clientHello(); FpdkHttpResult fpdkHttpResult = null; try { fpdkHttpResult = firstLogin(ym, ymbb, clientHello, password, 0); } catch (Exception e) { log.Error(e.Message, e); return_tsm.parameters["code"] = CODE_SERVER_ERROR; return_tsm.parameters["msg"] = "调用服务器失败!"; return(return_tsm); } if (!fpdkHttpResult.key1.Equals("01")) { return_tsm.parameters["code"] = CODE_SERVER_ERROR; return_tsm.parameters["msg"] = "调用服务器失败!"; return(return_tsm); } string serverPacket = fpdkHttpResult.key2; string serverRandom = fpdkHttpResult.key3; string clientAuthCode = WebOcxAccess.ClientAuth(serverPacket); try { fpdkHttpResult = secondLogin(ym, ymbb, clientAuthCode, serverRandom, sh, 0, false, ptPassword); } catch (Exception e) { log.Error(e.Message, e); return_tsm.parameters["code"] = CODE_SERVER_ERROR; return_tsm.parameters["msg"] = "调用服务器失败!"; return(return_tsm); } log.Info(String.Format("key1:{0};key2:{1}", fpdkHttpResult.key1, fpdkHttpResult.key2)); if (fpdkHttpResult.key1.Equals("01") || fpdkHttpResult.key1.Equals("03")) { return_tsm.parameters["code"] = CODE_SUCCESS; return_tsm.parameters["msg"] = "调用服务器成功!"; return_tsm.parameters["token"] = fpdkHttpResult.key2; return(return_tsm); } else if (fpdkHttpResult.key1.Equals("02")) { return_tsm.parameters["code"] = "904-02"; return_tsm.parameters["msg"] = "档案信息不存在"; return_tsm.parameters["token"] = fpdkHttpResult.key2; return(return_tsm); } else if (fpdkHttpResult.key1.Equals("04")) { return_tsm.parameters["code"] = "904-04"; return_tsm.parameters["msg"] = "平台密码不正确"; errorPassword = true; return(return_tsm); } else if (fpdkHttpResult.key1.Equals("05")) { return_tsm.parameters["code"] = "904-05"; return_tsm.parameters["msg"] = "平台密码错误次数超过十次,请联系税务机关解锁或明天再试"; errorPassword = true; return(return_tsm); } else if (fpdkHttpResult.key1.Equals("08")) { return_tsm.parameters["code"] = "904-08"; return_tsm.parameters["msg"] = "需要平台密码"; errorPassword = true; return(return_tsm); } else if (fpdkHttpResult.key1.Equals("12")) { return_tsm.parameters["code"] = "904-12"; return_tsm.parameters["msg"] = "信用等级未设置"; return(return_tsm); } else if (fpdkHttpResult.key1.Equals("13")) { return_tsm.parameters["code"] = "904-13"; return_tsm.parameters["msg"] = "特定企业,不能使用平台"; return(return_tsm); } else if (fpdkHttpResult.key1.Equals("21")) { return_tsm.parameters["code"] = "904-21"; return_tsm.parameters["msg"] = "未启用,无权登录此平台"; return(return_tsm); } else { return_tsm.parameters["code"] = CODE_SERVER_ERROR; return_tsm.parameters["msg"] = "调用服务器失败!"; return(return_tsm); } }