Example #1
0
 public void UpdateUser()
 {
     if (Correct + Wrong == 10 && Correct >= 9)
     {
         userLevel = UserLevel.Expert;
     }
     else if (Correct + Wrong == 10 && Correct >= 7)
     {
         userLevel = UserLevel.Advanced;
     }
     else if (Correct + Wrong == 10 && Correct >= 5)
     {
         userLevel = UserLevel.Intermediate;
     }
     else if (Correct + Wrong == 10 && Correct >= 3)
     {
         userLevel = UserLevel.Basic;
     }
     else if (Correct + Wrong == 10 && Correct >= 0)
     {
         userLevel = UserLevel.Beginner;
     }
     else
     {
         userLevel = UserLevel.None;
     }
 }
Example #2
0
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label       lblUserType = e.Row.FindControl("lblUserType") as Label;
                DataRowView row         = e.Row.DataItem as DataRowView;
                MemberType  userType    = (MemberType)(row["usertype"] == DBNull.Value ? 0 : Convert.ToInt32(row["usertype"]));
                UserLevel   userLevel   = (UserLevel)(row["UserLevel"] == DBNull.Value ? 0 : Convert.ToInt32(row["userlevel"]));
                switch (userType)
                {
                case MemberType.Personal:
                    lblUserType.Text = userLevel.ToString();
                    break;

                case MemberType.Company:
                    lblUserType.Text = "鼎企会员";
                    break;

                case MemberType.Famly:
                    lblUserType.Text = "鼎宅会员";
                    break;

                case MemberType.School:
                    lblUserType.Text = "鼎校会员";
                    break;

                default:
                    lblUserType.Text = userLevel.ToString();
                    break;
                }
            }
        }
 /// <summary>
 /// Adds a local log to the program
 /// </summary>
 /// <param name="text">The log text</param>
 /// <param name="ul">The required user level</param>
 private void AddLog(string text, UserLevel ul = UserLevel.Normal)
 {
     if (App.CurrentUserLevel >= ul)
     {
         Log += text + Environment.NewLine;
     }
 }
Example #4
0
 /// <summary>
 /// Default constructor for an action
 /// </summary>
 /// <param name="header">The item header</param>
 /// <param name="iconKind">The item icon kind</param>
 /// <param name="command">The item command</param>
 /// <param name="minUserLevel">The minimum user level for the action</param>
 public ActionItemViewModel(string header, PackIconMaterialKind iconKind, ICommand command, UserLevel minUserLevel = UserLevel.Normal)
 {
     Header       = header;
     IconKind     = iconKind;
     Command      = command;
     MinUserLevel = minUserLevel;
 }
Example #5
0
 public static string GetUserLevelLetter(UserLevel level)
 {
     string letter = "Z";
     switch (level)
     {
         case UserLevel.Broadcaster:
             letter = "A";
             break;
         case UserLevel.Staff:
             letter = "B";
             break;
         case UserLevel.Admin:
             letter = "C";
             break;
         case UserLevel.GlobalMod:
             letter = "D";
             break;
         case UserLevel.Editor:
             letter = "E";
             break;
         case UserLevel.Moderator:
             letter = "F";
             break;
         case UserLevel.Viewer:
             letter = "G";
             break;
     }
     return letter;
 }
Example #6
0
        public static bool CheckedUserRight(UserLevel level, WebbDBTypes webbDBtype)
        {
            if ((int)level.Rights == 31)
            {
                return(true);
            }

            if (level.Rights == ProductRight.None)
            {
                return(false);
            }

            string[] rights = level.Rights.ToString().ToLower().Split(',');

            string dbtype = webbDBtype.ToString().ToLower().Trim();

            foreach (string right in rights)
            {
                if (dbtype.IndexOf(right.Trim()) >= 0)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #7
0
        public ActionResult UserAccessRights()
        {
            ScorecardApplication.Models.UserAccessRights model = new ScorecardApplication.Models.UserAccessRights();
            UserTableAdapter UserTA           = new UserTableAdapter();
            dsScorecard      ScorecardDataset = new dsScorecard();

            UserTA.Fill(ScorecardDataset.User);
            model.UserList = new List <Models.User>();
            UserLevelTableAdapter UserLevelTA = new UserLevelTableAdapter();

            UserLevelTA.Fill(ScorecardDataset.UserLevel);


            foreach (dsScorecard.UserRow UserRow in ScorecardDataset.User)
            {
                dsScorecard.UserLevelRow UserLevelRow = ScorecardDataset.UserLevel.FindByUserLevelID(UserRow.UserLevelID);
                UserLevel UserLevelItem = new UserLevel {
                    decription = UserLevelRow.Description
                };

                User UserItem = new User
                {
                    firstname    = UserRow.FirstName,
                    surname      = UserRow.Surname,
                    username     = UserRow.Username,
                    emailaddress = UserRow.EmailAddress,
                    userlevel    = UserLevelItem,
                    userid       = UserRow.UserID
                };
                model.UserList.Add(UserItem);
            }

            return(View(model));
        }
        public async Task <string> UpdateUserLevel(string userName, double points)
        {
            string    message   = string.Empty;
            UserLevel userLevel = await _hackerRankContext.UserLevels.Include(u => u.User).Include("Level").Where(u => u.User.UserName == userName).FirstOrDefaultAsync();

            var nextLevel = await _hackerRankContext.Levels.Where(i => i.LevelId == userLevel.Level.LevelId + 1).FirstOrDefaultAsync();

            userLevel.CurrentExperience += points;

            if (nextLevel != null && userLevel.CurrentExperience >= nextLevel.XpNeeded)
            {
                userLevel.Level = nextLevel;
                message         = $"{userLevel.User.UserName} just leveled up. They are now level {nextLevel.LevelId} {nextLevel.LevelName}, {DateTime.UtcNow:dddd, dd MMMM yyyy HH:mm}";
            }
            else
            {
                if (userLevel.CurrentExperience > userLevel.Level.XpNeeded + 10)
                {
                    userLevel.Level             = _hackerRankContext.Levels.Find(1);
                    userLevel.CurrentExperience = 0;
                    userLevel.PrestigeLevel    += 1;
                    message = $"{userLevel.User.UserName} just prestiged. They are now prestige {userLevel.PrestigeLevel}, level {userLevel.Level.LevelId} {userLevel.Level.LevelName}, {DateTime.UtcNow:dddd, dd MMMM yyyy HH:mm}";
                }
            }

            await _hackerRankContext.SaveChangesAsync();

            return(message);
        }
Example #9
0
        private Process Execute(Command Executable, String Arguments, UserLevel level)
        {
            Process          process   = new Process();
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.FileName  = Executable.Value();
            startInfo.Arguments = Arguments;

            if (level == UserLevel.ADMIN)
            {
                startInfo.Verb        = @"runas";
                startInfo.WindowStyle = ProcessWindowStyle.Normal;
            }
            else
            {
                startInfo.WindowStyle     = ProcessWindowStyle.Hidden;
                startInfo.UseShellExecute = false;
                startInfo.CreateNoWindow  = true;
            }

            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError  = true;

            process.StartInfo = startInfo;
            process.Start();
            process.WaitForExit();

            return(process);
        }
Example #10
0
        public static int Save(UserLevel userLevel)
        {
            var a = new UserLevel
            {
                UserLevelId  = userLevel.UserLevelId,
                UserLevel1   = userLevel.UserLevel1,
                UserIsActive = userLevel.UserIsActive
            };

            using (_d = new DataRepository <UserLevel>())
            {
                if (userLevel.UserLevelId > 0)
                {
                    _d.Update(a);
                }
                else
                {
                    _d.Add(a);
                }

                _d.SaveChanges();
            }

            return(a.UserLevelId);
        }
Example #11
0
    void Start()
    {
        FileStream m_Stream = File.Open(Application.dataPath +
                                        "\\Excel\\UserLevel.xlsx", FileMode.Open, FileAccess.Read);
        //使用OpenXml读取Excel文件
        IExcelDataReader mExcelReader = ExcelReaderFactory.CreateOpenXmlReader(m_Stream);
        //将Excel数据转化为DataSet
        DataSet mResultSets = mExcelReader.AsDataSet();
        //读取行数
        int rowCount = mResultSets.Tables[0].Rows.Count;

        //逐行读取,从第一行读以跳过表头
        for (int i = 1; i < rowCount; i++)
        {
            //将读取的Excel数据转化成数据实体
            UserLevel mUser = new UserLevel();
            mUser.Name        = mResultSets.Tables[0].Rows[i][0].ToString();
            mUser.Level       = mResultSets.Tables[0].Rows[i][1].ToString();
            mUser.Description = mResultSets.Tables[0].Rows[i][2].ToString();
            mUser.Skill       = mResultSets.Tables[0].Rows[i][3].ToString();
            //输出Debug信息
            Debug.Log(mUser.ToString());
            //ADD:更多逻辑
        }
    }
Example #12
0
 public MemberUpdatedArgs(UInt32 userID, string user, string alts, UserLevel level)
 {
     this._userID = userID;
     this._user   = user;
     this._alts   = alts;
     this._level  = level;
 }
        public static void ChangeUser(UserLevel maxLevel)
        {
            UserStore   userStore = new UserStore();
            UserCreator creator   = new UserCreator();

            Console.Clear();
            Console.WriteLine("Tryck enter för att avbryta");
            string userName = UserInput.GetInput <string>("Ange användarnamn att redigera:");

            if (userName == string.Empty)
            {
                return;
            }

            User user = userStore.FindById(userName);

            if (user == null)
            {
                Console.WriteLine("Användaren finns inte");
                UserInput.WaitForContinue();
                return;
            }

            if (user.UserLevel < maxLevel)
            {
                Console.WriteLine($"Kan ej redigera användarnivån {user.UserLevel}");
                UserInput.WaitForContinue();
                return;
            }

            creator.Create(userStore, user);
        }
Example #14
0
        public async Task <ActionResult <UserLevel> > PostUserLevel(UserLevel userLevel)
        {
            _context.UserLevel.Add(userLevel);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetUserLevel", new { id = userLevel.id }, userLevel));
        }
Example #15
0
        public static UserLevel GetUserLevel(this ChatMessage message)
        {
            UserLevel userLevel = UserLevel.Unknown;

            if (message.UserType == TwitchLib.Client.Enums.UserType.Viewer)
            {
                userLevel = UserLevel.Viewer;
            }

            if (message.IsSubscriber)
            {
                userLevel = UserLevel.Subscriber;
            }

            if (message.IsModerator)
            {
                userLevel = UserLevel.Moderator;
            }

            if (message.IsBroadcaster)
            {
                userLevel = UserLevel.God;
            }

            return(userLevel);
        }
        public static List <User> GetAll(UserLevel level)
        {
            SqlConnection connection = Connector.GetConnection();

            SqlCommand cmd = connection.CreateCommand();

            cmd.CommandText = "SELECT * FROM [USER] WHERE userlevel=@userlevel";
            cmd.Parameters.AddWithValue("@userlevel", (int)level);

            List <User> users = new List <User>();

            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    users.Add(new User
                    {
                        Id        = reader.GetInt32(0),
                        Username  = reader.GetString(1),
                        Password  = reader.GetString(2),
                        UserLevel = (UserLevel)reader.GetInt32(3)
                    });
                }
            }

            return(users);
        }
Example #17
0
        protected override void OnActionExecuting(ActionExecutingContext ctx)
        {
            //ctx.ActionDescriptor.ActionName
            //

            if (ctx.ActionDescriptor.GetCustomAttributes(typeof(AllowAnonymousAttribute), true).Any() ||
                ctx.ActionDescriptor.ControllerDescriptor.GetCustomAttributes(typeof(AllowAnonymousAttribute), true).Any())
            {
                return;
            }

            if (!ctx.HttpContext.User.Identity.IsAuthenticated)
            {
                //base.HandleUnauthorizedRequest( ctx );
                ctx.Result = new RedirectToRouteResult(
                    new RouteValueDictionary(new { controller = "Account", action = "Login" })
                    );
                return;
            }
            else
            {
                var oUser = proMan.Users.Where(o => o.Username == User.Identity.Name).FirstOrDefault();
                if (oUser == null)
                {
                    var oDev = proMan.Developers.Where(o => o.Username == User.Identity.Name).FirstOrDefault();
                    if (oDev == null)
                    {
                        FormsAuthentication.SignOut();
                        ctx.Result = new RedirectToRouteResult(
                            new RouteValueDictionary(new { controller = "Account", action = "Login" })
                            );
                        return;
                    }
                    else
                    {
                        currentUserLevel = UserLevel.DevView;
                    }
                }
                else
                {
                    currentUserLevel = (UserLevel)oUser.UserLevel;
                }
            }

            foreach (var dev in proMan.Developers)
            {
                if (AllowUserForDev(dev.ID))
                {
                    allowedDevelopers.Add(dev.ID);
                }
            }

            foreach (var proj in proMan.Projects)
            {
                if (AllowUserForProject(proj.ID))
                {
                    allowedProjects.Add(proj.ID);
                }
            }
        }
Example #18
0
    override protected Boolean GetDataComboBox()
    {
        int minLevel;
        int MaxLevel;

        try
        {
            minLevel = daWebGroup.USP_WebGroup_GetLevelByUserID(int.Parse(MyConfig.GetValueByKey("UserID"))) + 1;
            MaxLevel = int.Parse(MyConfig.GetValueByKey("MaxLevel"));
        }
        catch (Exception e)
        {
            ShowErrorMes("Lỗi hệ thống : " + e.ToString());
            return(false);
        }


        // Create List Level
        BindingList <UserLevel> userLevels = new BindingList <UserLevel>();

        for (int i = minLevel; i <= MaxLevel; i++)
        {
            UserLevel userLevel = new UserLevel();
            userLevel.LevelID   = i;
            userLevel.LevelName = "Cấp " + i;
            userLevels.Add(userLevel);
        }

        fLevel.DataSource = userLevels;
        fLevel.DataBind();

        return(true);
    }
Example #19
0
 void Start()
 {
     Debug.Log("1");
     FileStream m_Stream = File.Open(Application.dataPath + "/Excel/UserLevel.xlsx", FileMode.Open, FileAccess.Read);
     Debug.Log("2");
     //使用OpenXml读取Excel文件
     IExcelDataReader mExcelReader = ExcelReaderFactory.CreateOpenXmlReader(m_Stream);
     //将Excel数据转化为DataSet
     
     DataSet mResultSets = mExcelReader.AsDataSet();
     Debug.Log("3");
     //读取行数
     int rowCount = mResultSets.Tables[0].Rows.Count;
     
     //逐行读取,从第一行读以跳过表头
     for (int i = 1; i < rowCount; i++)
     {
         //将读取的Excel数据转化成数据实体
         UserLevel mUser = new UserLevel();
         mUser.Name = mResultSets.Tables[0].Rows[i][0].ToString();
         mUser.Level = mResultSets.Tables[0].Rows[i][1].ToString();
         mUser.Description = mResultSets.Tables[0].Rows[i][2].ToString();
         mUser.Skill = mResultSets.Tables[0].Rows[i][3].ToString();
         //输出Debug信息
         Debug.Log(mUser.ToString());
         //ADD:更多逻辑
     }
 }
Example #20
0
        public void Undo()
        {
            redoTitle           = targetTour.Title;
            redoAuthor          = targetTour.Author;
            redoAuthorEmail     = targetTour.AuthorEmail;
            redoDescription     = targetTour.Description;
            redoAuthorImage     = targetTour.AuthorImage;
            redoOrganizationUrl = targetTour.OrganizationUrl;
            redoOrgName         = targetTour.OrgName;
            redoKeywords        = targetTour.Keywords;
            redoTaxonomy        = targetTour.Taxonomy;
            redoLevel           = targetTour.Level;
            //        redoDomeMode = targetTour.DomeMode;

            targetTour.Title           = undoTitle;
            targetTour.Author          = undoAuthor;
            targetTour.AuthorEmail     = undoAuthorEmail;
            targetTour.Description     = undoDescription;
            targetTour.AuthorImage     = undoAuthorImage;
            targetTour.OrganizationUrl = undoOrganizationUrl;
            targetTour.OrgName         = undoOrgName;
            targetTour.Keywords        = undoKeywords;
            targetTour.Taxonomy        = undoTaxonomy;
            targetTour.Level           = undoLevel;
            //         targetTour.DomeMode = undoDomeMode;
            targetTour.TourDirty = true;
        }
Example #21
0
        public UserLevel GetUserLevel(int tenantId, int userId)
        {
            List <UserLevel> alllevels =
                _dataAccess.GetList <UserLevel>("Int_UserLevel.TenantId=" + tenantId +
                                                " AND Int_UserLevel.IsDelete=0 ORDER BY TotalIntegral DESC");
            var totalPoint =
                (int)
                _dataAccess.ExecuteScalar(
                    string.Format(@"SELECT ISNULL(SUM(Integral),0)  TotalIntegral FROM Int_UserIntegral
WHERE UserId={0}", userId));
            UserLevel currentLevel = null;

            for (int i = 0; i < alllevels.Count; i++)
            {
                if (totalPoint >= alllevels[i].TotalIntegral)
                {
                    currentLevel = alllevels[i];
                    if (i > 0)
                    {
                        currentLevel.Next = alllevels[i - 1];
                    }
                    if (i < alllevels.Count - 2)
                    {
                        currentLevel.Previous = alllevels[i + 1];
                    }
                    break;
                }
            }

            return(currentLevel);
        }
Example #22
0
        public IHttpActionResult PutUserLevel(int id, UserLevel userLevel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userLevel.ID)
            {
                return(BadRequest());
            }

            db.Entry(userLevel).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserLevelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        /// <summary>
        /// 根据用户ID获取用户级别筛选条件
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        private static List <string> GetFilter(int userID, UserLevel level)
        {
            //获取筛选条件
            List <string> filters = new List <string>();
            User          user    = Users.GetUser(userID);

            if (user != null)
            {
                if (user.UserType == UserType.InnerUser)
                {
                    List <UserGrade> grades = UserGradeManager.GetUserGrades(userID);
                    foreach (UserGrade grade in grades)
                    {
                        if (grade.GradeLevel == level && !GlobalSettings.IsNullOrEmpty(grade.GradeLimit))
                        {
                            filters.Add(grade.GradeLimit);
                        }
                    }
                }
                else if (user.UserType == UserType.CompanyUser)
                {
                    List <CustomerGrade> grades = CustomerGradeManager.GetCustomerGrades(user.CompanyID);
                    foreach (CustomerGrade grade in grades)
                    {
                        if (grade.GradeLevel == level && !GlobalSettings.IsNullOrEmpty(grade.GradeLimit))
                        {
                            filters.Add(grade.GradeLimit);
                        }
                    }
                }
            }
            return(filters);
        }
Example #24
0
        public bool SetRight(string command, CommandType type, UserLevel right)
        {
            if (!this.Exists(command))
            {
                return(false);
            }
            CommandRights rights = this.GetRights(command);

            if (rights == null)
            {
                return(false);
            }
            switch (type)
            {
            case CommandType.Organization:
                rights.Organization = right;
                break;

            case CommandType.PrivateChannel:
                rights.PrivateChannel = right;
                break;

            case CommandType.Tell:
                rights.PrivateMessage = right;
                break;
            }
            return(this.SetRights(command, rights));
        }
Example #25
0
        private void UserLevelChange(UserLevel level)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <UserLevel>(UserLevelChange), level);
            }
            else
            {
                switch (level)
                {
                case UserLevel.操作员:
                    contextMenuStrip1.Enabled = false;

                    break;

                case UserLevel.工程师:
                    contextMenuStrip1.Enabled = true;

                    break;

                case UserLevel.设计者:
                    contextMenuStrip1.Enabled = true;

                    break;

                default:
                    contextMenuStrip1.Enabled = false;

                    break;
                }
            }
        }
        public async Task <IActionResult> PutUserLevel([FromRoute] int id, [FromBody] UserLevel userLevel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userLevel.Id)
            {
                return(BadRequest());
            }

            _context.Entry(userLevel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserLevelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public bool EnrollUser(uint EnrollmentNo, UserLevel Level, uint CardId, string UserName, uint Password, bool enabled)
        {
            int vErrorCode = 0;

            UserInfo u = new UserInfo();

            u.Password = Password;
            u.Card     = CardId;
            u.Name     = UserName;
            u.Id       = EnrollmentNo;
            u.Level    = Level;
            u.Enabled  = enabled;
            this.Open();
            bool vRet = SBXPCDLL.EnableDevice(1, 1);

            vRet = SBXPCDLL.SetEnrollData1(this.gMachineNumber, (int)EnrollmentNo, 11, 1, IntPtr.Zero, (int)CardId);

            if (vRet)
            {
                vRet = SBXPCDLL.SetUserName1(gMachineNumber, (int)u.Id, u.Name);
                if (!vRet)
                {
                    SBXPCDLL.GetLastError(gMachineNumber, out vErrorCode);
                    _Exception = _Exception + ", Name Error : " + util.ErrorPrint(vErrorCode);
                }
            }
            else
            {
                SBXPCDLL.GetLastError(gMachineNumber, out vErrorCode);
                _Exception = _Exception + ", Card Error : " + util.ErrorPrint(vErrorCode);
                //Application.DoEvents();
            }
            this.Close();
            return(true);
        }
Example #28
0
 public Review(Guid id, string title, string comment, UserLevel recommendFor)
 {
     Id           = id;
     Title        = title;
     Comment      = comment;
     RecommendFor = recommendFor;
 }
Example #29
0
        public override UserBuilder Level(UserLevel level)
        {
            if (level != UserLevel.Normal && level != UserLevel.Admin)
                throw new InvalidOperationException("Not authorized to create administrator");

            return base.Level(level);
        }
Example #30
0
 public UserInfo(UserId userId, User user)
 {
     Dead     = true;
     MaxStats = new Stats.Stats(new ReadOnlyDictionary <StatsProperty, decimal>(
                                    new Dictionary <StatsProperty, decimal>
     {
         { StatsProperty.Health, 100 },
         { StatsProperty.Mana, 100 },
         { StatsProperty.Stamina, 100 },
         { StatsProperty.Intelligence, 100 },
         { StatsProperty.Strength, 100 },
         { StatsProperty.Defence, 100 },
         { StatsProperty.Karma, 100 }
     }
                                    ));
     MinStats = new Stats.Stats(new ReadOnlyDictionary <StatsProperty, decimal>(
                                    new Dictionary <StatsProperty, decimal>
     {
         { StatsProperty.Health, 0 },
         { StatsProperty.Mana, 0 },
         { StatsProperty.Stamina, 0 },
         { StatsProperty.Intelligence, 0 },
         { StatsProperty.Strength, 0 },
         { StatsProperty.Defence, 0 },
         { StatsProperty.Karma, -100 }
     }
                                    ));
     BaseStats  = new Stats.Stats(Stats.Stats.DefaultStats);
     UserId     = userId;
     User       = user;
     _name      = Generator.Generate(User.Random);
     Statistics = new Statistics(user);
     Level      = new UserLevel(user);
     RecalculateStats();
 }
Example #31
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p"></param>
        /// <param name="actionName"></param>
        /// <param name="gettype"></param>
        /// <param name="stime"></param>
        /// <param name="etime"></param>
        /// <returns></returns>
        public ActionResult IntegralList(int p = 1, string actionName = "", int gettype = 1, DateTime?stime = null, DateTime?etime = null)
        {
            int total;
            var list = service.GetUserIntegrals(out total, CurrentUser.UserId, gettype, stime, etime, p, 10);

            foreach (var item in list)
            {
                item.CodeDesc = string.IsNullOrWhiteSpace(item.RuleCode) ? item.IntegralDesc : IntegrationRules.Instance.GetDesc(item.RuleCode);
            }

            if (!string.IsNullOrEmpty(actionName))
            {
                list = list.Where(k => k.CodeDesc.ToLower().Contains(actionName.ToLower()));
            }
            total = list.Count();
            var pagelist     = new RetechWing.MvcPager.PagedList <BusinessCommon.Integration.UserIntegral>(list, p, 10, total);
            var integralRank = service.GetUserRankIntegral(CurrentUser.UserId);

            ViewBag.totalIntegral = integralRank == null ? 0 : integralRank.TotalIntegral;
            ViewBag.todayIntegral = integralRank == null ? 0 : integralRank.TodayIntegral;
            ViewBag.integralRank  = (integralRank == null || integralRank.RankIndex < 0) ? 0 : integralRank.RankIndex;
            UserLevel currentLevel = _levelService.GetUserLevel(CurrentTenant.TenantId, CurrentUser.UserId);

            ViewBag.currentLevel = currentLevel;

            return(View(pagelist));
        }
		public UserRightEditorForm(object value)
		{
			UserLevel=value as UserLevel; 

			InitializeComponent();
			
		}
Example #33
0
        public async Task <IActionResult> OnPostAsync(string returnUrl = null)
        {
            returnUrl ??= Url.Content("~/");
            ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
            if (ModelState.IsValid && User.IsInRole("Administrator"))
            {
                var user = new User {
                    UserName = Input.Username, Email = Input.Email, GitLabId = Input.GitLabId, DateCreated = DateTime.Now, ProfileImage = "default-profile-picture.png", IsPublic = true
                };
                var level  = _context.Levels.Where(l => l.LevelId == 1).FirstOrDefault();
                var result = await _userManager.CreateAsync(user, Input.Password);

                if (result.Succeeded)
                {
                    _logger.LogInformation("User created a new account with password.");

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
                    var callbackUrl = Url.Page(
                        "/Account/ConfirmEmail",
                        pageHandler: null,
                        values: new { area = "Identity", userId = user.Id, code = code, returnUrl = returnUrl },
                        protocol: Request.Scheme);

                    await _emailSender.SendEmailAsync(
                        Input.Email,
                        "Confirm your email",
                        HtmlEncoder.Default.Encode(callbackUrl),
                        user.UserName);

                    await _userManager.AddToRoleAsync(user, "User");

                    UserLevel userLevel = new UserLevel()
                    {
                        Level = level, User = _context.Users.Where(i => i.NormalizedUserName == user.NormalizedUserName).FirstOrDefault()
                    };
                    _context.UserLevels.Add(userLevel);
                    _context.SaveChanges();

                    if (_userManager.Options.SignIn.RequireConfirmedAccount)
                    {
                        return(RedirectToPage("RegisterConfirmation", new { email = Input.Email, returnUrl = returnUrl }));
                    }
                    else
                    {
                        await _signInManager.SignInAsync(user, isPersistent : false);

                        return(LocalRedirect(returnUrl));
                    }
                }
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }
            }

            // If we got this far, something failed, redisplay form
            return(Page());
        }
        public Info(UserLevel userLevel, string summary)
        {
            this.userLevel = userLevel;
            this.summary = summary;

            if (userLevel == UserLevel.User || userLevel == UserLevel.Advanced)
                if (summary.Length < 5) throw new NotImplementedException("Please properly Document any fields/properties that are meant to be used by users");
        }
        public ShopIdentity(FormsAuthenticationTicket ticket)
        {
            this.ticket = ticket;
            string[] ud = ticket.UserData.Split(':');

            userId = ticket.Name;
            userEmail = ud[0];
            userName = ud[1];
            userStatus = (MemberStatus)(int.Parse(ud[2]));
            userType = (MemberType)(int.Parse(ud[3]));
            userLevel = (UserLevel)(int.Parse(ud[4]));
        }
Example #36
0
        public void Undo()
        {
            redoTitle = targetTour.Title;
            redoAuthor = targetTour.Author;
            redoAuthorEmail = targetTour.AuthorEmail;
            redoDescription = targetTour.Description;
            redoAuthorImage = targetTour.AuthorImage;
            redoOrganizationUrl = targetTour.OrganizationUrl;
            redoOrgName = targetTour.OrgName;
            redoKeywords = targetTour.Keywords;
            redoTaxonomy = targetTour.Taxonomy;
            redoLevel = targetTour.Level;
            redoDomeMode = targetTour.DomeMode;

            targetTour.Title = undoTitle;
            targetTour.Author = undoAuthor;
            targetTour.AuthorEmail = undoAuthorEmail;
            targetTour.Description = undoDescription;
            targetTour.AuthorImage = undoAuthorImage;
            targetTour.OrganizationUrl = undoOrganizationUrl;
            targetTour.OrgName = undoOrgName;
            targetTour.Keywords = undoKeywords;
            targetTour.Taxonomy = undoTaxonomy;
            targetTour.Level = undoLevel;
            targetTour.DomeMode = undoDomeMode;
            targetTour.TourDirty = true;
        }
Example #37
0
        public UserModel UserLevelUpdate(int userId, UserLevel userLevel, int authUserId)
        {
            var user = _customerRepository.GetItem(userId);
            user.UserLevel = (int)userLevel;
            user.UpdatedDate = DateTime.Now;
            user.UpdatedUser = authUserId;

            return _mapping.UserModelMapping(user);
            // return MappingManager.UserModelMapping(bindUser);
        }
 /// <summary>
 /// 申请修改商户级别
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="userLevel"></param>
 public static void ChangeUserLevel(string userId, UserLevel userLevel)
 {
     Database db = NoName.NetShop.Common.CommDataAccess.DbWriter;
     string sql = "update ummember set newuserlevel=@userLevel,ChangeType=1 where userid=@userId";
     DbCommand dbCommand = db.GetSqlStringCommand(sql);
     db.AddInParameter(dbCommand, "userId", DbType.String, userId);
     db.AddInParameter(dbCommand, "userLevel", DbType.Int32, (int)userLevel);
     db.ExecuteNonQuery(dbCommand);
 }
Example #39
0
        public UndoTourPropertiesChange(string text, TourDocument tour)
        {
            undoTitle = tour.Title;
            undoAuthor = tour.Author;
            undoAuthorEmail = tour.AuthorEmail;
            undoDescription = tour.Description;
            undoAuthorImage = tour.AuthorImage;
            undoOrganizationUrl = tour.OrganizationUrl;
            undoOrgName = tour.OrgName;
            undoKeywords = tour.Keywords;
            undoTaxonomy = tour.Taxonomy;
            undoLevel = tour.Level;
            undoDomeMode = tour.DomeMode;

            actionText = text;
            targetTour = tour;
            targetTour.TourDirty = true;
        }
 public Info(UserLevel userLevel)
 {
     this.userLevel = userLevel;
 }
        public static List<InspectorInfo> GenerateList(object parent, InspectorInfo parentItem = null, bool GenerateFields = false, UserLevel? userLevel = null)
        {
            UserLevel userlevel = OrbIt.ui.sidebar.userLevel;
            if (userLevel != null) userlevel = (UserLevel)userLevel;

            List<InspectorInfo> list = new List<InspectorInfo>();
            //char a = (char)164;
            //System.Console.WriteLine(a);
            //string space = "|";
            //if (parentItem != null) space += parentItem.whitespace;
            //List<FieldInfo> fieldInfos = o.GetType().GetFields().ToList(); //just supporting properties for now
            data_type dt = data_type.obj; //if this item is the root, we should give it it's real type in.steam of assuming it's an object
            if (parentItem != null) dt = parentItem.datatype;

            if (dt == data_type.collection)
            {
                dynamic collection = parent;
                foreach (object o in collection)
                {
                    InspectorInfo iitem = new InspectorInfo(parentItem.masterList, parentItem, o);
                    if (iitem.CheckForChildren()) iitem.prefix = "+";
                    InsertItemSorted(list, iitem);
                }

            }
            else if (dt == data_type.array)
            {
                dynamic array = parent;
                foreach (object o in array)
                {
                    InspectorInfo iitem = new InspectorInfo(parentItem.masterList, parentItem, o);
                    if (iitem.CheckForChildren()) iitem.prefix = "+";
                    InsertItemSorted(list, iitem);
                }

            }
            else if (dt == data_type.dict)
            {
                //dynamic dict = iitem.fpinfo.GetValue(iitem.parentItem);
                dynamic dict = parent;
                foreach (dynamic key in dict.Keys)
                {
                    //System.Console.WriteLine(key.ToString());
                    InspectorInfo iitem = new InspectorInfo(parentItem.masterList, parentItem, dict[key], key);
                    //iitem.GenerateChildren();
                    //list.Add(iitem);
                    if (iitem.CheckForChildren()) iitem.prefix = "+";
                    InsertItemSorted(list, iitem);
                }
            }
            else if (dt == data_type.obj)
            {
                ///// PROPERTIES
                List<PropertyInfo> propertyInfos;
                //if the object isn't a component, then we only want to see the 'declared' properties (not inherited)
                if (!(parent is Component || parent is Player))// || parent is Process))
                {
                    propertyInfos = parent.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList();
                }
                else
                {
                    propertyInfos = parent.GetType().GetProperties().ToList();
                }

                foreach (PropertyInfo pinfo in propertyInfos)
                {
                    string tooltip = "";
                    object[] attributes = pinfo.GetCustomAttributes(false);
                    var abstractions = pinfo.GetCustomAttributes(typeof(Info), false);
                    if (abstractions.Length > 0)
                    {
                        Info info = (Info)abstractions[0];
                        if ((int)info.userLevel > (int)userlevel) continue;
                        tooltip = info.summary;

                    }
                    else if (userlevel != UserLevel.Debug)
                    {
                        continue;
                    }
                    //if (pinfo.Name.Equals("Item")) continue;
                    InspectorInfo iitem = new InspectorInfo(parentItem.masterList, parentItem, pinfo.GetValue(parent, null), pinfo);
                    if (tooltip.Length > 0) iitem.ToolTip = tooltip;
                    if (iitem.CheckForChildren()) iitem.prefix = "+";
                    InsertItemSorted(list, iitem);
                }
                ////// FIELDS
                List<FieldInfo> fieldInfos;
                //if the object isn't a component, then we only want to see the 'declared' properties (not inherited)
                if (!(parent is Component || parent is Player))// || parent is Process))
                {
                    fieldInfos = parent.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList();
                }
                else
                {
                    fieldInfos = parent.GetType().GetFields().ToList();
                }

                foreach (FieldInfo finfo in fieldInfos)
                {
                    //if (finfo.GetCustomAttributes(typeof(DoNotInspect), false).Length > 0) continue;
                    var abstractions = finfo.GetCustomAttributes(typeof(Info), false);
                    if (abstractions.Length > 0)
                    {
                        if ((int)(abstractions[0] as Info).userLevel > (int)userlevel) continue;
                    }
                    else if (userlevel != UserLevel.Debug)
                    {
                        continue;
                    }
                    InspectorInfo iitem = new InspectorInfo(parentItem.masterList, parentItem, finfo.GetValue(parent), finfo);
                    if (iitem.CheckForChildren()) iitem.prefix = "+";
                    InsertItemSorted(list, iitem);
                }
                ////METHODS
                List<MethodInfo> methodInfos;
                //if the object isn't a component, then we only want to see the 'declared' properties (not inherited)
                if (!(parent is Component || parent is Player))// || parent is Process))
                {
                    methodInfos = parent.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList();
                }
                else
                {
                    methodInfos = parent.GetType().GetMethods().ToList();
                }

                foreach (MethodInfo minfo in methodInfos)
                {
                    //if (finfo.GetCustomAttributes(typeof(DoNotInspect), false).Length > 0) continue;
                    var abstractions = minfo.GetCustomAttributes(typeof(Clickable), false);
                    if (abstractions.Length == 0)
                    {
                        continue;
                    }
                    InspectorInfo iitem = new InspectorInfo(parentItem.masterList, parentItem, minfo);
                    InsertItemSorted(list, iitem);
                }

            }
            //if it's just a normal primitive, it will return an empty list
            if (list.Count > 0) parentItem.prefix = "+";
            return list;
        }
Example #42
0
 public User(string username, UserLevel level)
 {
     Username = username;
     Level = level;
 }
Example #43
0
        // add 2016.01.24
        public static string GetLevelByUserLevel(UserLevel level)
        {
            switch (level)
            {
                //case UserLevel.Level1: return "Level1";
                //case UserLevel.Level2: return "Level2";
                //case UserLevel.Level3: return "Level3";
                //default: return "None";
                case UserLevel.Level1: return "모니터";
                case UserLevel.Level2: return "운영자";
                case UserLevel.Level3: return "A/S요원";

            }
            return string.Empty;
        }
Example #44
0
 public virtual UserBuilder Level(UserLevel level)
 {
     _level = level;
     return this;
 }
Example #45
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="d">description of the command</param>
 /// <param name="level">UserLevel required to use the command</param>
 /// <param name="arg">Number of arguments</param>
 public CommandInfo(string d, UserLevel level, int arg)
 {
     desc = d;
     this.level = level;
     args = arg;
 }
 /// <summary>
 /// 用户权限认证,先对权限进行认证,当不通过时,看用户level
 /// </summary>
 /// <param name="userrole">用户权限</param>
 /// <param name="userLevel">用户等级</param>
 public RestfulRoleAuthorizeAttribute(UserRole userrole, UserLevel userLevel)
 {
     this._userRole = userrole;
     this._userLevel = userLevel;
 }
        public void FromXml(XmlDocument doc)
        {
            XmlNode root = Util.SelectSingleNode(doc, "Tour");

            id = root.Attributes.GetNamedItem("ID").Value.ToString();
            Title = root.Attributes.GetNamedItem("Title").Value.ToString();
            Author = root.Attributes.GetNamedItem("Author").Value.ToString();

            if (root.Attributes.GetNamedItem("Descirption") != null)
            {
                Description = root.Attributes.GetNamedItem("Descirption").Value;
            }

            if (root.Attributes.GetNamedItem("AuthorEmail") != null)
            {
                authorEmail = root.Attributes.GetNamedItem("AuthorEmail").Value;
            }

            if (root.Attributes.GetNamedItem("Keywords") != null)
            {
                Keywords = root.Attributes.GetNamedItem("Keywords").Value;
            }

            if (root.Attributes.GetNamedItem("OrganizationName") != null)
            {
                OrgName = root.Attributes.GetNamedItem("OrganizationName").Value;
            }

            organizationUrl = root.Attributes.GetNamedItem("OrganizationUrl").Value;

            switch (root.Attributes.GetNamedItem("UserLevel").Value)
            {

                case "Beginner":
                    level = UserLevel.Beginner;
                    break;
                case "Intermediate":
                    level = UserLevel.Intermediate;
                    break;
                case "Advanced":
                    level = UserLevel.Advanced;
                    break;
                case "Educator":
                    level = UserLevel.Educator;
                    break;
                case "Professional":
                    level = UserLevel.Professional;
                    break;
                default:
                    break;
            }

            switch (root.Attributes.GetNamedItem("Classification").Value)
            {

                case "Star":
                    type = Classification.Star;
                    break;
                case "Supernova":
                    type = Classification.Supernova;
                    break;
                case "BlackHole":
                    type = Classification.BlackHole;
                    break;
                case "NeutronStar":
                    type = Classification.NeutronStar;
                    break;
                case "DoubleStar":
                    type = Classification.DoubleStar;
                    break;
                case "MultipleStars":
                    type = Classification.MultipleStars;
                    break;
                case "Asterism":
                    type = Classification.Asterism;
                    break;
                case "Constellation":
                    type = Classification.Constellation;
                    break;
                case "OpenCluster":
                    type = Classification.OpenCluster;
                    break;
                case "GlobularCluster":
                    type = Classification.GlobularCluster;
                    break;
                case "NebulousCluster":
                    type = Classification.NebulousCluster;
                    break;
                case "Nebula":
                    type = Classification.Nebula;
                    break;
                case "EmissionNebula":
                    type = Classification.EmissionNebula;
                    break;
                case "PlanetaryNebula":
                    type = Classification.PlanetaryNebula;
                    break;
                case "ReflectionNebula":
                    type = Classification.ReflectionNebula;
                    break;
                case "DarkNebula":
                    type = Classification.DarkNebula;
                    break;
                case "GiantMolecularCloud":
                    type = Classification.GiantMolecularCloud;
                    break;
                case "SupernovaRemnant":
                    type = Classification.SupernovaRemnant;
                    break;
                case "InterstellarDust":
                    type = Classification.InterstellarDust;
                    break;
                case "Quasar":
                    type = Classification.Quasar;
                    break;
                case "Galaxy":
                    type = Classification.Galaxy;
                    break;
                case "SpiralGalaxy":
                    type = Classification.SpiralGalaxy;
                    break;
                case "IrregularGalaxy":
                    type = Classification.IrregularGalaxy;
                    break;
                case "EllipticalGalaxy":
                    type = Classification.EllipticalGalaxy;
                    break;
                case "Knot":
                    type = Classification.Knot;
                    break;
                case "PlateDefect":
                    type = Classification.PlateDefect;
                    break;
                case "ClusterOfGalaxies":
                    type = Classification.ClusterOfGalaxies;
                    break;
                case "OtherNGC":
                    type = Classification.OtherNGC;
                    break;
                case "Unidentified":
                    type = Classification.Unidentified;
                    break;
                case "SolarSystem":
                    type = Classification.SolarSystem;
                    break;
                case "Unfiltered":
                    type = Classification.Unfiltered;
                    break;
                case "Stellar":
                    type = Classification.Stellar;
                    break;
                case "StellarGroupings":
                    type = Classification.StellarGroupings;
                    break;
                case "Nebulae":
                    type = Classification.Nebulae;
                    break;
                case "Galactic":
                    type = Classification.Galactic;
                    break;
                case "Other":
                    type = Classification.Other;
                    break;
                default:
                    break;
            }

            taxonomy = root.Attributes.GetNamedItem("Taxonomy").Value.ToString();
            XmlNode TourStops = Util.SelectSingleNode(root, "TourStops");
            foreach (XmlNode tourStop in TourStops.ChildNodes)
            {
                if (tourStop.Name == "TourStop")
                {
                    AddTourStop(TourStop.FromXml(this, tourStop));
                }
            }

            XmlNode Frames = Util.SelectSingleNode(root, "ReferenceFrames");

            if (Frames != null)
            {
                foreach (XmlNode frame in Frames.ChildNodes)
                {
                    if (frame.Name == "ReferenceFrame")
                    {
                        ReferenceFrame newFrame = new ReferenceFrame();
                        newFrame.InitializeFromXml(frame);
                        if (!LayerManager.AllMaps.ContainsKey(newFrame.Name))
                        {
                            LayerMap map = new LayerMap(newFrame.Name, ReferenceFrames.Custom);
                            map.Frame = newFrame;
                            map.LoadedFromTour = true;
                            LayerManager.AllMaps[newFrame.Name] = map;
                        }
                    }
                }
                LayerManager.ConnectAllChildren();
                LayerManager.LoadTree();
            }

            XmlNode Layers = Util.SelectSingleNode(root, "Layers");

            if (Layers != null)
            {
                foreach (XmlNode layer in Layers.ChildNodes)
                {
                    if (layer.Name == "Layer")
                    {

                        Layer newLayer = new Layer().FromXml(layer,true);//.Layer.FromXml(layer, true);
                        if (newLayer != null)
                        {
                            string fileName = string.Format("{0}.txt", newLayer.ID.ToString());
                            if (LayerManager.LayerList.ContainsKey(newLayer.ID)) // && newLayer.ID != ISSLayer.ISSGuid)
                            {
                                //if (!CollisionChecked)
                                //{
                                //    if (UiTools.ShowMessageBox(Language.GetLocalizedText(958, "There are layers with the same name. Overwrite existing layers?"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope"), System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                                //    {
                                //        OverWrite = true;
                                //    }
                                //    else
                                //    {
                                //        OverWrite = false;

                                //    }
                                //    CollisionChecked = true;
                                //}

                                //if (OverWrite)
                                //{
                                LayerManager.DeleteLayerByID(newLayer.ID, true, false);
                                //}
                            }
                            try
                            {
                                newLayer.LoadedFromTour = true;
                                newLayer.LoadData(GetFileStream(fileName));
                                LayerManager.Add(newLayer, false);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                LayerManager.LoadTree();
            }

            //todo author
            //if (File.Exists(WorkingDirectory + "Author.png"))
            //{
            //    authorImage = UiTools.LoadBitmap(WorkingDirectory + "Author.png");
            //}

            tourDirty = 0;
        }
Example #48
0
      public User(UserLevel level, string name)
      {
          this.level = level;
          this.name = name;
 
      }
 /// <summary>
 /// 用户权限时,看用户等级
 /// </summary>
 /// <param name="userLevel">用户等级(如何用户为管理员也不会通过,必须是用户权限)</param>
 public RestfulRoleAuthorizeAttribute(UserLevel userLevel)
     : this(UserRole.None, userLevel)
 {
 }
Example #50
0
 public void Assign(User user)
 {
     this.level = user.Level;
     this.name = user.Name;
     
 }
Example #51
0
 public Employee(User user)
 {
     User_id = user.UserId;
     Position = user.getUserLevel();
     user.Dispose();
 }
Example #52
0
 public void Assign(UserInfo userinfo)
 {
     this.id = userinfo.id;
     this.password = userinfo.password;
     this.confirmPassword = userinfo.confirmPassword;
     this.level = userinfo.level;
     this.name = userinfo.name;
     this.phone = userinfo.Phone;
     this.note = userinfo.Note;
 }
 public void GenerateChildren(bool GenerateFields = false, UserLevel? userLevel = null)
 {
     children = GenerateList(obj, this, GenerateFields, userLevel: userLevel); // thing: thing
 }
Example #54
0
 public CommandParams(string c, string u, string m, string e, string[] s, StreamWriter r, UserLevel inv)
 {
     channel = c;
     user = u;
     message = m;
     entire = e;
     splitted = s;
     sr = r;
     invoker = inv;
 }
 private void SetLevel(UserLevel userLevel)
 {
     switch (userLevel)
     {
         case UserLevel.Beginner:
             BeginnerOption.Checked = true;
             break;
         case UserLevel.Intermediate:
             IntermediateOption.Checked = true;
             break;
         case UserLevel.Advanced:
         case UserLevel.Professional:
         case UserLevel.Educator:
             AdvancedOption.Checked = true;
             break;
     }
 }
Example #56
0
 public CommandInfo(string d, UserLevel level)
     : this(d, level, 1)
 {
 }