Exemplo n.º 1
0
        //查询列表
        public IQueryable <BaseCase> GetAllAuthorizeAndSelfQuery(Infrastructure.Identity.Model.User user, int?version, string borrownname, string caseNum)
        {
            var pers      = GetDataPermission(user);
            var predicate = PredicateBuilder.True <BaseCase>();

            predicate = predicate.And(testc => pers.Contains(testc.DistrictID));
            predicate = predicate.And(testc => pers.Contains(testc.SalesGroupID));
            predicate = predicate.And(t => t.Version > 0);
            predicate = predicate.Or(t => t.CreateUser == user.UserName);
            var ulist = base.GetAll(predicate);

            if (version != null)
            {
                ulist = ulist.Where(t => t.Version == version);
            }
            if (!string.IsNullOrEmpty(borrownname) && !string.IsNullOrWhiteSpace(borrownname))
            {
                ulist = ulist.Where(t => t.BorrowerName.Contains(borrownname));
            }
            if (!string.IsNullOrEmpty(caseNum) && !string.IsNullOrWhiteSpace(caseNum))
            {
                ulist = ulist.Where(t => t.NewCaseNum.Contains(caseNum));
            }
            ulist = ulist.OrderByDescending(t => t.CaseNum);

            return(ulist);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取限制数据权限后的最新版本案件
        /// 数据权限限制为分公司或者创建者
        /// yanminchun 2016-10-12 增加数据权限限制
        /// </summary>
        /// <param name="key"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public BaseAudit GetAuthorizeAndSelf(object key, Infrastructure.Identity.Model.User user)
        {
            var entity = base.Get(key);

            if (entity == null)
            {
                return(null);
            }
            var maxentity = GetAll().Where(t => t.NewCaseNum == entity.NewCaseNum).OrderByDescending(t => t.Version).FirstOrDefault();

            if (entity.Version < 0 || entity.Version != maxentity.Version)
            {
                return(null);
            }
            var pers = GetDataPermission(user);

            if (((pers.Contains(entity.DistrictID) && pers.Contains(entity.SalesGroupID)) || entity.CreateUser == user.UserName))
            {
                return(entity);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        public IEnumerable <BaseAuditDTO> GetAll(Infrastructure.Identity.Model.User user)
        {
            var             pers          = GetDataPermission(user.Id);
            BaseAuditDTODAL bad           = new BaseAuditDTODAL();
            var             basrauditlist = bad.GetAllBySql("SELECT * FROM baseauditview");
            var             ulist         = basrauditlist.Where(s => pers.Contains(s.SalesGroupID));

            if (pers.Contains(CaseMode.WeiXuanZe) && pers.Contains(CaseMode.ZiYouZiJin))
            {
                ulist = ulist.Where(t => t.CaseMode == CaseMode.ZiYouZiJin || pers.Contains(t.ThirdParty) || t.ThirdParty == null);
            }
            else if (pers.Contains(CaseMode.ZiYouZiJin))
            {
                ulist = ulist.Where(t => t.CaseMode == CaseMode.ZiYouZiJin || pers.Contains(t.ThirdParty));
            }
            else if (pers.Contains(CaseMode.WeiXuanZe))
            {
                ulist = ulist.Where(t => pers.Contains(t.ThirdParty) || (t.ThirdParty == null && t.CaseMode == null));
            }
            else
            {
                ulist = ulist.Where(t => pers.Contains(t.ThirdParty));
            }
            ulist = ulist.OrderByDescending(t => t.CaseNum);

            return(ulist);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取限制数据权限后的数据
        /// 数据权限限制为分公司或者创建者
        /// yanminchun 2016-10-12 增加数据权限限制
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public IQueryable <BaseAudit> GetAllAuthorizeAndSelf(Infrastructure.Identity.Model.User user)
        {
            var pers = GetDataPermission(user);
            var list = base.GetAll();

            list = list.Where(t => t.Version >= 0 && ((pers.Contains(t.DistrictID) && pers.Contains(t.SalesGroupID)) || t.CreateUser == user.UserName));
            list = list.GroupBy(t => t.CaseNum, (x, xs) => xs.OrderByDescending(a => a.Version).FirstOrDefault());
            return(list);
        }
Exemplo n.º 5
0
        public bool RejectCase(string id, Infrastructure.Identity.Model.User user)
        {
            AuditHelp    ah        = new AuditHelp();
            BaseAuditDAL bad       = new BaseAuditDAL();
            var          baseaduit = bad.GetAuthorizeAndSelf(id, user);

            if (baseaduit != null && baseaduit.CaseStatus == CaseStatus.Lending)
            {
                //     baseaduit.CreateUser = createUser;
                ah.CopyBaseAudit(baseaduit, user.UserName, CaseStatus.SpecialClose);
                return(true);
            }
            return(false);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取限制数据权限后的数据
        /// 数据权限限制为分公司或者创建者
        /// yanminchun 2016-10-12 增加数据权限限制
        /// </summary>
        /// <param name="user"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public Lending GetAuthorizeAndSelf(object key, Infrastructure.Identity.Model.User user)
        {
            BaseAuditDAL bd   = new BaseAuditDAL();
            var          curr = bd.GetAuthorizeAndSelf(key, user);

            if (curr != null)
            {
                var aud = bd.GetbyCaseSataus(curr.NewCaseNum, CaseStatus.Lending);
                if (aud != null)
                {
                    return(base.Get(aud.ID));
                }
            }
            return(null);
        }
Exemplo n.º 7
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            UserDAL userdal = new UserDAL();

            Infrastructure.Identity.Model.User user = new Infrastructure.Identity.Model.User();
            user.DisplayName = model.DisplayName;
            user.Password    = model.Password;
            user.UserName    = model.LoginName;
            IdentityResult result = await userdal.Create(user);

            if (result.Succeeded)
            {
                return(Content("Success"));
            }
            else
            {
                return(Content("Failed"));
            }
        }
Exemplo n.º 8
0
        public BaseCase GetAuthorizeAndSelf(object key, Infrastructure.Identity.Model.User user)
        {
            var entity = base.Get(key);

            if (entity == null)
            {
                return(null);
            }

            var pers = GetDataPermission(user);

            if (((pers.Contains(entity.DistrictID) && pers.Contains(entity.SalesGroupID)) || entity.CreateUser == user.UserName))
            {
                return(entity);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取限制数据权限后的数据
        /// 数据权限限制为分公司或者创建者
        /// yanminchun 2016-10-12 增加数据权限限制
        /// </summary>
        /// <param name="casestatus"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public IQueryable <BaseAudit> GetAllAuthorizeAndSelfByPublic(string casestatus, Infrastructure.Identity.Model.User user)
        {
            var pers      = GetDataPermission(user);
            var predicate = PredicateBuilder.True <BaseAudit>();

            predicate = predicate.And(testc => pers.Contains(testc.DistrictID));
            predicate = predicate.And(testc => pers.Contains(testc.SalesGroupID));
            predicate = predicate.Or(t => t.CreateUser == user.UserName);
            var list = base.GetAll(predicate).Where(t => t.Version >= 0 && t.CaseStatus == casestatus).GroupBy(t => t.CaseNum, (x, xs) => xs.OrderByDescending(a => a.Version).FirstOrDefault());
            // var list = base.GetAll().Where(t => t.Version >= 0 && t.CaseStatus == casestatus);
            var statuslist = this.GetAll();
            var returnlist = from i in statuslist
                             join j in list
                             on i.NewCaseNum equals j.NewCaseNum
                             select i;

            return(returnlist);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取限制数据权限后的数据
        /// 数据权限限制为分公司或者创建者
        /// yanminchun 2016-10-12 增加数据权限限制
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public IQueryable <BaseAudit> GetAllAuthorizeAndSelf(DateTime?start, DateTime?end, Infrastructure.Identity.Model.User user)
        {
            BaseAuditDAL bd        = new BaseAuditDAL();
            var          pers      = GetDataPermission(user);
            var          predicate = PredicateBuilder.True <BaseAudit>();

            predicate = predicate.And(testc => pers.Contains(testc.DistrictID));
            predicate = predicate.And(testc => pers.Contains(testc.SalesGroupID));
            predicate = predicate.Or(t => t.CreateUser == user.UserName);

            var modellist = bd.GetHasStatus(CaseStatus.Lending);

            modellist = modellist.Where(predicate);
            if (start != null)
            {
                var starttime = new DateTime(start.Value.Year, start.Value.Month, start.Value.Day).AddSeconds(-1);
                modellist = modellist.Where(t => t.LendingDate >= starttime);
            }
            if (end != null)
            {
                var endtime = new DateTime(end.Value.Year, end.Value.Month, end.Value.Day).AddDays(1);
                modellist = modellist.Where(t => t.LendingDate < endtime);
            }

            return(modellist);
        }