コード例 #1
0
        public string LoginLogSaveChanges(string jsonString, string action)
        {
            try
            {
                LoginLogEntity  entity  = JsonConvert.DeserializeObject <LoginLogEntity>(jsonString);
                LoginLogManager manager = new LoginLogManager();
                if (action == "add")
                {
                    if (entity == null)
                    {
                        return("error");
                    }

                    manager.Insert(entity);
                }
                else
                {
                    LoginLogEntity oldEntity = manager.GetLoginLogByGuid(entity.Guid);

                    oldEntity.StartTime = entity.StartTime;
                    oldEntity.EndTime   = entity.EndTime;

                    manager.Update(oldEntity);
                }
                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
コード例 #2
0
    private void ShowLoginLog()
    {
        TextBox txtBeginTime = this.ChoseTimeUC1.FindControl("txtBeginTime") as TextBox;
        TextBox txtEndTime   = this.ChoseTimeUC1.FindControl("txtEndTime") as TextBox;

        this.gvLoginLog.DataSource = LoginLogManager.GetAllLoginLogsByTime(txtBeginTime.Text.Trim(), txtEndTime.Text.Trim());
        this.gvLoginLog.DataBind();
    }
コード例 #3
0
ファイル: Site.Master.cs プロジェクト: sandy1else/MyWebApp
        private void SaveLog(string message, bool isSuccess)
        {
            #region Log Entry
            User     user        = (User)Session["CurrentUser"];
            string   loginId     = user.LoginId;
            string   password    = "";
            int      loginTypeId = (int)Utilites.LoginType.Logout;
            string   ipAddress   = Request.UserHostAddress;
            DateTime createdDate = DateTime.Now;
            LoginLogManager.InsertLog(loginId, password, loginTypeId, isSuccess, ipAddress, message, createdDate);

            #endregion
        }
コード例 #4
0
        private void SaveLog(string message, bool isSuccess)
        {
            #region Log Entry

            string   loginId     = inputEmail.Value.Trim();
            string   password    = inputPassword.Value.Trim();
            int      loginTypeId = (int)Utilites.LoginType.Login;
            string   ipAddress   = Request.UserHostAddress;
            DateTime createdDate = DateTime.Now;
            LoginLogManager.InsertLog(loginId, password, loginTypeId, isSuccess, ipAddress, message, createdDate);

            #endregion
        }
コード例 #5
0
        private void Initilize()
        {
            Globals.mainFrm            = this;
            _pkService                 = new PKShoutService(btn_PVPService_Start, btn_PVPService_Stop);
            _msListen                  = new MainServerListenerService(this, _pkService, btnMSLogServerStart, btnMSLogServerClose);
            Globals.LoginLogService    = _LoginManager = new LoginLogManager(btnLoginlogServiceStart, btnLoginlogServiceClose);
            _zoneServerListenerService = new ZoneServerListenerService(btnZSGameLogServiceStart, btnZSGameLogServiceClose);
            _tcp_MainServer            = new TCP_MainServer(this, btnMSClientStart, btnMSClientClose);
            _as = new AnnouncementService(as_Send_Timer, AS_Msg_List, btn_AS_Service_Start, btn_AS_Service_Close);


            LoadMaps();
        }
コード例 #6
0
        public ActionResult GetParam()
        {
            try
            {
                var x = LoginLogManager.GetInstance().GetXArry();
                var y = LoginLogManager.GetInstance().GetYArry();

                //用于饼状图表
                var name = LoginLogManager.GetInstance().GetYList();
                var info = LoginLogManager.GetInstance().GetListShowInfo();

                return(Json(new { state = 0, x = x, y = y, name = name, info = info }));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #7
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            for (int i = 1; i <= this.gvLoginLog.Rows.Count; i++)
            {
                CheckBox cboName = this.gvLoginLog.Controls[0].Controls[i].FindControl("cboName") as CheckBox;
                if (cboName.Checked == true)
                {
                    Label lblId = this.gvLoginLog.Controls[0].Controls[i].FindControl("Label8") as Label;

                    int num = LoginLogManager.DeleteLoginLogById(Convert.ToInt32(lblId.Text));
                }
            }
            Response.Write("<script>alert('删除成功!');</script>");
        }
        catch (Exception)
        {
            Response.Write("<script>alert('删除失败!');</script>");
            throw;
        }
        ShowLoginLog();
    }
コード例 #8
0
        public void GetLoginLogs(string jsonString)
        {
            //用于序列化实体类的对象
            JavaScriptSerializer jss = new JavaScriptSerializer();

            //查询条件
            LoginLogEntity entity = JsonConvert.DeserializeObject <LoginLogEntity>(jsonString);

            //请求中携带的条件
            string order    = HttpContext.Request.Params["order"];
            string sort     = HttpContext.Request.Params["sort"];
            int    offset   = Convert.ToInt32(HttpContext.Request.Params["offset"]); //0
            int    pageSize = Convert.ToInt32(HttpContext.Request.Params["limit"]);

            StringBuilder sbCondition = new StringBuilder();

            if (entity != null)
            {
                sbCondition.Append(" where 1 = 1");

                if (!string.IsNullOrWhiteSpace(entity.Type))
                {
                    sbCondition.Append(string.Format(" and Type = '{0}'", entity.Type));
                }

                if (!string.IsNullOrWhiteSpace(entity.Guid))
                {
                    sbCondition.Append(string.Format(" and Guid = '{0}'", entity.Guid));
                }

                if (entity.LoginID > 0)
                {
                    sbCondition.Append(string.Format(" and LoginID = {0}", entity.LoginID));
                }

                if (!string.IsNullOrWhiteSpace(entity.LoginName))
                {
                    sbCondition.Append(string.Format(" and LoginName = '{0}'", entity.LoginName));
                }

                if (!string.IsNullOrWhiteSpace(entity.LoginType))
                {
                    sbCondition.Append(string.Format(" and LoginType = '{0}'", entity.LoginType));
                }

                if (!string.IsNullOrWhiteSpace(entity.Action))
                {
                    sbCondition.Append(string.Format(" and Action = '{0}'", entity.Action));
                }

                if (entity.StartTime != null)
                {
                    sbCondition.Append(string.Format(" and TimeRecord >= '{0}'", entity.StartTime));
                }

                if (entity.EndTime != null)
                {
                    sbCondition.Append(string.Format(" and TimeRecord <= '{0}'", entity.EndTime));
                }
            }

            int                   total   = 0;
            LoginLogManager       manager = new LoginLogManager();
            List <LoginLogEntity> list    = manager.GetSearch(sbCondition.ToString(), sort, order, offset, pageSize, out total);

            //给分页实体赋值
            PageModels <LoginLogEntity> model = new PageModels <LoginLogEntity>();

            model.total = total;
            if (total % pageSize == 0)
            {
                model.page = total / pageSize;
            }
            else
            {
                model.page = (total / pageSize) + 1;
            }

            model.rows = list;

            //将查询结果返回
            HttpContext.Response.Write(jss.Serialize(model));
        }
コード例 #9
0
        public JsonResult GetTable(QueryRole param)
        {
            var list = LoginLogManager.GetInstance().GetShowTable(param);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
        // GET: LoginLog
        public ActionResult Index(QueryRole param)
        {
            var list = LoginLogManager.GetInstance().GetPageList(param);

            return(View(list));
        }
コード例 #11
0
        public ActionResult Login(LoginQuery query)
        {
            try
            {
                if (Session["ValidateCode"] == null)
                {
                    return(Json(new { state = 1, msg = "验证码已过期,请重新输入" }));
                }
                if (Session["ValidateCode"].ToString().ToLower() != query.ValidCode.ToLower())  //验证码忽略大小写
                {
                    return(Json(new { state = 1, msg = "验证码错误" }));
                }

                //判断用户信息
                var item = UserManager.GetInstance().GetItemByLoginName(query.LoginName);
                if (item == null)
                {
                    return(Json(new { state = 1, msg = "此用户不存在." }));
                }
                if (query.PassWord != EncryAndDecryptHelper.Decryption(item.password))
                {
                    return(Json(new { state = 1, msg = "用户密码不对." }));
                }
                var roleList = UserForRoleManager.GetInstance().GetListRole(item.id);
                if (roleList.Count == 0)
                {
                    return(Json(new { state = 1, msg = "当前用户暂未分配角色,不能使用系统." }));
                }

                //用户全部角色集合
                string arrRoleid = "";
                roleList.ForEach(m => arrRoleid += m.roleid + ",");

                //用户可查看菜单集合
                var    menulist  = RoleForMenuManager.GetInstance().GetListMenuId(roleList);
                string arrMenuid = "";
                menulist.ForEach(m => arrMenuid += m.ToString() + ",");

                //记住用户名和密码
                if (query.Rember != null)
                {
                    //放进cookie中
                    Response.Cookies.Add(new HttpCookie("cookieLoginname", query.LoginName));
                    Response.Cookies.Add(new HttpCookie("cookiePassword", query.PassWord));
                    Response.Cookies["cookieLoginname"].Expires = DateTime.Now.AddDays(3);
                    Response.Cookies["cookiePassword"].Expires  = DateTime.Now.AddDays(3);
                }
                //验证通过将用户信息记录进session
                SessionHelper.SetSession("userinfo", item);
                SessionHelper.SetSession("userid", item.id);
                SessionHelper.SetSession("username", item.username);
                SessionHelper.SetSession("rolelist", arrRoleid);                //角色集合
                SessionHelper.SetSession("menulist", menulist);                 //菜单集合
                SessionHelper.SetSessionTimeout(20);

                //写登录日志
                LoginLogManager.GetInstance().SaveItem();
                return(Json(new { state = 0, msg = "登录成功." }));
            }
            catch (Exception e)
            {
                LogHelper.log.Error(e.Message);
                return(Json(new { state = 1, msg = e.Message }));
            }
        }
コード例 #12
0
        public Control CreateControl(MetroWindow metroWindow, ClsLoginModel clsLogin, string menuId)
        {
            var control = new Control();

            switch (menuId)
            {
            case "顶部菜单管理":
                control = new TopMenuManager(metroWindow, clsLogin, menuId);
                break;

            case "左侧菜单管理":
                control = new LeftMenuManager(metroWindow, clsLogin, menuId);
                break;

            case "功能组管理":
                control = new NavBarGroupManager(metroWindow, clsLogin, menuId);
                break;

            case "登陆主题设置":
                control = new LoginThemeManager();
                break;

            case "权限管理":
                control = new RolesManager(metroWindow, clsLogin, menuId);
                break;

            case "用户管理":
                control = new UserManager(metroWindow, clsLogin, menuId);
                break;

            case "部门管理":
                control = new DeptManager(metroWindow, clsLogin, menuId);
                break;

            case "登陆日志管理":
                control = new LoginLogManager(metroWindow, clsLogin, menuId);
                break;

            case "操作员管理":
                control = new OperatorManager(metroWindow, clsLogin, menuId);
                break;

            case "公司信息设置":
                control = new CompanyEdit(clsLogin, menuId)
                {
                    Owner = metroWindow
                };
                break;

            case "修改密码":
                control = new ModifyPassword(clsLogin)
                {
                    Owner = metroWindow
                };
                break;

            case "系统初始化":
                control = new SystemInit(clsLogin)
                {
                    Owner = metroWindow
                };
                break;

            case "Banner 设置":
                control = new BannerManager(metroWindow, clsLogin, menuId);
                break;

            case "Banner 默认":
                control = new BannerDefault(metroWindow);
                break;
            }
            return(control);
        }