/// <summary> /// 更新一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public bool Update(BASE_COMPANY entity) { //return dal.Update(entity) >= 0 ? true : false; #region 获取旧值 var oldEntity = this.GetEntity(AMS_SysLogBLL.Instance.GetKeyFieldValue<BASE_COMPANY>(entity).ToString()); #endregion int IsOk = DbUtils.Update(entity, "OrganizationId"); #region 写日操作日志 if (IsOk > 0) { AMS_SysLogBLL.Instance.UpdateTaskLog<BASE_COMPANY>(oldEntity, entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName); } #endregion return IsOk >= 0 ? true : false; }
public JsonResult CheckLogin() { string Account = Request.Form["Account"]; //账户 string Pwd = Request.Form["Password"]; //密码 BASE_USERBLL BASE_USERibll = new BASE_USERBLL(); BASE_USER BASE_USER = new BASE_USER(); BASE_COMPANYBLL BASE_COMPANYibll = new BASE_COMPANYBLL(); BASE_COMPANY BASE_COMPANY = new BASE_COMPANY(); AMS_SysLogBLL ams_syslogibll = new AMS_SysLogBLL(); AMS_IPBlacklistBLL ams_ipblacklistibll = new AMS_IPBlacklistBLL(); IPScanerHelper objScan = new IPScanerHelper(); string Msg = ""; #region 登录 try { string IPAddress = RequestHelper.GetIPAddress(); objScan.IP = IPAddress; objScan.DataPath = Server.MapPath("../Themes/IPScaner/QQWry.Dat"); string IPAddressName = objScan.IPLocation(); //系统管理 if (Account == ConfigHelper.GetValue("CurrentUserName") && Md5Helper.MD5(Pwd, 32) == ConfigHelper.GetValue("CurrentPassword")) { SessionUser user = new SessionUser(); user.UserId = "System"; user.Account = "System"; user.UserName = "******"; user.Gender = 1; user.Password = ams_user.Password; user.DepartmentId = "超级管理员"; user.DepartmentName = "超级管理员"; RequestSession.AddSessionUser(user); Msg = "3";//验证成功 ams_syslogibll.AddSysLoginLog(ams_user.Account, "登录成功", IPAddress, IPAddressName); } else { #region 验证 ams_ipblacklistibll.TheIpIsRange(IPAddress); string outmsg; ams_user = ams_useribll.UserLogin(Account.Trim(), Pwd.Trim(), out outmsg); if (outmsg != "-1") { if (outmsg == "succeed") { if (ams_user.Enabled == 1) { string DepartmentName = ""; ams_organization = ams_organizationibll.GetEntity(ams_user.DepartmentId); if (ams_organization != null) { DepartmentName = ams_organization.FullName; } SessionUser user = new SessionUser(); user.UserId = ams_user.UserId; user.Account = ams_user.Account; user.UserName = ams_user.RealName; user.Gender = ams_user.Gender; user.Password = ams_user.Password; user.Secretkey = ams_user.Secretkey; user.DepartmentId = ams_user.DepartmentId; user.DepartmentName = DepartmentName; RequestSession.AddSessionUser(user); Msg = "3";//验证成功 ams_syslogibll.AddSysLoginLog(ams_user.Account, "登录成功", IPAddress, IPAddressName); } else { Msg = "2";//账户锁定 ams_syslogibll.AddSysLoginLog(ams_user.Account, "账户锁定", IPAddress, IPAddressName); } } else { Msg = "4";//账户或者密码有错误 ams_syslogibll.AddSysLoginLog(ams_user.Account, "登录失败", IPAddress, IPAddressName); } } else if (outmsg == "-1") { Msg = "-1"; } else { Msg = DbErrorMsg.ReturnMsg;//服务连接不上 } #endregion } } catch (Exception ex) { Msg = ex.Message; } #endregion return Json(Msg); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public bool Insert(BASE_COMPANY entity) { //return dal.Insert(entity) >= 0 ? true : false; entity.sortcode = CommonHelper.GetInt(this.GetMaxCode()); int IsOk = DbUtils.Insert(entity); #region 写入操作日志 if (IsOk > 0) { AMS_SysLogBLL.Instance.AddTaskLog<BASE_COMPANY>(entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName); } #endregion return IsOk >= 0 ? true : false; ; }