コード例 #1
0
ファイル: AuthFilter.cs プロジェクト: franknew/AnjuManager
        public override bool OnActionExecuting(ActionContext context)
        {
            int result = 0;
            LoginBLL logonbll = new LoginBLL();
            UserBLL userbll = new UserBLL();
            //验证没有token
            if (!context.Parameters.ContainsKey("token") || context.Parameters["token"] == null)
            {
                this.Message = "没有token!";
                context.Code = 2;
                return false;
            }
            //验证有没有登录
            string token = context.Parameters["token"].ToString();

            result = userbll.CheckUserAuth(token);
            switch (result)
            {
                case 3:
                    this.Message = "token失效,请重新登录!";
                    context.Code = result;
                    return false;
                case 4:
                    this.Message = "您没有权限进行该操作!";
                    context.Code = result;
                    return false;
            }

            return true;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: franknew/AnjuManager
 private void button11_Click(object sender, EventArgs e)
 {
     UserBLL userbll = new UserBLL();
     RentFeeBLL bll = new RentFeeBLL();
     //MonitorCache.GetInstance().PushMessage(new CacheMessage { Message = "ids:" + string.Join(",", ids) }, SOAFramework.Library.CacheEnum.FormMonitor);
     var data = bll.QueryFullHouse(new QueryHouseServiceForm { IsDeleted = 0, IsOurs = 1 });
 }
コード例 #3
0
ファイル: RentApi.cs プロジェクト: franknew/AnjuManager
 public List<FullHouse> Query(QueryHouseServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     var ids = Common.GetDataAuthorityUserIDList();
     form.IsDeleted = 0;
     form.OwnerIDs = ids;
     form.IsOurs = 1;
     //MonitorCache.GetInstance().PushMessage(new CacheMessage { Message = "ids:" + string.Join(",", ids) }, SOAFramework.Library.CacheEnum.FormMonitor);
     return bll.QueryFullHouse(form);
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: franknew/AnjuManager
 private void button10_Click(object sender, EventArgs e)
 {
     UserBLL bll = new UserBLL();
     RoleBLL rolebll = new RoleBLL();
     User_RoleDao dao = new User_RoleDao();
     var urs = dao.Query(new User_RoleQueryForm { UserID = "155f1092db4043a0b9ecd62a60ffc51d" }).ToList();
     var roleids = (from ur in urs select ur.RoleID).ToList();
     var role = rolebll.Query(new RoleQueryForm { IDs = roleids }).ToList();
     var result = rolebll.GetUserSubUserIDs("155f1092db4043a0b9ecd62a60ffc51d");
 }
コード例 #5
0
 public override bool OnActionExecuting(ActionContext context)
 {
     RoleBLL rolebll = new RoleBLL();
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser().User.ID;
     var list = rolebll.GetUserSubUserIDs(userid);
     //MonitorCache.GetInstance().PushMessage(new CacheMessage { Message = "id:"+ userid + " count:" + list.Count.ToString() }, SOAFramework.Library.CacheEnum.FormMonitor);
     context.Parameters[Common.DataAuthorityKey] = list;
     return true;
 }
コード例 #6
0
ファイル: TakeHouseApi.cs プロジェクト: franknew/AnjuManager
 public bool TaskHouse(House house)
 {
     if (house == null) throw new Exception("house不能为null");
     if (string.IsNullOrEmpty(house.ID)) throw new Exception("house.id不能为空");
     UserBLL userbll = new UserBLL();
     string userid = userbll.GetCurrentUser()?.User?.ID;
     return housebll.Update(new House
     {
         ID = house.ID,
         OwnerID = userid,
         RentFee = house.RentFee,
         RentDateStart = house.RentDateStart,
         RentDateEnd = house.RentDateEnd,
         ContractCode = house.ContractCode,
         RentRemark = house.RentRemark,
     });
 }
コード例 #7
0
ファイル: FollowupApi.cs プロジェクト: franknew/AnjuManager
 public PagingEntity<FollowupModel> QueryFullFollowup(FullFollowupQueryForm form)
 {
     HouseBLL housebll = new HouseBLL();
     BuildingBLL buildingbll = new BuildingBLL();
     UserBLL userbll = new UserBLL();
     CustomerBLL customerbll = new CustomerBLL();
     House_CustomerBLL hcbll = new House_CustomerBLL();
     PagingEntity<FollowupModel> result = new PagingEntity<FollowupModel>();
     result.Record = new List<FollowupModel>();
     var list = bll.QueryFullFollowup(form);
     var houseids = (from f in list select f.HouseID).Distinct().ToList();
     var houses = housebll.Query(new HouseQueryForm { IDs = houseids });
     var buildingids = (from h in houses select h.BuildingID).Distinct().ToList();
     var ownerids = (from h in houses where !string.IsNullOrEmpty(h.OwnerID) select h.OwnerID).Distinct().ToList();
     var userids = (from f in list select f.Creator).Distinct().ToList();
     var buildings = buildingbll.Query(new BuildingQueryForm { IDs = buildingids });
     var hcs = hcbll.Query(new House_CustomerQueryForm { HouseOrRoomIDs = houseids });
     var customerids = (from hc in hcs select hc.CustomerID).Distinct().ToList();
     var customers = customerbll.Query(new CustomerQueryForm { IDs = customerids });
     var users = userbll.SimpleQuery(new FullUserQueryForm { IDs = userids });
     list.ForEach(t =>
     {
         FollowupModel followup = new FollowupModel
         {
             House = houses.Find(p => p.ID.Equals(t.HouseID)),
             Followup = t,
             User = users.Find(p=>p.ID.Equals(t.Creator)),
         };
         followup.Building = buildings.Find(p => p.ID.Equals(followup.House?.BuildingID));
         followup.Owner = (from hc in hcs
                           join c in customers on hc.CustomerID equals c.ID
                           where hc.HouseOrRoomID.Equals(followup.House?.ID) && c.Type == (int)CustomerType.业主
                           select c).FirstOrDefault();
         result.Record.Add(followup);
     });
     result.RecordCount = bll.QueryFullFollowupCount(form);
     return result;
 }
コード例 #8
0
ファイル: BillApi.cs プロジェクト: franknew/AnjuManager
 public int GenerateBill()
 {
     UserBLL userbll = new UserBLL();
     return bll.GenerateBill(userbll.GetCurrentUser()?.User?.ID);
 }
コード例 #9
0
ファイル: HouseBLL.cs プロジェクト: franknew/AnjuManager
        public List<FullHouse> QueryFullHouse(QueryHouseServiceForm form)
        {
            List<FullHouse> list = new List<FullHouse>();
            ISqlMapper mapper = MapperHelper.GetMapper();
            UserBLL userbll = new UserBLL();

            HouseDao dao = new HouseDao(mapper);
            House_CustomerDao hcdao = new House_CustomerDao(mapper);
            CustomerDao customerdao = new CustomerDao(mapper);
            BuildingDao buildingdao = new BuildingDao(mapper);
            FollowupDao followupdao = new FollowupDao(mapper);
            form.IsDeleted = 0;
            var house = dao.QueryFullHouse(form);
            var houseids = (from h in house select h.ID).ToList();
            var hos = hcdao.Query(new House_CustomerQueryForm { HouseOrRoomIDs = houseids });
            var customerids = (from ho in hos select ho.CustomerID).Distinct().ToList();
            var customers = customerdao.Query(new CustomerQueryForm { IDs = customerids, Enabled = 1, IsDeleted = 0 });
            var buildingids = (from h in house select h.BuildingID).Distinct().ToList();
            var buidlings = buildingdao.Query(new BuildingQueryForm { IDs = buildingids });
            //var ownerids = (from h in house where !string.IsNullOrEmpty(h.OwnerID.Trim()) select h.OwnerID).Distinct().ToList();
            var users = userbll.Query(new FullUserQueryForm { Enabled = 1, IsDeleted = 0 });
            var followups = followupdao.Query(new FollowupQueryForm { HouseIDs = houseids });
            var fullfollowup = (from f in followups
                                join u in users on f.Creator equals u.ID
                                select new FullFollowup
                                {
                                    ID = f.ID,
                                    Creator = f.Creator,
                                    CreateTime = f.CreateTime,
                                    HouseID = f.HouseID,
                                    Name = f.Name,
                                    CreatorName = u.CnName,
                                    Remark = f.Remark
                                }).ToList();
            //var rentfee = rentfeebll.Query(new RentFeeQueryForm { HouseOrRoomIDs = houseids, Type = (int)HouseOrRoomType.House, Enabled = 1, IsDeleted = 0 });
            //var house_otherfee = hobll.Query(new House_OtherFeeQueryForm { HouseOrRoomIDs = houseids, Type = (int)HouseOrRoomType.House });
            //var otherfee = ofbll.Query(new OtherFeeQueryForm { Enabled = 1, IsDeleted = 0 });
            foreach (var h in house)
            {
                FullHouse fh = new FullHouse
                {
                    House = h,
                    //RentFee = rentfee.Find(t => t.HouseOrRoomID.Equals(h.ID)),
                    //OtherFees = (from ho in house_otherfeeu
                    //join of in otherfee on ho.OtherFeeID equals of.ID
                    //where ho.HouseOrRoomID.Equals(h.ID)
                    //select of).ToList(),
                    Customer = (from ho in hos
                                join c in customers on ho.CustomerID equals c.ID
                                where ho.HouseOrRoomID.Equals(h.ID)
                                select c).FirstOrDefault(),
                    Building = buidlings.Find(t => t.ID.Equals(h.BuildingID)),
                    Owner = users.Find(t => t.ID.Equals(h.OwnerID)),
                    Followups = fullfollowup.FindAll(t => t.HouseID.Equals(h.ID)),
                };

                //rentfee.Remove(fh.RentFee);
                //house_otherfee.RemoveAll(t => t.HouseOrRoomID.Equals(fh.House.ID));
                list.Add(fh);
            }
            return list;
        }
コード例 #10
0
ファイル: RoleBLL.cs プロジェクト: franknew/AnjuManager
        /// <summary>
        /// 获得用户角色子级下的所有用户
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public List<string> GetUserSubUserIDs(string userid)
        {
            UserBLL userbll = new UserBLL();
            ISqlMapper mapper = MapperHelper.GetMapper();
            User_RoleDao urdao = new User_RoleDao(mapper);
            RoleDao roledao = new RoleDao(mapper);
            var urs = urdao.Query(new User_RoleQueryForm { UserID = userid });
            List<string> useridlist = new List<string>();
            //检查用户的角色有没有全数据权限
            var roles = roledao.QueryRoleByUserID(userid);
            foreach (var role in roles)
            {
                if (role.DataAccessType == (int)DataAccesssEnum.All) return null;
            }

            useridlist.Add(userid);
            List<Role> list = new List<Role>();
            foreach (var ur in urs)
            {
                list.AddRange(GetAllSubRoles(ur.RoleID));
            }
            var roleids = (from r in list select r.ID).ToList();
            if (roleids.Count == 0) return useridlist;
            var users = urdao.Query(new User_RoleQueryForm { RoleIDs = roleids });
            useridlist.AddRange((from u in users select u.UserID).ToList());
            return useridlist;
        }