public static DataSet UserLogin(LoginInput loginO, string currAccDbName, string IPStr) { Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>(); ParamObj paraO1 = new ParamObj(); paraO1.name = "land_name"; paraO1.size = 40; paraO1.type = SysDbType.VarChar; paraO1.value = loginO.username; ParamObj paraO2 = new ParamObj(); paraO2.name = "password"; paraO2.size = 40; paraO2.type = SysDbType.VarChar; paraO2.value = loginO.pwd; ParamObj paraO3 = new ParamObj(); paraO3.name = "login_time"; paraO3.type = SysDbType.BigInt; paraO3.value = System.DateTime.Now.ToUniversalTime().Ticks; ParamObj paraO4 = new ParamObj(); paraO4.name = "computer_ip"; paraO4.size = 40; paraO4.type = SysDbType.VarChar; paraO4.value = IPStr; ParamObj paraO5 = new ParamObj(); paraO5.name = "computer_name"; paraO5.size = 40; paraO5.type = SysDbType.NVarChar; paraO5.value = loginO.ComputerName; ParamObj paraO6 = new ParamObj(); paraO6.name = "computer_mac"; paraO6.size = 40; paraO6.type = SysDbType.VarChar; paraO6.value = loginO.MAC; ParamObj paraO7 = new ParamObj(); paraO7.name = "login_Id"; paraO7.size = 40; paraO7.type = SysDbType.VarChar; paraO7.value = loginO.Login_Id; dic.Add("land_name", paraO1); dic.Add("password", paraO2); dic.Add("login_time", paraO3); dic.Add("computer_ip", paraO4); dic.Add("computer_name", paraO5); dic.Add("computer_mac", paraO6); dic.Add("login_Id", paraO7); SQLObj sqlObj = new SQLObj(); sqlObj.cmdType = System.Data.CommandType.StoredProcedure; sqlObj.sqlString = "ServerUserLogin"; sqlObj.Param = dic; DataSet ds = DBHelper.GetDataSet("服务器端用户登录", currAccDbName, sqlObj); return ds; }
/// <summary> 登陆验证 /// </summary> /// <param name="uName">用户名</param> /// <param name="uPwd">密码</param> /// <returns>返回错误信息</returns> public static string LoginInput(string uName, string uPwd, string MAC, string ComputerName, string Login_Id) { if (!WCFClientProxy.TestDataProxy()) { return "未能建立同服务器连接"; } LoginInput loginO = new LoginInput(); loginO.username = uName; loginO.pwd = uPwd; loginO.ComputerName = ComputerName; loginO.MAC = MAC; loginO.Login_Id = Login_Id; loginO.acccode = GlobalStaticObj.CurrAccCode; string loginStr = HXCCommon.DotNetEncrypt.DESEncrypt.Encrypt(Newtonsoft.Json.JsonConvert.SerializeObject(loginO)); loginStr = GlobalStaticObj.proxy.LoginIn(loginStr); string dsStr = HXCCommon.DotNetEncrypt.DESEncrypt.Decrypt(loginStr); RespFunStruct respO = JsonConvert.DeserializeObject<RespFunStruct>(dsStr); if (respO.IsSuccess == "0") { return respO.Msg; } HXCPcClient.GlobalStaticObj.gLoginDataSet = JsonConvert.DeserializeObject<DataSet>(respO.ReturnObject); return string.Empty; }
public static string UserLogin(LoginInput loginInput, string IPStr, string currAccDbName, out DataSet ds) { string errMsg = ""; ds = new DataSet(); #region 验证用户 string tempUserID = BLL.DBHelper.GetSingleValue("验证用户是否存在", currAccDbName, "sys_user", "user_id", " land_name='" + loginInput.username + "' and enable_flag=1 ", ""); if (string.IsNullOrEmpty(tempUserID)) { return "登陆录号不存在或被删除"; } string status = BLL.DBHelper.GetSingleValue("验证用户是否存在", currAccDbName, "sys_user", "status", " enable_flag=1 and land_name='" + loginInput.username + "' and password='******'", ""); if (string.IsNullOrEmpty(status)) { return "登录密码不正确"; } if (status != DataSources.EnumStatus.Start.ToString("d")) { return "登陆录号已被停用"; } #endregion Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>(); ParamObj paraO1 = new ParamObj(); paraO1.name = "land_name"; paraO1.size = 40; paraO1.type = SysDbType.VarChar; paraO1.value = loginInput.username; ParamObj paraO2 = new ParamObj(); paraO2.name = "password"; paraO2.size = 40; paraO2.type = SysDbType.VarChar; paraO2.value = loginInput.pwd; ParamObj paraO3 = new ParamObj(); paraO3.name = "login_time"; paraO3.type = SysDbType.BigInt; paraO3.value = Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime); ParamObj paraO4 = new ParamObj(); paraO4.name = "computer_ip"; paraO4.size = 40; paraO4.type = SysDbType.VarChar; paraO4.value = IPStr; ParamObj paraO5 = new ParamObj(); paraO5.name = "computer_name"; paraO5.size = 40; paraO5.type = SysDbType.NVarChar; paraO5.value = loginInput.ComputerName; ParamObj paraO6 = new ParamObj(); paraO6.name = "computer_mac"; paraO6.size = 40; paraO6.type = SysDbType.VarChar; paraO6.value = loginInput.MAC; ParamObj paraO7 = new ParamObj(); paraO7.name = "login_Id"; paraO7.size = 40; paraO7.type = SysDbType.VarChar; paraO7.value = loginInput.Login_Id; dic.Add("land_name", paraO1); dic.Add("password", paraO2); dic.Add("login_time", paraO3); dic.Add("computer_ip", paraO4); dic.Add("computer_name", paraO5); dic.Add("computer_mac", paraO6); dic.Add("login_Id", paraO7); SQLObj sqlObj = new SQLObj(); sqlObj.cmdType = System.Data.CommandType.StoredProcedure; sqlObj.sqlString = "ClientUserLogin"; sqlObj.Param = dic; ds = DBHelper.GetDataSet("客户端用户登录", currAccDbName, sqlObj); return errMsg; }
private void _Login(object state) { LoginInput loginO = new LoginInput(); loginO.username = this.userName; loginO.pwd = this.pwd; GlobalStaticObj_Server.Instance.LoginIP = Utility.Tools.HardwareSerialNumber.Get_UserIP(); string errMsg = string.Empty; try { DataSet ds = new DataSet(); errMsg = BLL.ServerUser.UserLogin(loginO, GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, GlobalStaticObj_Server.Instance.LoginIP, out ds); if (string.IsNullOrEmpty(errMsg)) { GlobalStaticObj.gLoginDataSet = ds; } } catch { errMsg = "数据库连接异常!"; } if (this.uiHandler != null) { this.Invoke(this.uiHandler, errMsg); } }
private void _Login(object state) { LoginInput loginO = new LoginInput(); loginO.username = this.userName; loginO.pwd = this.pwd; GlobalStaticObj_Server.Instance.LoginIP = Utility.Tools.HardwareSerialNumber.Get_UserIP(); GlobalStaticObj.gLoginDataSet = BLL.ServerUser.UserLogin(loginO, GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, GlobalStaticObj_Server.Instance.LoginIP); if (this.uiHandler != null) { this.Invoke(this.uiHandler, ""); } }