private void btnLogin_Click(object sender, EventArgs e) { try { //获取录入数据 string userName = txtUserName.Text; string password = txtPwd.Text; string year = cBoxYear.SelectedItem.ToString(); string accid = txtAccID.Text; if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(accid)) { MessageBox.Show("请认真输入以上信息!"); return; } int result = service.LoginIn(out custr, out connstr, out errmsg, userName,password,accid,year); if (result != 0)//登录失败 { MessageBox.Show("登录失败:"+ errmsg); return; } frmPrint fprint = new frmPrint(connstr,service); //fprint.ShowDialog(); fprint.Show(); //this.Dispose(); this.Hide(); } catch(Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 构造函数 /// </summary> /// <param name="connstr">连接字符串</param> /// <param name="service">web服务</param> /// <param name="frmP">主窗体对象</param> public FrmSupplement(string connstr,DXTU8Service.ServiceSoap service,frmPrint frmP) { InitializeComponent(); this.service = service; this.connstr = connstr; this.frmP = frmP; XmlNode xn; int rt = service.GetClassTree(out xn,connstr); //U8Common.GetClassTree(out xn); if (rt == 0) { tvClass.Nodes.Clear(); foreach (XmlNode sub1Xml in xn.SelectNodes("First")) { TreeNode tn1 = new TreeNode(); tn1.Name = sub1Xml.Attributes["cInvCCode"].Value; tn1.Text = sub1Xml.Attributes["cInvCName"].Value + "(" + tn1.Name + ")"; foreach (XmlNode sub2Xml in sub1Xml.SelectNodes("Second")) { TreeNode tn2 = new TreeNode(); tn2.Name = sub2Xml.Attributes["cInvCCode"].Value; tn2.Text = sub2Xml.Attributes["cInvCName"].Value + "(" + tn2.Name + ")"; //foreach (XmlNode sub3Xml in sub2Xml.SelectNodes("Third")) //{ // TreeNode tn3 = new TreeNode(); // tn3.Name = sub3Xml.Attributes["cInvCCode"].Value; // tn3.Text = sub3Xml.Attributes["cInvCName"].Value + "(" + tn3.Name + ")"; // tn2.Nodes.Add(tn3); //} tn1.Nodes.Add(tn2); } tvClass.Nodes.Add(tn1); } //TreeNode root = new TreeNode("root"); //Recursive(root, xn, 0); //tvClass.Nodes.Add(root); } else { tvClass.Nodes.Clear(); } }
public frmSetting(frmPrint frmP):this() { this.frmP = frmP; }