Ejemplo n.º 1
0
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lblUserType = e.Row.FindControl("lblUserType") as Label;
                NoName.NetShop.ShopFlow.ExpressInfoModel model = e.Row.DataItem as NoName.NetShop.ShopFlow.ExpressInfoModel;
                MemberType userType  = (MemberType)model.UserType;
                UserLevel  userLevel = (UserLevel)model.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;
                }
            }
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 3
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:更多逻辑
     }
 }
Ejemplo n.º 4
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:更多逻辑
        }
    }
Ejemplo n.º 5
0
		private void ShowText(UserLevel user)
		{
			if(user!=null)
			{
				this.lblshow.Text=user.ToString();
			}
			else
			{
				this.lblshow.Text="Bad Level!";
			}
		}
Ejemplo n.º 6
0
        public void UpdateUserLogged(string shortUsername, UserLevel userlevel)
        {
            string oldUsername = (Host.UserName != null) ? Host.UserName : String.Empty;

            Data.SendToChangeLog(Host.StationNumber, "Регистрация", "Пользователь",
                                 oldUsername, shortUsername,
                                 ((shortUsername.Equals("Нет регистрации")) ? oldUsername : shortUsername),
                                 "Уровень доступа: " + userlevel.ToString());
            tlbUserLogged.Text = shortUsername;
            Host.UserName      = shortUsername;
            Host.UserLevel     = userlevel;
        }
Ejemplo n.º 7
0
        void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // ... Get the ComboBox.
            var comboBox = sender as ComboBox;

            // ... Set SelectedItem as Window Title.
            UserLevel value = comboBox.SelectedItem as UserLevel;

            this.Title = "Selected: " + value.ToString();

            SetUserLevel(value);
        }
Ejemplo n.º 8
0
        public override Boolean isPresentInDoc(XDocument _doc)
        {
            var     headTag          = _doc.Descendants(tagName).FirstOrDefault();
            Boolean IsUserTagPresent = false;

            if (headTag != null)
            {
                switch (p_user)
                {
                case UserLevel.RS:
                    IsUserTagPresent = headTag.Descendants("fHwKeyRSDept").FirstOrDefault() != null;
                    break;

                case UserLevel.WIP:
                    IsUserTagPresent = headTag.Descendants("fHwKeyWIP").FirstOrDefault() != null;
                    break;

                case UserLevel.Service:
                    IsUserTagPresent = headTag.Descendants("fHwKeyService").FirstOrDefault() != null;
                    break;

                case UserLevel.Test:
                    IsUserTagPresent = headTag.Descendants("fHwKeyTesting").FirstOrDefault() != null;
                    break;

                case UserLevel.Standard:
                    IsUserTagPresent = headTag.Descendants("fHwKeyProduction").FirstOrDefault() != null;
                    break;

                default:
                    throw new ApplicationException("Unhandled user level " + p_user.ToString());
                }
            }

            return(base.isPresentInDoc(_doc) && IsUserTagPresent);
        }
Ejemplo n.º 9
0
        private void UserChanged(object sender, EventArgs e)
        {
            try
            {
                UIUtility.Invoke(this, () =>
                {
                    btnLogout.Enabled  = (_userAccess.getCurrentUser() != _userAccess.DefaultUser);
                    txtUserName.Text   = _userAccess.getCurrentUser().Name;
                    labelUserName.Text = _userAccess.getCurrentUser().EmpName;
                    UserLevel level    = _userAccess.getCurrentUser().Level;

                    if (!HSTMachine.Workcell.CCCMachineTriggeringActivated && !HSTMachine.Workcell.Process.IsRunState)
                    {
                        HSTMachine.Instance.MainForm.getPanelNavigation().SetPanel("Operation");
                        UserControl activePanel  = Seagate.AAS.Parsel.Services.ServiceManager.MenuNavigator.GetActivePanel();
                        TabControl tabControl    = activePanel.Controls[0] as TabControl;
                        tabControl.SelectedIndex = 0;
                    }

                    XyratexOSC.Logging.Log.Info(this, "User:{0} from user group:{1} has logged in.", _userAccess.getCurrentUser().Name, level.ToString());
                    switch (level)
                    {
                    case UserLevel.Monitor:
                        userIcon.Image          = Properties.Resources.UserMonitor;
                        labelUserName.BackColor = Color.FromArgb(255, 255, 192);
                        break;

                    case UserLevel.Operator:
                        userIcon.Image          = Properties.Resources.UserOperator;
                        labelUserName.BackColor = Color.FromArgb(255, 255, 192);
                        break;

                    case UserLevel.Engineer:
                        userIcon.Image          = Properties.Resources.UserEngineer;
                        labelUserName.BackColor = Color.LimeGreen;
                        break;

                    case UserLevel.Administrator:
                        userIcon.Image          = Properties.Resources.UserAdministrator;
                        labelUserName.BackColor = Color.LimeGreen;
                        break;
                    }
                });
            }
            catch { }
        }
Ejemplo n.º 10
0
        public override bool AddUser(string username, UserLevel userlevel, string addedBy, long addedOn)
        {
            UInt32 userid = this.Parent.GetUserID(username);

            if (userid < 1)
            {
                return(false);
            }
            if (this.Parent.IsBot(username))
            {
                return(false);
            }

            username = Format.UppercaseFirst(username);

            if (this.UserExists(username, userid))
            {
                return(true);
            }

            this._config.ExecuteNonQuery("REPLACE INTO CORE_Members VALUES ('" + Config.EscapeString(username) + "', " + userid + ", '" + userlevel.ToString() + "', '" + Format.UppercaseFirst(Config.EscapeString(addedBy)) + "', " + addedOn + ")");
            return(true);
        }
Ejemplo n.º 11
0
 public override string ToString()
 {
     return($"{Username} - {UserLevel.ToString()}");
 }
Ejemplo n.º 12
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            #region Защита от повторного запуска
            Process process = RunningInstance();
            if (process != null)
            {
                Application.Exit(); return;
            }
            #endregion
            this.Width         = 0;
            this.Height        = 1;
            MustWinLogOff      = false;
            AlarmAsked         = true;
            EntityAsked        = String.Empty;
            this.StationNumber = Properties.Settings.Default.Station;
            SplashForm         = new frmAbout();
            SplashForm.Show();
            SplashForm.Refresh();
            LoadUsersList(Application.StartupPath + "\\users.xml");
            IDictionary <string, IPointPlugin> plugins = PointPlugin.LoadPlugins(Application.StartupPath);
            DrawPlugin.LoadPlugins(Application.StartupPath);
            Data.RestoreSQLsettings(Application.StartupPath);
            Settings.CreateDataAndFetchBases();
            #region Создание кэша картинок на диске
            try { DrawPlugin.RestoreImageCatalog(Application.StartupPath + "\\images\\"); }
            catch (Exception ex)
            {
                Data.SendToSystemLog(StationNumber, "Картинки",
                                     "Ошибка: " + ex.Message);
            }
            #endregion
            baseVersion        = Data.LoadBase(plugins);
            timerClock.Enabled = true;
            timerFetch.Enabled = true;
            Data.SendToChangeLog(StationNumber, "Станция RemX", "Старт", String.Empty, "Работа",
                                 "Автономно", "Уровень доступа: " + UserLevel.ToString());
            Data.SendToSystemLog(StationNumber, "Станция RemX", "Рабочая станция загружена");
            ClientID = Data.ClientLogin(ClientID, "S", StationNumber, Properties.Settings.Default.StationName);
            LoadFetchServers();

            //if (ServerSQL.HostIsLocalhost()) startFetchServices();

            bool     winmode  = Properties.Settings.Default.WindowMode;
            Screen[] monitors = Screen.AllScreens;
            panels = new frmPanel[monitors.Length];
            for (int i = 0; i < monitors.Length; i++)
            {
                if (!winmode || winmode && monitors[i].Primary)
                {
                    panels[i] = new frmPanel(this, monitors[i].Primary, monitors[i].WorkingArea);
                    if (winmode)
                    {
                        panels[i].FormBorderStyle    = System.Windows.Forms.FormBorderStyle.Sizable;
                        panels[i].pnlCaption.Visible = false;
                        panels[i].stpStatus.Visible  = false;
                        panels[i].Size = new System.Drawing.Size(
                            Properties.Settings.Default.PanelWidth,
                            Properties.Settings.Default.PanelHeight);
                        panels[i].Location = new System.Drawing.Point(
                            Properties.Settings.Default.PanelLeft,
                            Properties.Settings.Default.PanelTop);
                    }
                    panels[i].Show(this);
                }
            }
            PeriodicalCheck();
        }
Ejemplo n.º 13
0
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRowView row          = e.Row.DataItem as DataRowView;
                MemberType  userType     = (MemberType)(Convert.ToInt32(row["userType"]));
                UserLevel   userLevel    = (UserLevel)Convert.ToInt32(row["userLevel"]);
                MemberType  newUserType  = (MemberType)(row["newuserType"] == DBNull.Value?0 : Convert.ToInt32(row["newuserType"]));
                UserLevel   newUserLevel = (UserLevel)(row["newuserLevel"] == DBNull.Value? 0: Convert.ToInt32(row["newuserLevel"]));
                int         changeType   = row["changetype"] == DBNull.Value? 0: Convert.ToInt32(row["changetype"]);

                Label lblUserType     = e.Row.FindControl("lblUserType") as Label;
                Label lblUserLevel    = e.Row.FindControl("lblUserLevel") as Label;
                Label lblNewUserType  = e.Row.FindControl("lblNewUserType") as Label;
                Label lblNewUserLevel = e.Row.FindControl("lblNewUserLevel") as Label;
                Label lblChangeType   = e.Row.FindControl("lblChangeType") as Label;

                switch (userType)
                {
                case MemberType.Personal:
                    lblUserType.Text  = "个人会员";
                    lblUserLevel.Text = userLevel.ToString();
                    break;

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

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

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

                default:
                    lblUserType.Text  = "个人会员";
                    lblUserLevel.Text = userLevel.ToString();
                    break;
                }

                switch (newUserType)
                {
                case MemberType.Personal:
                    lblNewUserType.Text = "个人会员";
                    break;

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

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

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

                if (newUserLevel != UserLevel.登鼎会员)
                {
                    lblNewUserLevel.Text = newUserLevel.ToString();
                }

                if (changeType == 1)
                {
                    lblChangeType.Text = "申请会员升级";
                }
                else if (changeType == 2)
                {
                    lblChangeType.Text = "申请修改类别";
                }
            }
        }
Ejemplo n.º 14
0
        private void UserChanged(object sender, EventArgs e)
        {
            try
            {
                UIUtility.BeginInvoke(this, () =>
                {
                    btnLogout.Enabled = (_userAccess.getCurrentUser() != _userAccess.DefaultUser);
                    txtUserName.Text  = _userAccess.getCurrentUser().Name;

                    UserLevel level = _userAccess.getCurrentUser().Level;

                    XyratexOSC.Logging.Log.Info(this, "User:{0} from user group:{1} has logged in.", _userAccess.getCurrentUser().Name, level.ToString());

                    TabPage tabPageApplicationSettings       = MainForm.getTabControl().TabPages[9] as TabPage;
                    TabControl tabControlApplicationSettings = tabPageApplicationSettings.Controls.Find("tabControlApplicationSettings", true).FirstOrDefault() as TabControl;

                    (MainForm.getTabControl().TabPages[0] as Control).Enabled = true;  // Bench Tests tab
                    (MainForm.getTabControl().TabPages[1] as Control).Enabled = true;  // Functional Tests tab
                    (MainForm.getTabControl().TabPages[8] as Control).Enabled = true;  // Desktop Tests tab

                    switch (level)
                    {
                    case UserLevel.Monitor:
                    case UserLevel.Operator:
                        userIcon.Image = Properties.Resources.UserOperator;
                        (MainForm.getTabControl().TabPages[2] as Control).Enabled      = false; // Configurwtion & Setup tab
                        (MainForm.getTabControl().TabPages[3] as Control).Enabled      = false; // PCBA Calibration tab
                        (MainForm.getTabControl().TabPages[4] as Control).Enabled      = false; // Cable Calibration tab
                        (MainForm.getTabControl().TabPages[5] as Control).Enabled      = false; // Precisor Compensation tab
                        (MainForm.getTabControl().TabPages[6] as Control).Enabled      = false; // Debug tab
                        (MainForm.getTabControl().TabPages[7] as Control).Enabled      = false; // ServoCalibration tab
                        (MainForm.getTabControl().TabPages[9] as Control).Enabled      = false; // Application Settings tab
                        (tabControlApplicationSettings.TabPages[0] as Control).Enabled = false; // COM Port tab
                        (tabControlApplicationSettings.TabPages[1] as Control).Enabled = false; // User Accounts tab
                        break;

                    case UserLevel.Engineer:
                        userIcon.Image = Properties.Resources.UserEngineer;
                        (MainForm.getTabControl().TabPages[2] as Control).Enabled      = true;  // Configurwtion & Setup tab
                        (MainForm.getTabControl().TabPages[3] as Control).Enabled      = true;  // PCBA Calibration tab
                        (MainForm.getTabControl().TabPages[4] as Control).Enabled      = true;  // Cable Calibration tab
                        (MainForm.getTabControl().TabPages[5] as Control).Enabled      = true;  // Precisor Compensation tab
                        (MainForm.getTabControl().TabPages[6] as Control).Enabled      = true;  // Debug tab
                        (MainForm.getTabControl().TabPages[7] as Control).Enabled      = true;  // ServoCalibration tab
                        (MainForm.getTabControl().TabPages[9] as Control).Enabled      = true;  // Application Settings tab
                        (tabControlApplicationSettings.TabPages[0] as Control).Enabled = true;  // COM Port tab
                        (tabControlApplicationSettings.TabPages[1] as Control).Enabled = false; // User Accounts tab
                        break;

                    case UserLevel.Administrator:
                        userIcon.Image = Properties.Resources.UserAdministrator;
                        (MainForm.getTabControl().TabPages[2] as Control).Enabled      = true;  // Configurwtion & Setup tab
                        (MainForm.getTabControl().TabPages[3] as Control).Enabled      = true;  // PCBA Calibration tab
                        (MainForm.getTabControl().TabPages[4] as Control).Enabled      = true;  // Cable Calibration tab
                        (MainForm.getTabControl().TabPages[5] as Control).Enabled      = true;  // Precisor Compensation tab
                        (MainForm.getTabControl().TabPages[6] as Control).Enabled      = true;  // Debug tab
                        (MainForm.getTabControl().TabPages[7] as Control).Enabled      = true;  // ServoCalibration tab
                        (MainForm.getTabControl().TabPages[9] as Control).Enabled      = true;  // Application Settings tab
                        (tabControlApplicationSettings.TabPages[0] as Control).Enabled = true;  // COM Port tab
                        (tabControlApplicationSettings.TabPages[1] as Control).Enabled = true;  // User Accounts tab
                        break;
                    }
                });
            }
            catch { }
        }
Ejemplo n.º 15
0
        private void OnCommandsSetCommand(BotShell bot, CommandArgs e)
        {
            if (e.Args.Length < 3)
            {
                bot.SendReply(e, "Usage: commands set [command] [target] [level]");
                return;
            }
            string command = e.Args[0].ToLower().Replace("_", " ");

            if (!bot.Commands.Exists(command))
            {
                bot.SendReply(e, "No such command!");
                return;
            }
            if (bot.Plugins.GetState(bot.Commands.GetInternalName(command)) == PluginState.Core)
            {
                bot.SendReply(e, "You can't change the command rights on Core plugins!");
                return;
            }
            CommandType type         = CommandType.Tell;
            string      friendlyType = string.Empty;

            switch (e.Args[1].ToLower())
            {
            case "tell":
                type         = CommandType.Tell;
                friendlyType = "tells";
                break;

            case "pg":
                type         = CommandType.PrivateChannel;
                friendlyType = "the private channel";
                break;

            case "org":
                type         = CommandType.Organization;
                friendlyType = "the organization channel";
                break;

            default:
                bot.SendReply(e, "Invalid target. Valid targets are: tell, pg, org");
                return;
            }
            UserLevel right = UserLevel.SuperAdmin;

            try
            {
                right = (UserLevel)Enum.Parse(typeof(UserLevel), e.Args[2]);
            }
            catch
            {
                bot.SendReply(e, "Invalid level. Valid levels are: SuperAdmin, Admin, Leader, Member, Guest, Disabled");
                return;
            }
            bot.Commands.SetRight(command, type, right);
            if (right != UserLevel.Disabled)
            {
                bot.SendReply(e, "The required userlevel for the command " + HTML.CreateColorString(bot.ColorHeaderHex, command) + " from " + friendlyType + " has been set to " + HTML.CreateColorString(bot.ColorHeaderHex, right.ToString()));
            }
            else
            {
                bot.SendReply(e, "Access to the command " + HTML.CreateColorString(bot.ColorHeaderHex, command) + " from " + friendlyType + " has been disabled");
            }
        }
Ejemplo n.º 16
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            switch (e.Command)
            {
            case "members clear":
                if (e.Args.Length == 0 || e.Args[0] != "confirm")
                {
                    bot.SendReply(e, "This command will remove ALL members. If you wish to continue use: /tell " + bot.Character + " members clear confirm");
                    break;
                }
                bot.Users.RemoveAll();
                bot.SendReply(e, "All members have been removed");
                break;

            case "members add":
            case "members remove":
            case "members promote":
            case "members demote":
                if (e.Args.Length < 1)
                {
                    bot.SendReply(e, "Correct Usage: " + e.Command + " [username]");
                    break;
                }
                if (bot.GetUserID(e.Args[0]) < 1)
                {
                    bot.SendReply(e, "No such user: "******"members add":
                    if (bot.Users.UserExists(username, bot.GetUserID(username)))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " is already a member of this bot");
                        break;
                    }
                    if (bot.Users.IsAlt(username))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " is register as alt on this bot");
                        break;
                    }
                    if (bot.Users.AddUser(username, UserLevel.Member, e.Sender))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " has been added to this bot");
                    }
                    else
                    {
                        bot.SendReply(e, "An unknown error has occurred");
                    }
                    break;

                case "members remove":
                    if (bot.Users.IsAlt(username))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " is alt and can't be removed using this command");
                        break;
                    }
                    if (!bot.Users.UserExists(username))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " is not a member of this bot");
                        break;
                    }
                    bot.Users.RemoveUser(username);
                    bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " has been removed from this bot");
                    break;

                case "members promote":
                    if (!bot.Users.UserExists(username))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " is not a member of this bot");
                        break;
                    }
                    UserLevel promotelevel = bot.Users.GetUser(username);
                    if (promotelevel >= bot.Users.GetUser(e.Sender))
                    {
                        bot.SendReply(e, "You can't promote a user to a higher rank than your own rank!");
                        break;
                    }
                    try
                    {
                        promotelevel = (UserLevel)((int)promotelevel * 2);
                        if (promotelevel != UserLevel.Disabled)
                        {
                            if (bot.Users.SetUser(username, promotelevel))
                            {
                                bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " has been promoted to " + HTML.CreateColorString(bot.ColorHeaderHex, promotelevel.ToString()));
                                break;
                            }
                        }
                    }
                    catch { }
                    bot.SendReply(e, "An unknown error has occurred");
                    break;

                case "members demote":
                    if (!bot.Users.UserExists(username))
                    {
                        bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " is not a member of this bot");
                        break;
                    }
                    UserLevel demotelevel = bot.Users.GetUser(username);
                    if (demotelevel > bot.Users.GetUser(e.Sender))
                    {
                        bot.SendReply(e, "You can't demote a user that outranks you!");
                        break;
                    }
                    if (bot.Admin.ToLower() == username.ToLower())
                    {
                        bot.SendReply(e, "You can't demote the main bot administrator!");
                        bot.SendPrivateMessage(bot.Admin, bot.ColorHeader + e.Sender + bot.ColorHighlight + " attempted to demote you!");
                        break;
                    }
                    try
                    {
                        demotelevel = (UserLevel)((int)demotelevel / 2);
                        if (demotelevel != UserLevel.Guest)
                        {
                            if (bot.Users.SetUser(username, demotelevel))
                            {
                                bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(username)) + " has been demoted to " + HTML.CreateColorString(bot.ColorHeaderHex, demotelevel.ToString()));
                                break;
                            }
                        }
                        else
                        {
                            bot.SendReply(e, "You can't demote a user to a rank below member!");
                            break;
                        }
                    }
                    catch { }
                    bot.SendReply(e, "An unknown error has occurred");
                    break;
                }
                break;

            case "alts add":
                this.OnAltsAddCommand(bot, e);
                break;

            case "alts remove":
                this.OnAltsRemoveCommand(bot, e);
                break;

            case "alts admin add":
                this.OnAltsAdminAddCommand(bot, e);
                break;

            case "alts admin remove":
                this.OnAltsAdminRemoveCommand(bot, e);
                break;
            }
        }