/// <summary> /// 登出系统 /// </summary> /// <param name="bc"></param> /// <returns></returns> public void LoginOut(Base_Customers bc) { try { remoteobj.LoginOut(bc); } catch (Exception ex) { OnError(ex.Message); } }
/// <summary> /// 登出系统 /// </summary> /// <param name="bc"></param> /// <returns></returns> public static void LoginOut(Base_Customers bc) { try { configManage.LoginOut(bc); configManage.CloseNet(); } catch (Exception ex) { } }
/// <summary> /// 修改客户信息 /// </summary> /// <param name="bc"></param> /// <returns>bool</returns> public bool Modify_Base_Customers(Base_Customers bc) { try { bool IsCon = remoteobj.Modify_Base_Customers(bc); return(IsCon); } catch (Exception ex) { OnError(ex.Message); return(false); } }
/// <summary> /// 登录验证,成功返回实体,失败返回NULL /// </summary> /// <param name="LoginName"></param> /// <param name="LoginPass"></param> /// <returns></returns> public static Base_Customers Login(string LoginName, string LoginPass, ref bool IsCon) { try { CheckNet(); Base_Customers bc = configManage.Login(LoginName, LoginPass, ref IsCon); Error_Messages = string.Empty; return(bc); } catch { IsCon = false; return(null); } }
/// <summary> /// 登录验证,成功返回实体,失败返回NULL /// </summary> /// <param name="LoginName"></param> /// <param name="LoginPass"></param> /// <returns></returns> public Base_Customers Login(string LoginName, string LoginPass, ref bool IsCon) { try { Base_Customers bc = remoteobj.Get_Base_CustomersByLogin(LoginName, LoginPass, ref IsCon); IsCon = true; return(bc); } catch (Exception ex) { IsCon = false; OnError.BeginInvoke(ex.Message, null, null); return(null); } }
/// <summary> /// 修改客户信息 /// </summary> /// <param name="bc"></param> /// <returns></returns> public static bool Modify_Base_Customers(Base_Customers bc) { return(configManage.Modify_Base_Customers(bc)); }
private void button1_Click(object sender, EventArgs e) { string pwd = ""; string Name = string.Empty, Pass = string.Empty; Name = textBox_UserName.Text; Pass = textBox_Pwd.Text; if (!md5flag) { pwd = PBPid.Base.AppGlobal.EncryptMD5(PBPid.Base.AppGlobal.EncryptMD5(textBox_Pwd.Text) + "cgt"); } else { pwd = Pass; } if (Name.Length == 0) { MessageBox.Show("请填写登录名!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Pass.Length == 0) { MessageBox.Show("请填写登录密码!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } bool IsCon = false;//是否连接 ServerIp = serverlist[comboBox_ServerList.SelectedIndex]; ManageSpace.Manage.m_ServerIp = ServerIp; currentUser = ManageSpace.Manage.Login(Name, pwd, ref IsCon); if (IsCon == false) { MessageBox.Show("与认证服务器连接失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (currentUser == null) { MessageBox.Show("登录失败!帐号或密码不正确!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //记录密码(保存到本地文件) XmlDocument xmlDoc = new XmlDocument(); if (File.Exists("sysinfo.xml")) { xmlDoc.Load("sysinfo.xml"); XmlNode root = xmlDoc.SelectSingleNode("EtermClient"); XmlNode xe1 = root.SelectSingleNode("LoginInfo"); XmlElement xe2 = (XmlElement)xe1; if (checkBox_SavePwd.Checked) { xe2.SetAttribute("savepwd", "1"); } else { xe2.SetAttribute("savepwd", "0"); } if (checkBox_AutoLogin.Checked) { xe2.SetAttribute("autologin", "1"); } else { xe2.SetAttribute("autologin", "0"); } xe2.SetAttribute("staffid", Name); xe2.SetAttribute("pwd", pwd); xmlDoc.Save("sysinfo.xml"); } else { //创建配置文件 //加入XML的声明段落 XmlNode xn1 = xmlDoc.CreateNode(XmlNodeType.XmlDeclaration, "", ""); xmlDoc.AppendChild(xn1); XmlElement xe1 = xmlDoc.CreateElement("", "EtermClient", ""); xmlDoc.AppendChild(xe1); XmlElement xe2 = xmlDoc.CreateElement("", "LoginInfo", ""); if (checkBox_SavePwd.Checked) { xe2.SetAttribute("savepwd", "1"); } else { xe2.SetAttribute("savepwd", "0"); } if (checkBox_AutoLogin.Checked) { xe2.SetAttribute("autologin", "1"); } else { xe2.SetAttribute("autologin", "0"); } xe2.SetAttribute("staffid", Name); xe2.SetAttribute("pwd", pwd); xmlDoc.ChildNodes.Item(1).AppendChild(xe2); XmlElement xe3 = xmlDoc.CreateElement("", "ServerInfo1", ""); xe3.SetAttribute("servername", "认证服务器一"); xe3.SetAttribute("serverip", "203.88.210.234"); xmlDoc.ChildNodes.Item(1).AppendChild(xe3); XmlElement xe4 = xmlDoc.CreateElement("", "ServerInfo2", ""); xe4.SetAttribute("servername", "认证服务器二"); xe4.SetAttribute("serverip", "203.88.210.227"); xmlDoc.ChildNodes.Item(1).AppendChild(xe4); XmlElement xe5 = xmlDoc.CreateElement("", "ServerInfo3", ""); xe5.SetAttribute("servername", "认证服务器三"); xe5.SetAttribute("serverip", "121.12.124.37"); xmlDoc.ChildNodes.Item(1).AppendChild(xe5); XmlElement xe6 = xmlDoc.CreateElement("", "ServerInfo4", ""); xe6.SetAttribute("servername", "认证服务器四"); xe6.SetAttribute("serverip", "120.64.252.142"); xmlDoc.ChildNodes.Item(1).AppendChild(xe6); //<ServerInfo2 servername="服务器2" serverip="121.12.124.37" /> xmlDoc.Save("sysinfo.xml"); } IfLogin = true; this.DialogResult = System.Windows.Forms.DialogResult.OK; }