示例#1
0
        public ActionResult GetMeasuresPageList(Pagination pagination, string queryJson)
        {
            var      watch      = CommonHelper.TimerStart();
            Operator opertator  = new OperatorProvider().Current();
            var      queryParam = queryJson.ToJObject();

            if (pagination.p_fields.IsEmpty())
            {
                pagination.p_fields = "worktask,dangerpoint,measures,createuserid,createuserorgcode,createuserdeptcode,isover,remark,remark1";
            }
            pagination.p_kid         = "id";
            pagination.p_tablename   = @"epg_workmeetingmeasures";
            pagination.conditionJson = " 1=1 ";
            if (!queryParam["recid"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and  workmeetingid ='{0}'", queryParam["recid"].ToString());
            }
            var data     = workMeetingbll.GetPageList(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
        /// <summary>
        /// 导出json
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public ActionResult ExportData(string queryJson)
        {
            try
            {
                var        watch      = CommonHelper.TimerStart();
                Pagination pagination = new Pagination();
                pagination.page = 1;
                pagination.rows = 100000000;
                Operator opertator = new OperatorProvider().Current();
                pagination.p_tablename   = " bis_pagetemplate a ";
                pagination.p_fields      = "organizeid,organizename,templatename,filename,templatecode,templatetype,relativepath,modulename,isenable,templatecontent";
                pagination.p_kid         = "id";
                pagination.conditionJson = " 1=1";
                var queryParam = queryJson.ToJObject();

                //机构
                if (!string.IsNullOrEmpty(queryParam["organizeid"].ToString()))
                {
                    pagination.conditionJson += string.Format(@" and a.organizeid = '{0}'", queryParam["organizeid"].ToString());
                }
                //模块名称
                if (!string.IsNullOrEmpty(queryParam["modulename"].ToString()))
                {
                    pagination.conditionJson += string.Format(@" and a.modulename like '%{0}%'", queryParam["modulename"].ToString());
                }
                //模板代码
                if (!string.IsNullOrEmpty(queryParam["templatecode"].ToString()))
                {
                    pagination.conditionJson += string.Format(@" and a.templatecode like '%{0}%'", queryParam["templatecode"].ToString());
                }
                //模板名称
                if (!string.IsNullOrEmpty(queryParam["templatename"].ToString()))
                {
                    pagination.conditionJson += string.Format(@" and a.templatename like '%{0}%'", queryParam["templatename"].ToString());
                }
                //模板类型
                if (!string.IsNullOrEmpty(queryParam["templatetype"].ToString()))
                {
                    pagination.conditionJson += string.Format(@" and a.templatetype like '%{0}%'", queryParam["templatetype"].ToString());
                }
                var data = lllegalregisterbll.GetGeneralQuery(pagination);
                data.Columns.Remove("r");
                string resultJson = JsonConvert.SerializeObject(data);

                Response.Clear();
                Response.Buffer          = true;
                Response.Charset         = "UTF-8";
                Response.ContentEncoding = Encoding.UTF8;
                string filename = "pagetemplate_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".json";
                Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
                Response.Write(resultJson.ToString());
                Response.End();

                return(Success("操作成功。"));
            }
            catch (Exception ex)
            {
                return(Error(ex.Message));
            }
        }
        /// <summary>
        /// 判断人员是否公司
        /// </summary>
        /// <returns></returns>
        public ActionResult QueryCurUser()
        {
            string result = "";

            var curUser = new OperatorProvider().Current(); //当前用户

            string hidPlantLevel = dataitemdetailbll.GetItemValue("HidPlantLevel");

            string hidOrganize = dataitemdetailbll.GetItemValue("HidOrganize");

            string CompanyRole = hidPlantLevel + "," + hidOrganize;


            var userList = userbll.GetUserListByDeptCode(curUser.DeptCode, CompanyRole, false, curUser.OrganizeId).Where(p => p.UserId == curUser.UserId).ToList();

            //当前用户是厂级
            if (userList.Count() > 0)
            {
                result = "1";
            }
            else
            {
                result = "0";
            }

            return(Content(result));
        }
示例#4
0
        public int GetHiddenTroubleNum(string Id, string DutyUserId)
        {
            try
            {
                int        page = 1, rows = 9999999;
                Pagination pagination = new Pagination();

                pagination.page = page; //页数
                pagination.rows = rows; //行数

                JObject  queryJson = new JObject();
                Operator opertator = new OperatorProvider().Current();
                string   userId    = opertator.UserId;
                queryJson.Add(new JProperty("userId", DutyUserId));
                queryJson.Add(new JProperty("isPlanLevel", opertator.isPlanLevel));
                queryJson.Add(new JProperty("RelevanceId", Id));
                queryJson.Add(new JProperty("RelevanceType", "KeyPart"));
                var data = htbaseinfobll.GetHiddenBaseInfoPageList(pagination, queryJson.ToString());
                return(data.Rows.Count);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //验证是否已经登陆过,如果已经登录过,则直接跳转到default界面即可
            if (OperatorProvider.Provider.GetCurrent() != null)
            {
                //当前session在全局的session信息是否被强制下线验证,如果已经强制下线,则返回提示信息。
                if (OperatorProvider.CheckIsNoLogin())
                {
                    OperatorProvider.RemoveFromAllProvider();
                }
                else
                {
                    Response.Redirect("/Default.aspx");
                }
                //WebHelper.WriteCookie("LT_login_error", "overdue");
                //string str = "<script type='text/javascript'>top.location.href = '/Login/Index';</script>";
                //filterContext.Result = new ContentResult() { Content = str };
            }
            if (!LtCore.initState)
            {
                string url = "/WebMaster/Error/error.htm?msg=系统初始化错误&detail=请联系管理员,查看系统日志解决";
                Response.Redirect(url);
            }


            if (!Licence.Target.LoginCheckLicence(out licenceMsg))
            {
                string url = "/WebMaster/Error/error.htm?msg=授权验证问题&detail=" + licenceMsg;
                Response.Redirect(url);
            }
        }
示例#6
0
        private static void LoadProvider()
        {
            // if we do not have initiated the provider
            if (_provider == null)
            {
                lock (_lock)
                {
                    // Do this again to make sure _provider is still null
                    if (_provider == null)
                    {
                        // Get a reference to the <requestService> section
                        OperatorServiceSection section = (OperatorServiceSection)WebConfigurationManager.GetSection("LCSK/operatorService");

                        // Load the default provider
                        if (section.Providers.Count > 0 && !string.IsNullOrEmpty(section.DefaultProvider) && section.Providers[section.DefaultProvider] != null)
                        {
                            _provider = (OperatorProvider)ProvidersHelper.InstantiateProvider(section.Providers[section.DefaultProvider], typeof(OperatorProvider));
                        }

                        if (_provider == null)
                        {
                            throw new ProviderException("Unable to load the OperatorProvider");
                        }
                    }
                }
            }
        }
示例#7
0
        /// <summary>
        /// 使用session暂存登录用户信息
        /// </summary>
        /// <param name="userEntity"></param>
        public void SaveUserSession(AppUser userEntity)
        {
            OperatorProvider op = OperatorProvider.Provider;

            bool isSystem = this.IsSystem(userEntity.Id);

            //保存用户信息
            op.CurrentUser = new OperatorModel
            {
                UserId          = userEntity.Id,
                IsSystem        = isSystem,
                IsAdmin         = userEntity.LoginName == "admin"?true:false,
                LoginName       = userEntity.LoginName,
                LoginToken      = Guid.NewGuid().ToString(),
                UserCode        = "1234",
                LoginTime       = DateTime.Now,
                NickName        = userEntity.NickName,
                Avatar          = userEntity.Avatar,
                Email           = userEntity.Email,
                PersonalWebsite = userEntity.PersonalWebsite
            };
            //缓存存放单点登录信息
            ICache cache = CacheFactory.Cache();

            op.Session[userEntity.Id.ToString()] = userEntity.LoginName;//必须使用这个存储一下session,否则sessionid在每一次请求的时候,都会为变更
            cache.WriteCache <string>(userEntity.Id.ToString(), op.Session.SessionID, DateTime.UtcNow.AddMinutes(60));

            //登录权限分配,根据用户Id获取用户所拥有的权限,可以在登录之后的Home界面中统一获取。

            _iRedisHelper.KeyDeleteAsync(string.Format(ConstHelper.AppModule, "AuthorizeUrl_" + userEntity.Id));
        }
示例#8
0
        /// <summary>
        /// 用户注销操作
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string Logout(HttpContext context)
        {
            OperatorModel op = OperatorProvider.Provider.GetCurrent();

            //日志输出的对象,注销前先构造好,注销完成后,直接输入到日志
            BaseSysLogModel sysLog = new BaseSysLogModel();

            sysLog.F_System       = Configs.GetSetting("systemFlag");
            sysLog.F_Module       = "登录注销";
            sysLog.F_OptType      = "注销";
            sysLog.F_OptContent   = string.Format("用户{0}({1})注销系统。", op.UserName, op.UserCode);
            sysLog.F_CreateUserId = op.UserId;

            //删除掉当前session的登录记录信息
            string providerMsg = OperatorProvider.RemoveFromAllProvider();

            //删除掉当前session缓存的信息
            OperatorProvider.Provider.RemoveCurrent();
            if (!OperatorProvider.AllProvider.ContainsValue(providerMsg))   //该帐号注销后,检测是否还有该值得信息存在
            {
                userLoginBll.LogoutUpdate(op.LoginToken);
            }

            //记录注销登录日志
            SysLogProvider.GetInstance().WirteSysLog(sysLog);

            return(SuccessResult("注销成功!"));
        }
        public ActionResult GetLllegalDepartListJsonGrp()
        {
            Operator opertator = new OperatorProvider().Current();
            var      data      = new DepartmentBLL().GetList().Where(t => t.DeptCode.StartsWith(opertator.OrganizeCode) && (t.Nature == "集团" || t.Nature == "分子公司" || t.Nature == "电厂" || t.Nature == "厂级"));
            var      listDept  = data.OrderBy(x => x.DeptCode).Select(x => { return(new { DeptId = x.DepartmentId, DeptName = x.FullName }); });

            return(Content(listDept.ToJson()));
        }
        public ActionResult QueryExposureLllegal(string num)
        {
            Operator curUser = new OperatorProvider().Current();

            var data = legbll.QueryExposureLllegal(num);

            return(Content(data.ToJson()));
        }
示例#11
0
        /// <summary>
        /// 退出登录
        /// </summary>
        /// <returns></returns>
        public ActionResult Logout()
        {
            OperatorProvider op = OperatorProvider.Provider;

            op.RemoveCurrent();
            FormsAuthentication.SignOut();
            return(RedirectToAction("Index", "App"));
        }
示例#12
0
        /// <summary>
        /// 大神主页
        /// </summary>
        /// <returns></returns>
        public ActionResult ManitoHomepage()
        {
            var user = new OperatorProvider <FrontCurrentUser>().GetCurrent();

            ViewData.Model     = user as FrontCurrentUser;
            ViewBag.FocusCount = IocUtils.Resolve <IFocusService>().GetFocusList(user.UserId, true).Count;
            ViewBag.FansCount  = IocUtils.Resolve <IFocusService>().GetFocusList(user.UserId, false).Count;
            return(View());
        }
示例#13
0
        public ActionResult GetListJson(Pagination pagination, string queryJson)
        {
            var      watch      = CommonHelper.TimerStart();
            var      queryParam = queryJson.ToJObject();
            Operator opertator  = new OperatorProvider().Current();

            if (pagination.p_fields.IsEmpty())
            {
                pagination.p_fields = @"a.autoid,a.createdate,a.createuserid,a.createuserdeptcode,a.createuserorgcode,a.modifydate,a.modifyuserid,a.belongmodule,a.belongmodulecode,
             a.moduleno,a.modulename,a.flowname,a.checkdeptid,a.checkdeptcode,a.checkdeptname,a.checkroleid,a.checkrolename,a.remark,b.fullname orginezename,a.serialnum";
            }
            pagination.p_kid         = "id";
            pagination.p_tablename   = @"bis_manypowercheck a left join base_department b on a.createuserorgcode = b.encode";
            pagination.conditionJson = " 1=1";
            string authWhere = new AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value, "CREATEUSERDEPTCODE", "CREATEUSERORGCODE");

            if (!string.IsNullOrEmpty(authWhere))
            {//数据权限,含系统管理员添加的数据。
                pagination.conditionJson += " and (" + authWhere + " or a.CREATEUSERORGCODE='00')";
            }
            else
            {
                pagination.conditionJson += " and a.CREATEUSERORGCODE='" + opertator.OrganizeCode + "'";
            }
            //模块名称
            if (!queryParam["modulename"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and  a.moduleno = '{0}' ", queryParam["modulename"].ToString());
            }
            //审核部门名称
            if (!queryParam["checkdeptname"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and a.checkdeptname like '%{0}%'", queryParam["checkdeptname"].ToString());
            }
            //角色名称
            if (!queryParam["checkrolename"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and a.checkrolename like '%{0}%'", queryParam["checkrolename"].ToString());
            }
            //所属模块
            if (!queryParam["belongmodule"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and a.belongmodulecode = '{0}'", queryParam["belongmodule"].ToString());
            }

            var data     = manyPowerCheckbll.GetManyPowerCheckEntityPage(pagination, queryJson);
            var JsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
示例#14
0
        public void AddNumbersAndReturnResult_WhenCalledWithOutNumbers()
        {
            var calculator = new Calculator();

            var operatorProvider = new OperatorProvider();
            var total            = calculator.Run(operatorProvider.GetByOperation(Operation.Add), null, operatorProvider.GetSymbolByOperation(Operation.Add));

            total.ShouldBe(0);
        }
示例#15
0
        public void AddNumbersAndReturnResult_WhenCalledWithNegativeNumbers()
        {
            var calculator       = new Calculator();
            var operatorProvider = new OperatorProvider();
            var total            = calculator.Run(operatorProvider.GetByOperation(Operation.Add),
                                                  (new[] { (decimal) - 1.1, (decimal)6, (decimal) - 3, (decimal)2.4 }),
                                                  operatorProvider.GetSymbolByOperation(Operation.Add));

            total.ShouldBe((decimal)(-1.1 + 6 - 3 + 2.4));
        }
示例#16
0
        public void SubtractNumbersAndReturnResult_WhenCalled(decimal[] numbers)
        {
            var calculator = new Calculator();

            var operatorProvider = new OperatorProvider();
            var total            = calculator.Run(operatorProvider.GetByOperation(Operation.Subtract), numbers, operatorProvider.GetSymbolByOperation(Operation.Divide));

            decimal expectedResults = numbers[0] - numbers[1] - numbers[2];

            total.ShouldBe(expectedResults);
        }
示例#17
0
        // GET: UserManage/User
        public ActionResult Index()
        {
            var user = new OperatorProvider <FrontCurrentUser>().GetCurrent();

            ViewData.Model      = user as FrontCurrentUser;
            ViewBag.FreezeMoney = IocUtils.Resolve <IMoneyService>().UserMoney(user.UserId, false);
            ViewBag.UsableMoney = IocUtils.Resolve <IMoneyService>().UserMoney(user.UserId, true);
            ViewBag.FocusCount  = IocUtils.Resolve <IFocusService>().GetFocusList(user.UserId, true).Count;
            ViewBag.FansCount   = IocUtils.Resolve <IFocusService>().GetFocusList(user.UserId, false).Count;
            return(View());
        }
        public ActionResult GetListJson(string orgId)
        {
            var curUser = new OperatorProvider().Current();

            if (string.IsNullOrEmpty(orgId))
            {
                orgId = curUser.OrganizeId;
            }
            var data = classificationbll.GetList(orgId);

            return(ToJsonResult(data));
        }
示例#19
0
        public ActionResult GetAreaListJson(string areaId = "", string mode = "", string planId = "", string dataType = "", string areaName = "")
        {
            DangerSourceBLL       dsBll        = new DangerSourceBLL();
            var                   curUser      = new OperatorProvider().Current();
            List <DistrictEntity> list         = bis_districtbll.GetList().Where(p => p.OrganizeId == curUser.OrganizeId).ToList();
            List <DistrictEntity> districtdata = list.Where(p => p.DistrictCode.Contains(curUser.OrganizeCode) && p.DistrictID != "0").ToList();

            RiskPlanBLL plan = new RiskPlanBLL();
            string      ids  = plan.GetPlanAreaIds(0, planId);

            if (dataType.Equals("0") && string.IsNullOrEmpty(ids))
            {
                areaId = "-1";
            }
            if (dataType.Equals("0"))
            {
                districtdata = districtdata.Where(t => !ids.Contains(t.DistrictID)).ToList();
            }
            else
            {
                districtdata = districtdata.Where(t => areaId.Contains(t.DistrictID)).ToList();
            }
            List <DistrictEntity> list1 = new List <DistrictEntity>();

            foreach (DistrictEntity item in districtdata)
            {
                bool hasChildren = list.Count(t => t.ParentID == item.DistrictID) == 0 ? false : true;
                if (!hasChildren)
                {
                    item.Description  = item.DistrictName;
                    item.DistrictName = dsBll.GetPathName(item.DistrictCode, curUser.OrganizeId);
                    list1.Add(item);
                }
                else
                {
                    item.Description = item.DistrictName;
                    list1.Add(item);
                }
            }
            if (!string.IsNullOrWhiteSpace(areaName))
            {
                list1 = list1.Where(t => t.DistrictName.Contains(areaName.Trim())).ToList();
            }
            var JsonData = new
            {
                rows    = list1.OrderBy(t => t.DistrictCode).ThenBy(t => t.SortCode).ToList(),
                total   = 1,
                page    = 1,
                records = districtdata.Count
            };

            return(Content(JsonData.ToJson()));
        }
        public ActionResult LoginOn(string username, string password, string captcha)
        {
            LogonLogModel logEntity        = new LogonLogModel();
            var           OperatorProvider = new OperatorProvider(HttpContext);

            logEntity.LogType = DbLogType.Login.ToString();
            try
            {
                if (OperatorProvider.WebHelper.GetSession("session_verifycode").IsEmpty() || Md5.md5(captcha.ToLower(), 16) != OperatorProvider.WebHelper.GetSession("session_verifycode"))
                {
                    throw new Exception("验证码错误");
                }
                UserModel userEntity = UserService.LoginOn(username, Md5.md5(password, 32));
                if (userEntity != null)
                {
                    if (userEntity.EnabledMark == 1)
                    {
                        throw new Exception("账号被锁定,禁止登录");
                    }
                    OperatorModel operatorModel = new OperatorModel();
                    operatorModel.UserId             = userEntity.Id;
                    operatorModel.Account            = userEntity.Account;
                    operatorModel.RealName           = userEntity.RealName;
                    operatorModel.HeadIcon           = userEntity.HeadIcon;
                    operatorModel.RoleId             = userEntity.RoleId;
                    operatorModel.LoginIPAddress     = httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();
                    operatorModel.LoginIPAddressName = httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();
                    OperatorProvider.AddCurrent(operatorModel);
                    logEntity.Account     = userEntity.Account;
                    logEntity.RealName    = userEntity.RealName;
                    logEntity.Description = "登陆成功";
                    LogonLogService.WriteDbLog(logEntity, operatorModel.LoginIPAddress, operatorModel.LoginIPAddressName);
                    return(Content(new AjaxResult {
                        state = ResultType.success.ToString(), message = "登录成功"
                    }.ToJson()));
                }
                else
                {
                    throw new Exception("用户名或密码错误");
                }
            }
            catch (Exception ex)
            {
                logEntity.Account     = username;
                logEntity.RealName    = username;
                logEntity.Description = "登录失败," + ex.Message;
                LogonLogService.WriteDbLog(logEntity, HttpContext.Connection.RemoteIpAddress.ToString(), HttpContext.Connection.RemoteIpAddress.ToString());
                return(Content(new AjaxResult {
                    state = ResultType.error.ToString(), message = ex.Message
                }.ToJson()));
            }
        }
示例#21
0
        /// <summary>
        /// 当前登录用户的菜单权限
        /// </summary>
        /// <returns>List树形递归数据</returns>
        private List <TreeNode> GetMenuList()
        {
            OperatorProvider op = OperatorProvider.Provider;
            //权限为空时,根据当前登录的用户Id,获取权限模块数据

            var userModuleEntities = _appModuleService.GetUserModules(op.CurrentUser.UserId);

            List <AppModule> userMenuEntities = userModuleEntities.Where(u => u.TypeCode != ModuleCode.Button.ToString() && u.TypeCode != ModuleCode.Permission.ToString()).ToList();

            List <TreeNode> treeNodes = AppModule.ConvertTreeNodes(userMenuEntities);

            return(treeNodes);
        }
示例#22
0
        public ActionResult GetListJson(Pagination pagination, string queryJson)
        {
            var      watch      = CommonHelper.TimerStart();
            var      queryParam = queryJson.ToJObject();
            Operator opertator  = new OperatorProvider().Current();

            if (pagination.p_fields.IsEmpty())
            {
                pagination.p_fields = @"createdate,createuserid,createuserdeptcode,createuserorgcode,modifydate,modifyuserid,des,leglevel,legLevalName,legtype,legTypeName,bustype,busTypeName,descore,demoney,firstdescore,firstdemoney,seconddescore,seconddemoney,remark";
            }
            pagination.p_kid         = "id";
            pagination.p_tablename   = @"v_lllegalstdinfo";
            pagination.conditionJson = " 1=1";
            string authWhere = new AuthorizeBLL().GetModuleDataAuthority(ERCHTMS.Code.OperatorProvider.Provider.Current(), HttpContext.Request.Cookies["currentmoduleId"].Value, "CREATEUSERDEPTCODE", "CREATEUSERORGCODE");

            if (!string.IsNullOrEmpty(authWhere))
            {//数据权限,含系统管理员添加的数据。
                pagination.conditionJson += " and (" + authWhere + " or CREATEUSERORGCODE='00')";
            }
            else
            {
                pagination.conditionJson += " and CREATEUSERORGCODE='" + opertator.OrganizeCode + "'";
            }

            //违章类型
            if (!queryParam["lllegaltype"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and  legtype='{0}' ", queryParam["lllegaltype"].ToString());
            }
            //违章级别
            if (!queryParam["lllegallevel"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and leglevel ='{0}'", queryParam["lllegallevel"].ToString());
            }
            //违章描述
            if (!queryParam["lllegaldescribe"].IsEmpty())
            {
                pagination.conditionJson += string.Format(@" and des like '%{0}%'", queryParam["lllegaldescribe"].ToString());
            }
            var data     = lllegalstandardbll.GetLllegalStdInfo(pagination, queryJson);
            var JsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
        public ActionResult LoginOut()
        {
            var OperatorProvider = new OperatorProvider(HttpContext);

            LogonLogService.WriteDbLog(new LogonLogModel
            {
                LogType     = DbLogType.Exit.ToString(),
                Account     = OperatorProvider.GetCurrent().Account,
                RealName    = OperatorProvider.GetCurrent().RealName,
                Description = "安全退出系统",
            }, HttpContext.Connection.RemoteIpAddress.ToString(), HttpContext.Connection.RemoteIpAddress.ToString());
            OperatorProvider.WebHelper.ClearSession();
            OperatorProvider.RemoveCurrent();
            return(RedirectToAction("Index", "Login"));
        }
示例#24
0
        public ActionResult Mock()
        {
            OperatorProvider op = OperatorProvider.Provider;

            op.CurrentUser = new OperatorModel
            {
                UserId     = 2,
                IsSystem   = true,
                LoginName  = "admin",
                LoginToken = Guid.NewGuid().ToString(),
                UserCode   = "1234",
            };
            HttpRuntime.Cache[op.CurrentUser.UserId.ToString()] = Session.SessionID;
            return(Success());
        }
示例#25
0
        public ActionResult GetListJson(Pagination pagination, string queryJson)
        {
            var      watch     = CommonHelper.TimerStart();
            Operator opertator = new OperatorProvider().Current();

            pagination.p_tablename   = " bis_pagetemplate a ";
            pagination.p_fields      = "organizeid,organizename,templatename,filename,templatecode,templatetype,relativepath,modulename,isenable";
            pagination.p_kid         = "id";
            pagination.conditionJson = " 1=1";
            var queryParam = queryJson.ToJObject();

            //机构
            if (!string.IsNullOrEmpty(queryParam["organizeid"].ToString()))
            {
                pagination.conditionJson += string.Format(@" and a.organizeid = '{0}'", queryParam["organizeid"].ToString());
            }
            //模块名称
            if (!string.IsNullOrEmpty(queryParam["modulename"].ToString()))
            {
                pagination.conditionJson += string.Format(@" and a.modulename like '%{0}%'", queryParam["modulename"].ToString());
            }
            //模板代码
            if (!string.IsNullOrEmpty(queryParam["templatecode"].ToString()))
            {
                pagination.conditionJson += string.Format(@" and a.templatecode like '%{0}%'", queryParam["templatecode"].ToString());
            }
            //模板名称
            if (!string.IsNullOrEmpty(queryParam["templatename"].ToString()))
            {
                pagination.conditionJson += string.Format(@" and a.templatename like '%{0}%'", queryParam["templatename"].ToString());
            }
            //模板类型
            if (!string.IsNullOrEmpty(queryParam["templatetype"].ToString()))
            {
                pagination.conditionJson += string.Format(@" and a.templatetype like '%{0}%'", queryParam["templatetype"].ToString());
            }
            var data     = lllegalregisterbll.GetGeneralQuery(pagination);
            var JsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
示例#26
0
        public void AddNumbersAndReturnResult_WhenCalled(decimal[] numbers)
        {
            var calculator = new Calculator();

            var operatorProvider = new OperatorProvider();
            var total            = calculator.Run(operatorProvider.GetByOperation(Operation.Add), numbers, operatorProvider.GetSymbolByOperation(Operation.Add));

            decimal expectedResults = 0;

            foreach (var item in numbers)
            {
                expectedResults += item;
            }

            total.ShouldBe(expectedResults);
        }
示例#27
0
        /// <summary>
        /// 登录过滤器,除了通有skip属性可以跳过登录验证的,其他操作都需要在已登录状态完成操作。
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            //当有skip验证时,去除验证登录
            bool skipignore = filterContext.ActionDescriptor.GetCustomAttributes(typeof(SkipAttribute), false).Length == 1 ||
                              filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(SkipAttribute), false);

            if (skipignore == true)
            {
                return;
            }

            OperatorProvider op = OperatorProvider.Provider;

            #region 判断用户是否登录|当前只可单个浏览器登录,即使是浏览器重开,也会导致sessionId变更,也就需要重新登录
            if (op.CurrentUser == null)
            {
                //StringBuilder sbScript = new StringBuilder();
                //sbScript.Append("<script type='text/javascript'>alert('请先登录!');top.location.href='/Login/Index?msg=noLogin'</script>");
                // filterContext.Result = new ContentResult() { Content = sbScript.ToString() };

                WebHelper.WriteCookie("mock_login_error", "Overdue");//登录已超时,请重新登录
                filterContext.Result = new RedirectResult("~/Login/Default");
            }
            else
            {
                //

                bool loginOnce = Configs.GetValue("loginOnce").ToBoolean();

                if (loginOnce)
                {
                    //当前登录信息被覆盖,说明存在多个浏览器登录的情况
                    string userid = op.CurrentUser.UserId.ToString();
                    ICache cache  = CacheFactory.Cache();
                    if (cache.GetCache <string>(userid) != op.Session.SessionID)
                    {
                        //清空Session
                        filterContext.HttpContext.Session.Remove(userid);
                        op.RemoveCurrent();
                        //跳转强制下线界面
                        this.HandleUnauthorizedRequest(filterContext);
                    }
                }
            }
            #endregion
        }
示例#28
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var      watch     = CommonHelper.TimerStart();
            Operator opertator = new OperatorProvider().Current();
            string   OrgCode   = opertator.OrganizeCode;

            queryJson = queryJson.Insert(1, "\"OrgCode\":\"" + OrgCode + "\","); //添加当前组织机构
            var data     = newsBLL.GetPageList(pagination, queryJson);
            var JsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
        public ActionResult GetColumnAuth(string moduleId)
        {
            Operator opertator = new OperatorProvider().Current();
            //系统默认的列表设置
            var defaultdata = modulelistcolumnauthbll.GetEntity(moduleId, "", 0);
            //当前用户的列表设置
            var data = modulelistcolumnauthbll.GetEntity(moduleId, opertator.UserId, 1);


            if (null != data)
            {
                var jsonData = new { data = data, isSystem = false }; //系统默认
                return(ToJsonResult(jsonData));
            }
            else
            {
                var jsonData = new { data = defaultdata, isSystem = true }; //非系统默认
                return(ToJsonResult(jsonData));
            }
        }
示例#30
0
        public void TokenDefinition_IsOperator_Arithmetic()
        {
            string[] input =
            {
                "2 * 5",
                "=="
            };

            var operatorRegex = RegexWrapper.DefaultWrap(OperatorProvider.GetPattern());

            var tokenDefinition = new TokenDefinition(TokenType.ArithmeticAndLogicOperator, operatorRegex);
            var tokensGenerated = _tokenizer.Tokenize(input).ToList();

            var operatorTokens = tokensGenerated.Where(t => t.TokenType == TokenType.ArithmeticAndLogicOperator).ToList();

            Assert.IsTrue(operatorTokens.Any());
            Assert.AreEqual(2, operatorTokens.Count());
            Assert.IsNotNull(operatorTokens.FirstOrDefault(t => t.Value == "*"));
            Assert.IsNotNull(operatorTokens.FirstOrDefault(t => t.Value == "=="));
        }