Example #1
0
 public void SubmitForm(UserVipEntity entity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         entity.Modify(keyValue);
         service.Update(entity);
     }
     else
     {
         entity.Create();
         service.Insert(entity);
     }
 }
Example #2
0
        public UserVipEntity CheckLogin(string username, string password)
        {
            UserVipEntity userEntity = service.FindEntity(t => t.F_UserName == username);

            if (userEntity != null)
            {
                string dbPassword = Md5.md5(DESEncrypt.Encrypt(password.ToLower()).ToLower(), 32).ToLower();
                if (dbPassword != userEntity.F_UserPass)
                {
                    userEntity = null;
                }
            }
            return(userEntity);
        }
        public void GetSuperiorList(int index, int userID, int type, ref Stack <UvrActionModel> listUvrActionModel)
        {
            if (index <= 3)
            {
                index = index + 1;
                UserVipRankingEntity uvrEntity      = GetUvrEntity(userID, type);
                UserVipEntity        uvEntity       = uvApp.GetUserVipEntityByUserID((int)uvrEntity.F_UserID);
                UserVipEntity        uvParentEntity = uvApp.GetUserVipEntityByUserID((int)uvEntity.F_ParentID);
                List <UvrModel>      uvrModelList   = new List <UvrModel>();

                UserVipEntity        uvSuperiorEntity          = null;
                UserVipRankingEntity superUserVipRankingEntity = GetUvrEntity((int)uvrEntity.F_SuperiorID, type);
                if (superUserVipRankingEntity != null)
                {
                    uvSuperiorEntity = uvApp.GetUserVipEntityByUserID((int)superUserVipRankingEntity.F_UserID);
                }

                int    days = 0;
                string note = "已达标";
                if (uvrEntity.F_Status == 0)
                {
                    days = (((DateTime)uvrEntity.F_CreatorTime).AddDays(7) - DateTime.Now).Days;
                    note = string.Format("未达标,还剩{0}天", days);
                }

                uvrModelList.Add(new UvrModel()
                {
                    ExpiryDays   = days,
                    NickName     = uvEntity == null ? "" : uvEntity.F_NickName,
                    ParentName   = uvParentEntity == null ? "" : uvParentEntity.F_NickName,
                    UserName     = uvEntity == null ? "" : uvEntity.F_UserName,
                    Note         = note,
                    UserID       = (int)uvrEntity.F_UserID,
                    SuperiorID   = "a" + (int)uvrEntity.F_SuperiorID,
                    SuperiorName = uvSuperiorEntity == null ? "" : uvSuperiorEntity.F_NickName,
                    point        = uvEntity == null ? 0 : (type == 0 ? (int)uvEntity.F_Integral : (int)uvEntity.F_Integral1)
                });
                listUvrActionModel.Push(new UvrActionModel()
                {
                    UvrModelList = uvrModelList
                });
                if (superUserVipRankingEntity != null)
                {
                    GetSuperiorList(index, (int)uvrEntity.F_SuperiorID, type, ref listUvrActionModel);
                }
            }
        }
 public ActionResult SubmitForm(UserVipEntity userEntity, string keyValue)
 {
     userVipApp.SubmitForm(userEntity, keyValue);
     return(Success("操作成功。"));
 }
        public void GetChildrenList(int index, string superiorIDs, int type, ref List <UvrActionModel> listUvrActionModel)
        {
            int tmpNum = type == 1 ? 2 : 4;

            if (index <= tmpNum)
            {
                int layer = listUvrActionModel.Count + 1;
                List <UserVipRankingEntity> allList = GetUserVipRankingList(type);
                int[]           parentList          = Array.ConvertAll <string, int>(superiorIDs.Split(','), s => int.Parse(s));
                List <int>      superiorList        = new List <int>();//存放上级
                List <UvrModel> uvrModelList        = new List <UvrModel>();
                foreach (var userID in parentList)
                {
                    UserVipRankingEntity        uvrSuperiorUserVipRankingEntity = allList.Where(x => x.F_UserID == userID).FirstOrDefault();
                    List <UserVipRankingEntity> tmpList = allList.Where(x => x.F_SuperiorID == userID).OrderBy(x => x.F_CreatorTime).ToList();
                    UserVipRankingEntity        leftUserVipRankingEntity  = tmpList.Where(x => x.F_UserID == uvrSuperiorUserVipRankingEntity.F_LeftUserID).FirstOrDefault();
                    UserVipRankingEntity        rightUserVipRankingEntity = tmpList.Where(x => x.F_UserID == uvrSuperiorUserVipRankingEntity.F_RightUserID).FirstOrDefault();
                    if (uvrSuperiorUserVipRankingEntity.F_LeftUserID > 0 && leftUserVipRankingEntity != null)
                    {
                        superiorList.Add((int)uvrSuperiorUserVipRankingEntity.F_LeftUserID);
                    }
                    if (uvrSuperiorUserVipRankingEntity.F_RightUserID > 0 && rightUserVipRankingEntity != null)
                    {
                        superiorList.Add((int)uvrSuperiorUserVipRankingEntity.F_RightUserID);
                    }
                    #region 左
                    if (leftUserVipRankingEntity != null)
                    {
                        UserVipRankingEntity uvrEntity        = GetUvrEntity((int)leftUserVipRankingEntity.F_UserID, type);
                        UserVipEntity        uvEntity         = uvApp.GetUserVipEntityByUserID((int)uvrEntity.F_UserID);
                        UserVipEntity        uvParentEntity   = uvApp.GetUserVipEntityByUserID((int)uvEntity.F_ParentID);
                        UserVipEntity        uvSuperiorEntity = uvApp.GetUserVipEntityByUserID((int)uvrEntity.F_SuperiorID);


                        int    days = 0;
                        string note = "已达标";
                        if (uvrEntity.F_Status == 0)
                        {
                            days = (((DateTime)uvrEntity.F_CreatorTime).AddDays(7) - DateTime.Now).Days;
                            note = string.Format("未达标,还剩{0}天", days);
                        }

                        uvrModelList.Add(new UvrModel()
                        {
                            ExpiryDays   = days,
                            NickName     = uvEntity == null ? "" : uvEntity.F_NickName,
                            ParentName   = uvParentEntity == null ? "" : uvParentEntity.F_NickName,
                            UserName     = uvEntity == null ? "" : uvEntity.F_UserName,
                            Note         = note,
                            UserID       = (int)uvrEntity.F_UserID,
                            SuperiorID   = "a" + (int)uvrEntity.F_SuperiorID,
                            SuperiorName = uvSuperiorEntity == null ? "" : uvSuperiorEntity.F_NickName,
                            layer        = layer,
                            point        = uvEntity == null ? 0 : (type == 0 ? (int)uvEntity.F_Integral : (int)uvEntity.F_Integral1)
                        });
                    }
                    else
                    {
                        uvrModelList.Add(new UvrModel()
                        {
                            SuperiorID = null
                        });
                    }
                    #endregion

                    #region 右
                    if (rightUserVipRankingEntity != null)
                    {
                        UserVipRankingEntity uvrRithtEntity        = GetUvrEntity((int)rightUserVipRankingEntity.F_UserID, type);
                        UserVipEntity        uvRightEntity         = uvApp.GetUserVipEntityByUserID((int)uvrRithtEntity.F_UserID);
                        UserVipEntity        uvRightParentEntity   = uvApp.GetUserVipEntityByUserID((int)uvRightEntity.F_ParentID);
                        UserVipEntity        uvRightSuperiorEntity = uvApp.GetUserVipEntityByUserID((int)rightUserVipRankingEntity.F_SuperiorID);

                        int    days = 0;
                        string note = "已达标";
                        if (uvrRithtEntity.F_Status == 0)
                        {
                            days = (((DateTime)uvrRithtEntity.F_CreatorTime).AddDays(7) - DateTime.Now).Days;
                            note = string.Format("未达标,还剩{0}天", days);
                        }
                        uvrModelList.Add(new UvrModel()
                        {
                            ExpiryDays   = days,
                            NickName     = uvRightEntity == null ? "" : uvRightEntity.F_NickName,
                            ParentName   = uvRightParentEntity == null ? "" : uvRightParentEntity.F_NickName,
                            UserName     = uvRightEntity == null ? "" : uvRightEntity.F_UserName,
                            Note         = note,
                            UserID       = (int)uvrRithtEntity.F_UserID,
                            SuperiorID   = "a" + (int)uvrRithtEntity.F_SuperiorID,
                            SuperiorName = uvRightSuperiorEntity == null ? "" : uvRightSuperiorEntity.F_NickName,
                            layer        = layer,
                            point        = uvRightEntity == null ? 0 : (type == 0 ? (int)uvRightEntity.F_Integral : (int)uvRightEntity.F_Integral1)
                        });
                    }
                    else
                    {
                        uvrModelList.Add(new UvrModel()
                        {
                            SuperiorID = null
                        });
                    }
                    #endregion
                }
                int num = (int)Math.Pow(2, index + 1);
                int tmp = num - uvrModelList.Count;
                for (int i = 0; i < tmp; i++)
                {
                    uvrModelList.Add(new UvrModel()
                    {
                        SuperiorID = null
                    });
                }
                listUvrActionModel.Add(new UvrActionModel()
                {
                    UvrModelList = uvrModelList
                });
                if (superiorList.Count > 0)
                {
                    index = index + 1;
                    GetChildrenList(index, string.Join(",", superiorList.Select(x => x)), type, ref listUvrActionModel);
                }
            }
        }
Example #6
0
        public bool IsExistsSysUser(string mobile)
        {
            UserVipEntity userVipEntity = service.FindEntity(x => x.F_UserName == mobile);

            return(userVipEntity == null ? true : false);
        }
Example #7
0
 public void Delete(UserVipEntity entity)
 {
     service.Delete(entity);
 }