Example #1
0
        public void AddUserRole(int portalId, int userId, int roleId, RoleStatus status, bool isOwner, DateTime effectiveDate, DateTime expiryDate)
        {
            UserInfo     user     = UserController.GetUserById(portalId, userId);
            UserRoleInfo userRole = GetUserRole(portalId, userId, roleId);

            if (userRole == null)
            {
                //Create new UserRole
                userRole = new UserRoleInfo
                {
                    UserID        = userId,
                    RoleID        = roleId,
                    PortalID      = portalId,
                    Status        = status,
                    IsOwner       = isOwner,
                    EffectiveDate = effectiveDate,
                    ExpiryDate    = expiryDate
                };
                provider.AddUserToRole(portalId, user, userRole);
                EventLogController.Instance.AddLog(userRole, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_CREATED);
            }
            else
            {
                userRole.Status        = status;
                userRole.IsOwner       = isOwner;
                userRole.EffectiveDate = effectiveDate;
                userRole.ExpiryDate    = expiryDate;
                provider.UpdateUserRole(userRole);
                EventLogController.Instance.AddLog(userRole, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_UPDATED);
            }

            //Remove the UserInfo and Roles from the Cache, as they have been modified
            DataCache.ClearUserCache(portalId, user.Username);
            Instance.ClearRoleCache(portalId);
        }
Example #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="id"></param>
 /// <param name="rolename"></param>
 /// <param name="createtime"></param>
 /// <param name="status"></param>
 public Role(Guid id, string rolename, DateTime createtime, RoleStatus status)
 {
     this.Id         = id;
     this.Rolename   = rolename;
     this.Createtime = createtime;
     this.Status     = status;
 }
Example #3
0
        private void OnSocketConnectToServer(SocketId socketId)
        {
            if (socketId == SocketId.Gate)
            {
                Debug.Log("Connected to gate server");
                roleStatus = RoleStatus.ConnectedToGateServer;
                C_GetLoginServerInfo getLoginServerReq = new C_GetLoginServerInfo();
                NetClientManager.instance.SendMessage <C_GetLoginServerInfo>((int)SocketId.Gate, getLoginServerReq);
            }
            else if (socketId == SocketId.Main)
            {
                Debug.Log("Connected to main server");
                roleStatus = RoleStatus.ConnectedToMainServer;
                C_RoleLogin req = new C_RoleLogin();
                req.account          = "";
                req.channel          = 1;
                req.device_id        = GameUtil.GetDeviceID();
                req.device_info      = GameUtil.GetSystemInfo();
                req.login_account_id = GameUtil.GetGameLoginDeviceID();
                req.platform         = GameUtil.GetOS();
                req.sdk_info         = "";
                req.token            = "";
                req.reserve          = "";

                req.device_id        = "device123";
                req.device_info      = "xiaomi";
                req.login_account_id = "device123";
                req.platform         = "android";

                NetClientManager.instance.SendMessage <C_RoleLogin>((int)SocketId.Main, req);
            }
        }
Example #4
0
 public void init()
 {
     Debug.Log("GameService init...");
     roleStatus     = RoleStatus.ConnectingToGateServer;
     lastActionTime = Time.realtimeSinceStartup;
     NetClientManager.instance.Connect((int)SocketId.Gate, GetGateServerIp(), 17981);
 }
Example #5
0
 public static SolidColorBrush GetStatusColour(RoleStatus status, RoleIsolationMode isolationMode)
 {
     switch (status)
     {
         case RoleStatus.Starting:
             return isolationMode == RoleIsolationMode.Thread
                 ? Green
                 : Blue;
         case RoleStatus.Running:
             return isolationMode == RoleIsolationMode.Thread
                 ? Green
                 : Blue;
         case RoleStatus.Stopping:
             return BloodRed;
         case RoleStatus.Crashing:
             return BloodRed;
         case RoleStatus.Recycling:
             return BloodRed;
         case RoleStatus.Stopped:
             return Grey;
         case RoleStatus.Sequenced:
             return Grey;
         default:
             return Grey;
     }
 }
Example #6
0
 public void InitEnemyStatus(RoleStatus status)
 {
     foreach (Enemy one in m_Enemies)
     {
         one.m_CurStatus = status;
     }
 }
Example #7
0
 /// <summary>
 /// 初始化对象
 /// </summary>
 void Initialization()
 {
     _createDate    = DateTime.Now;
     _status        = RoleStatus.正常;
     _parent        = new LazyMember <Role>(LoadParentRole);
     roleRepository = this.Instance <IRoleRepository>();
 }
Example #8
0
        public void NetDataManager(NetData data)
        {
            switch ((NetStatus)data.ReadByte())
            {
            case NetStatus.GetStatus:
                NetData n = Manager.CreateNetData(NetID, (byte)NetStatus.SetStatus);
                n.Write(Heart);
                n.Write((byte)status);
                n.Write(index);
                NetServer.Send(n);
                break;

            case NetStatus.SetStatus:
                heart  = data.ReadInt();
                status = (RoleStatus)data.ReadByte();
                SetTarget(data.ReadInt(), data.RemoteIP);
                switch (status)
                {
                case RoleStatus.Death:
                    PlayDeath(data.RemoteIP);
                    break;

                case RoleStatus.Vectory:
                    PlayVictory(data.RemoteIP);
                    break;
                }
                break;

            case NetStatus.SetTarget:
                SetTarget(data.ReadInt(), data.RemoteIP);
                break;

            case NetStatus.Idle:
                PlayIdle(data.RemoteIP);
                break;

            case NetStatus.Attacking:
                PlayAttack(data.ReadInt(), data.RemoteIP);
                break;

            case NetStatus.Moving:
                break;

            case NetStatus.Hurt:
                Corsair.AttackInfo a = new Corsair.AttackInfo();
                a.Position = data.ReadVector3();
                a.Rotation = data.ReadQuaternion();
                a.Value    = data.ReadInt();
                base.Hurt(a);
                break;

            case NetStatus.Death:
                PlayDeath(data.RemoteIP);
                break;

            case NetStatus.Victory:
                PlayVictory(data.RemoteIP);
                break;
            }
        }
Example #9
0
 protected virtual void Start()
 {
     m_CurStatus = RoleStatus.Idle;
     m_CurHP     = m_MaxHP;
     this.UpdateHPShow();
     m_CurPlanesID = Constants.PlanesID_Public;
 }
Example #10
0
    /// <summary>
    /// 切换到死亡状态
    /// </summary>

    public void ToDead()
    {
        StopAllCoroutines();
        Status = RoleStatus.Dead;
        m_Rigidbody.velocity    = Vector3.down * 5;
        m_Rigidbody.isKinematic = false;
        m_Rigidbody.useGravity  = true;
        Destroy(m_Shadow.gameObject);
        if (m_CurPlatform != null)
        {
            if (m_CurPlatform.PlatfromType == PlatfromType.OtherTrap || m_CurPlatform.PlatfromType == PlatfromType.HideTrap)
            {
                GameObject go = Instantiate(m_DeadEffect);
                go.transform.position = transform.position;
                go.transform.rotation = Quaternion.identity;
                Destroy(go, 5);
                EazySoundManager.PlaySound(m_DeadAudioClip);
            }
        }


        if (OnDead != null)
        {
            OnDead(this);
        }
    }
Example #11
0
        public override void Init(string[] args, PortalSettings portalSettings, UserInfo userInfo, int activeTabId)
        {
            RoleName    = GetFlagValue(FlagRoleName, "Rolename", string.Empty, true, true);
            Description = GetFlagValue(FlagDescription, "Description", string.Empty);
            IsPublic    = GetFlagValue(FlagIsPublic, "Is Public", false);
            AutoAssign  = GetFlagValue(FlagAutoAssign, "Auto Assign", false, true);
            var status = GetFlagValue(FlagStatus, "Status", "approved");

            switch (status)
            {
            case "pending":
                Status = RoleStatus.Pending;
                break;

            case "approved":
                Status = RoleStatus.Approved;
                break;

            case "disabled":
                Status = RoleStatus.Disabled;
                break;

            default:
                AddMessage(string.Format(LocalizeString("Prompt_InvalidRoleStatus"), FlagStatus));
                break;
            }
        }
Example #12
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="roleName">the name of the role</param>
        /// <param name="gm">whether or not this role makes you a GM</param>
        /// <param name="qa">whether or not this role makes you a QA</param>
        /// <param name="inherits">the other roles this role inherits from</param>
        public RoleGroupInfo(string roleName,
                             int rank, RoleStatus status, bool gm, bool qa, bool canCommandOthers, bool canHandleTickets,
                             bool maySkipAuthQueue, bool scrambleChat,
                             string[] inherits, string[] commands)
        {
            Name                   = roleName;
            Rank                   = rank;
            Status                 = status;
            AppearAsGM             = gm;
            AppearAsQA             = qa;
            InheritanceList        = inherits;
            CommandNames           = commands;
            CanUseCommandsOnOthers = canCommandOthers;
            CanHandleTickets       = canHandleTickets;
            MaySkipAuthQueue       = maySkipAuthQueue;
            ScrambleChat           = scrambleChat;

            if (HighestRole == null || HighestRole.Rank < rank)
            {
                HighestRole = this;
            }

            if (LowestRole == null || LowestRole.Rank > m_rank)
            {
                LowestRole = this;
            }
        }
Example #13
0
        static int RoleStatusCallback(out RoleStatus status)
        {
            WriteLine("Status callback check");
            status = RoleStatus.RoleStatusHealthy;

            return(0);
        }
 protected override EmployeeInfo Parse()
 {
     return(new EmployeeInfo
     {
         ID = ToInt(ID),
         EmployeeNumber = EmployeeNumber.ToString(),
         FirstName = FirstName.ToString(),
         LastName = LastName.ToString(),
         MI = MI.ToString(),
         Email = Email.ToString(),
         Password = Password.ToString(),
         Contact = Contact.ToString(),
         Address = Address.ToString(),
         Birthday = Birthday.ToString(),
         Gender = Gender.ToString(),
         Religion = Religion.ToString(),
         Nationality = Nationality.ToString(),
         Birthplace = Birthplace.ToString(),
         CivilStatus = CivilStatus.ToString(),
         EmployeeStatusID = ToInt(EmployeeStatusID),
         DateHired = DateHired.ToString(),
         DateCreated = DateCreated.ToString(),
         DatedUpdated = DatedUpdated.ToString(),
         DatedDeleted = DatedDeleted.ToString(),
         RoleID = ToInt(RoleID),
         EmployeeStatus = EmployeeStatus.ToString(),
         RoleStatus = RoleStatus.ToString()
     });
 }
Example #15
0
        public static SolidColorBrush GetStatusColour(RoleStatus status, RoleIsolationMode isolationMode)
        {
            switch (status)
            {
            case RoleStatus.Starting:
                return(isolationMode == RoleIsolationMode.Thread
                        ? Green
                        : Blue);

            case RoleStatus.Running:
                return(isolationMode == RoleIsolationMode.Thread
                        ? Green
                        : Blue);

            case RoleStatus.Stopping:
                return(BloodRed);

            case RoleStatus.Crashing:
                return(BloodRed);

            case RoleStatus.Recycling:
                return(BloodRed);

            case RoleStatus.Stopped:
                return(Grey);

            case RoleStatus.Sequenced:
                return(Grey);

            default:
                return(Grey);
            }
        }
Example #16
0
        /// <summary>
        /// Method for Initializing everything
        /// </summary>
        private void Initialize()
        {
            storageAccount   = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
            tableClient      = storageAccount.CreateCloudTableClient();
            queueClient      = storageAccount.CreateCloudQueueClient();
            blobClient       = storageAccount.CreateCloudBlobClient();
            stopwords        = new List <string>();
            domainDictionary = new Dictionary <string, string>();
            // Initialize all tables and queues and blobs
            // tables
            domainTable            = tableClient.GetTableReference("DomainTable");
            websitePageMasterTable = tableClient.GetTableReference("WebsitePageMasterTable");
            errorTable             = tableClient.GetTableReference("ErrorTable");
            roleStatusTable        = tableClient.GetTableReference("RoleStatus");
            // queues
            urlQueue          = queueClient.GetQueueReference("urlstocrawl");
            commandQueue      = queueClient.GetQueueReference("command");
            indexedCountQueue = queueClient.GetQueueReference("indexedcount");
            // blobs
            netscrapContainer = blobClient.GetContainerReference("netscrap");
            // Create if not exist
            // tables
            domainTable.CreateIfNotExists();
            roleStatusTable.CreateIfNotExists();
            errorTable.CreateIfNotExistsAsync();
            websitePageMasterTable.CreateIfNotExists();
            urlQueue.CreateIfNotExists(); // queues
            commandQueue.CreateIfNotExists();
            bool isCreated = indexedCountQueue.CreateIfNotExists();

            if (isCreated) // if just created initialize value to zero
            {
                indexedCountQueue.AddMessageAsync(new CloudQueueMessage("0"));
            }
            netscrapContainer.CreateIfNotExistsAsync();                               // blobs
            stopwordsBlob = netscrapContainer.GetBlockBlobReference("stopwords.csv"); // stopwords blob
            StreamReader streamReader = new StreamReader(stopwordsBlob.OpenRead());
            string       line;

            // stop word lists
            while ((line = streamReader.ReadLine()) != null)
            {
                stopwords.Add(line.ToLower());
            }
            htmlDoc = new HtmlDocument()
            {
                OptionFixNestedTags = true
            };                                      // html document parser
            disallowedCharacters = new[] { '?', ',', ':', ';', '!', '&', '(', ')', '"' };
            webGet                 = new HtmlWeb(); // downloader
            container              = new List <WebsitePage>();
            instanceId             = RoleEnvironment.CurrentRoleInstance.Id;
            currentStateNumber     = (byte)STATES.STOP;
            currenStateDescription = States[currentStateNumber];
            currentWorkingUrl      = string.Empty;
            workerStatus           = new RoleStatus(this.GetType().Namespace, instanceId);                    // role workerStatus
            cpuCounter             = new PerformanceCounter("Processor", "% Processor Time", "_Total", true); // cpu counter
            ClearRoleStatusTableContent(this.GetType().Namespace);                                            // clear role workerStatus table
        }
Example #17
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="roleName">the name of the role</param>
 /// <param name="gm">whether or not this role makes you a GM</param>
 /// <param name="qa">whether or not this role makes you a QA</param>
 /// <param name="inherits">the other roles this role inherits from</param>
 public RoleGroupInfo(string roleName,
                      int rank, RoleStatus status, bool gm, bool qa, bool canCommandOthers, bool canHandleTickets,
                      bool maySkipAuthQueue, bool scrambleChat,
                      string[] inherits)
     : this(roleName, rank, status, gm, qa, canCommandOthers, canHandleTickets,
            maySkipAuthQueue, scrambleChat, inherits, null)
 {
 }
Example #18
0
 public override void Init()
 {
     m_lastStatus     = RoleStatus.None;
     m_animationState = m_dock.Anime.AnimationState;
     m_skeleton       = m_dock.Anime.skeleton;
     m_hangAnime      = m_skeleton.Data.FindAnimation(m_dock.HangAnimeName);
     m_moveAnime      = m_skeleton.Data.FindAnimation(m_dock.MoveAnimeName);
     m_landAnime      = m_skeleton.Data.FindAnimation(m_dock.LandAnimeName);
 }
Example #19
0
 private void handleS_LoginServerInfo(S_LoginServerInfo msg)
 {
     //Debug.Log("S_Exception");
     Debug.Log(msg.ipAddress + "," + msg.port);
     roleStatus = RoleStatus.ConnectingToGameServer;
     NetClientManager.instance.Connect((int)SocketId.Main, msg.ipAddress, msg.port);
     //C_GetLoginServerInfo getLoginServerReq = new C_GetLoginServerInfo();
     //NetClientManager.instance.SendMessage<C_GetLoginServerInfo>((int)SocketId.Gate, getLoginServerReq);
 }
Example #20
0
    public virtual void UpdateDataFromPhoton_Status(object data)
    {
        RoleStatus _status = (RoleStatus)(int)data;

        if (_status != m_CurStatus)
        {
            m_CurStatus = _status;
        }
    }
Example #21
0
 /// <summary>
 /// Creates new RoleUnresolved object. Copies referenced MBean names to its internal read-only collection.
 /// </summary>
 /// <param name="roleName">Name of the role which caused the problem.</param>
 /// <param name="roleValue">Value of the role, or null if the problem is the inability to read a role</param>
 /// <param name="problemType">Type of problem.</param>
 public RoleUnresolved(string roleName, IEnumerable <ObjectName> roleValue, RoleStatus problemType)
 {
     _roleName = roleName;
     if (roleValue != null)
     {
         _roleValue = new List <ObjectName>(roleValue).AsReadOnly();
     }
     _problemType = problemType;
 }
Example #22
0
 /// <summary>
 /// Creates new RoleUnresolved object. Copies referenced MBean names to its internal read-only collection.
 /// </summary>
 /// <param name="roleName">Name of the role which caused the problem.</param>
 /// <param name="roleValue">Value of the role, or null if the problem is the inability to read a role</param>
 /// <param name="problemType">Type of problem.</param>
 public RoleUnresolved(string roleName, IEnumerable<ObjectName> roleValue, RoleStatus problemType)
 {
     _roleName = roleName;
      if (roleValue != null)
      {
     _roleValue = new List<ObjectName>(roleValue).AsReadOnly();
      }
      _problemType = problemType;
 }
Example #23
0
 public void AddStatus(RoleStatus status)
 {
     statusSet.Add(status);
     UpdateRoleState();
     if (notifyStatusChange != null)
     {
         notifyStatusChange(status, true);
     }
 }
Example #24
0
 public void RemoveStatus(RoleStatus status)
 {
     statusSet.Remove(status);
     UpdateRoleState();
     if (notifyStatusChange != null)
     {
         notifyStatusChange(status, false);
     }
 }
Example #25
0
 // Use this for initialization
 void Start()
 {
     m_Shadow       = transform.Find("Shadow");
     m_Animator     = GetComponentInChildren <Animator>();
     m_BodyRenderer = transform.Find("Mesh").GetComponent <SpriteRenderer>();
     //renderer.sortingOrder = 1;
     m_Rigidbody             = GetComponent <Rigidbody>();
     m_Rigidbody.isKinematic = true;
     m_Rigidbody.useGravity  = false;
     Status = RoleStatus.Stand;
 }
    public RoleStatus LoadStatus()
    {
        if (File.Exists(Application.persistentDataPath + saveingPath))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + saveingPath, FileMode.Open);
            RoleStatus      data = (RoleStatus)bf.Deserialize(file);
            file.Close();

            return(data);
        }
        return(null);
    }
Example #27
0
    // vec : the vector of moving rotation
    public void Move(Vector3 vec)
    {
        if (m_CurStatus == RoleStatus.Die)
        {
            return;
        }
        if (m_CurStatus == RoleStatus.Atked)
        {
            return;
        }

        if (vec == Vector3.zero)
        {
            return;
        }

        m_CurStatus = RoleStatus.Move;

        vec = vec.normalized;
        this.SetCurVec_Move(vec);
        vec *= m_MoveVec * m_EffectiveVal;

        Rigidbody rig = GetComponent <Rigidbody>();

        if (rig != null)
        {
            rig.MovePosition(transform.position + vec * Time.deltaTime);
        }
        else
        {
            transform.Translate(vec * Time.deltaTime);
        }

        // action
        if (m_AniMng != null)
        {
            m_AniMng.Move();
        }

        // particle
        if (m_Particle_Dust != null && m_ParticlePos_Dust != null)
        {
            if (m_NextDustPlayTime < Time.time)
            {
                ParticleManager.instance.CreateParticle(
                    m_Particle_Dust, m_ParticlePos_Dust.position, Vector3.zero);

                m_NextDustPlayTime = Time.time + m_DustPlayInterval;
            }
        }
    }
Example #28
0
    public virtual void Idle()
    {
        if (m_CurStatus == RoleStatus.Die)
        {
            return;
        }

        m_CurStatus = RoleStatus.Idle;

        if (m_AniMng != null)
        {
            m_AniMng.Idle();
        }
    }
Example #29
0
        private void Initialize()
        {
            storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
            // iniatilize instance count
            instanceCount = (short)RoleEnvironment.CurrentRoleInstance.Role.Instances.Count;
            // Initialize Runtime Queue List
            urlList = new Dictionary <string, string>();
            // Initialize Table (WebsitePage Table)
            tableClient     = storageAccount.CreateCloudTableClient();
            roleStatusTable = tableClient.GetTableReference("RoleStatus");
            errorTable      = tableClient.GetTableReference("ErrorTable");
            // Initialize Queue (UrlToCrawl Queue)
            queueClient = storageAccount.CreateCloudQueueClient();
            urlQueue    = queueClient.GetQueueReference("urlstocrawl");
            // Initialize Queue (SeedUrls Queue)
            seedUrlQueue = queueClient.GetQueueReference("seedurls");
            // Initialize Queue (Command queue)
            commandQueue = queueClient.GetQueueReference("command");
            // Initialize indexedCount queue
            indexedCountQueue = queueClient.GetQueueReference("indexedcount");
            currentSeedUrl    = string.Empty;
            // Create robots.txt parser
            robotTxtParser = new Robots();
            // create if queues and tables does not exists
            roleStatusTable.CreateIfNotExistsAsync();
            urlQueue.CreateIfNotExistsAsync();
            seedUrlQueue.CreateIfNotExistsAsync();
            commandQueue.CreateIfNotExistsAsync();
            bool isCreated = indexedCountQueue.CreateIfNotExists();

            if (isCreated)
            {
                indexedCountQueue.AddMessageAsync(new CloudQueueMessage("0"));
            }
            errorTable.CreateIfNotExistsAsync();
            Trace.TraceInformation("Url Collector Worker has been Initialize");
            webGet  = new HtmlWeb();
            htmlDoc = new HtmlDocument();
            // instance id
            instanceId = RoleEnvironment.CurrentRoleInstance.Id;
            // workerStatus class
            workerStatus = new RoleStatus(this.GetType().Namespace, instanceId);
            // cpu counter
            cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total", true);
            // initial state stop
            currentStateNumber      = (byte)STATES.STOP;
            currentStateDescription = States[currentStateNumber];
            // clear role status table
            ClearRoleStatusTableContent(this.GetType().Namespace);
        }
Example #30
0
        public void DoAnime()
        {
            if (m_lastStatus != Status)
            {
                switch (Status)
                {
                case RoleStatus.Stand:
                {
                    break;
                }

                case RoleStatus.Move:
                {
                    m_animationState.SetAnimation(0, m_moveAnime, true);
                    break;
                }

                case RoleStatus.Jump:
                {
                    m_animationState.SetAnimation(0, m_moveAnime, true);
                    break;
                }

                case RoleStatus.Hold:
                {
                    m_animationState.SetAnimation(0, m_hangAnime, true);
                    break;
                }

                case RoleStatus.Land:
                {
                    m_animationState.SetAnimation(0, m_landAnime, false);
                    break;
                }

                case RoleStatus.Dying:
                {
                    break;
                }

                case RoleStatus.Attack:
                {
                    break;
                }
                }
                m_lastStatus = Status;
            }
        }
Example #31
0
    //攻击玩家
    private void ATK()
    {
        anim.Play("punch");//三倍速播放动画
        anim["punch"].normalizedSpeed = 3.0f;

        enemyAudio.time = 0.1f;
        enemyAudio.Play();                                          //播放音效
        navMeshAgent.SetDestination(gameObject.transform.position); //停下
        player.GetComponent <PlayerController>().beATK();
        RoleStatus playerStatus = player.GetComponent <RoleStatus>();

        playerStatus.health -= roleStatus.damage;


        Debug.Log("玩家受到了攻击,当前生命值为" + playerStatus.health);
    }
Example #32
0
        private void AddRoles_Click(object sender, EventArgs e)
        {
            if (MovieRoleBox.Text == "" || ActorRoleBox.Text == "" || RoleName.Text == "")
            {
                RoleStatus.Text      = "Missing Inputs";
                RoleStatus.ForeColor = System.Drawing.Color.Red;
                RoleStatus.Show();
                MovieRoleBox.SelectedIndex = -1;
                ActorRoleBox.SelectedIndex = -1;
                AddRoles.Enabled           = false;
                return;
            }
            int           MovieID    = Convert.ToInt32(((ComboboxItem)MovieRoleBox.SelectedItem).Key);
            int           ActorID    = Convert.ToInt32(((ComboboxItem)ActorRoleBox.SelectedItem).Key);
            String        conString  = @"Data Source=SHERIF\SQLEXPRESS;Initial Catalog=PopCornia;Persist Security Info=True;User ID=sa;Password=123456";
            SqlConnection connection = new SqlConnection(conString);

            connection.Open();
            SqlCommand query = new SqlCommand();

            query.CommandText = "INSERT INTO Roles(Movie_ID, Actor_ID, RoleName) VALUES ('" +
                                MovieID + "', '" +
                                ActorID + "', '" +
                                RoleName.Text +
                                "');";
            query.Connection  = connection;
            query.CommandType = CommandType.Text;
            try
            {
                query.ExecuteNonQuery();
                RoleStatus.Text      = "Added!";
                RoleStatus.ForeColor = System.Drawing.Color.LimeGreen;
                RoleStatus.Show();
                RoleName.Clear();
            }
            catch (Exception x)
            {
                RoleStatus.Text      = "Role Already Exist!";
                RoleStatus.ForeColor = System.Drawing.Color.Red;
                RoleStatus.Show();
                RoleName.Clear();
            }
            AddRoles.Enabled           = false;
            MovieRoleBox.SelectedIndex = -1;
            ActorRoleBox.SelectedIndex = -1;
            updateDropLists(6);
        }
Example #33
0
		/// <summary>
		/// Default constructor.
		/// </summary>
		/// <param name="roleName">the name of the role</param>
		/// <param name="gm">whether or not this role makes you a GM</param>
		/// <param name="qa">whether or not this role makes you a QA</param>
		/// <param name="inherits">the other roles this role inherits from</param>
		public RoleGroupInfo(string roleName,
			int rank, RoleStatus status, bool gm, bool qa, bool canCommandOthers, bool canHandleTickets,
			bool maySkipAuthQueue, bool scrambleChat,
			string[] inherits, string[] commands)
		{
			Name = roleName;
			Rank = rank;
			Status = status;
			AppearAsGM = gm;
			AppearAsQA = qa;
			InheritanceList = inherits;
			CommandNames = commands;
			CanUseCommandsOnOthers = canCommandOthers;
			CanHandleTickets = canHandleTickets;
			MaySkipAuthQueue = maySkipAuthQueue;
			ScrambleChat = scrambleChat;

			if (HighestRole == null || HighestRole.Rank < rank)
			{
				HighestRole = this;
			}

			if (LowestRole == null || LowestRole.Rank > m_rank)
			{
				LowestRole = this;
			}
		}
Example #34
0
 /// <summary>
 /// 启用角色
 /// </summary>
 public void Enable() {
     this.status = RoleStatus.Enabled;
 }
Example #35
0
        public void AddUserRole(int portalId, int userId, int roleId, RoleStatus status, bool isOwner, DateTime effectiveDate, DateTime expiryDate)
        {
            UserInfo user = UserController.GetUserById(portalId, userId);
            UserRoleInfo userRole = GetUserRole(portalId, userId, roleId);
            var eventLogController = new EventLogController();
            if (userRole == null)
            {
                //Create new UserRole
                userRole = new UserRoleInfo
                {
                    UserID = userId,
                    RoleID = roleId,
                    PortalID = portalId,
                    Status = status,
                    IsOwner = isOwner,
                    EffectiveDate = effectiveDate,
                    ExpiryDate = expiryDate
                };
                provider.AddUserToRole(portalId, user, userRole);
                eventLogController.AddLog(userRole, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_CREATED);
            }
            else
            {
                userRole.Status = status;
                userRole.IsOwner = isOwner;
                userRole.EffectiveDate = effectiveDate;
                userRole.ExpiryDate = expiryDate;
                provider.UpdateUserRole(userRole);
                eventLogController.AddLog(userRole, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_UPDATED);
            }

            //Remove the UserInfo and Roles from the Cache, as they have been modified
            DataCache.ClearUserCache(portalId, user.Username);
            TestableRoleController.Instance.ClearRoleCache(portalId);
        }
Example #36
0
		/// <summary>
		/// Default constructor.
		/// </summary>
		/// <param name="roleName">the name of the role</param>
		/// <param name="gm">whether or not this role makes you a GM</param>
		/// <param name="qa">whether or not this role makes you a QA</param>
		/// <param name="inherits">the other roles this role inherits from</param>
		public RoleGroupInfo(string roleName,
			int rank, RoleStatus status, bool gm, bool qa, bool canCommandOthers, bool canHandleTickets,
			bool maySkipAuthQueue, bool scrambleChat,
			string[] inherits)
			: this(roleName, rank, status, gm, qa, canCommandOthers, canHandleTickets, 
			maySkipAuthQueue, scrambleChat, inherits, null)
		{
		}
Example #37
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Adds a User to a Role
        /// </summary>
        /// <param name="user">The user to assign</param>
        /// <param name="role">The role to add</param>
        /// <param name="portalSettings">The PortalSettings of the Portal</param>
        /// <param name="status">RoleStatus</param>
        /// <param name="effectiveDate">The expiry Date of the Role membership</param>
        /// <param name="expiryDate">The expiry Date of the Role membership</param>
        /// <param name="notifyUser">A flag that indicates whether the user should be notified</param>
        /// <param name="isOwner">A flag that indicates whether this user should be one of the group owners</param>
        /// -----------------------------------------------------------------------------
        public static void AddUserRole(UserInfo user, RoleInfo role, PortalSettings portalSettings, RoleStatus status, DateTime effectiveDate, DateTime expiryDate, bool notifyUser, bool isOwner)
        {
            var roleController = new RoleController();
            var userRole = roleController.GetUserRole(portalSettings.PortalId, user.UserID, role.RoleID);
            var eventLogController = new EventLogController();

            //update assignment
            roleController.AddUserRole(portalSettings.PortalId, user.UserID, role.RoleID, status, isOwner, effectiveDate, expiryDate);

            UserController.UpdateUser(portalSettings.PortalId, user);
            if (userRole == null)
            {
                eventLogController.AddLog("Role", role.RoleName, portalSettings, user.UserID, EventLogController.EventLogType.USER_ROLE_CREATED);

                //send notification
                if (notifyUser)
                {
                    SendNotification(user, role, portalSettings, UserRoleActions.@add);
                }
            }
            else
            {
                eventLogController.AddLog("Role", role.RoleName, portalSettings, user.UserID, EventLogController.EventLogType.USER_ROLE_UPDATED);
                if (notifyUser)
                {
                    roleController.GetUserRole(portalSettings.PortalId, user.UserID, role.RoleID);
                    SendNotification(user, role, portalSettings, UserRoleActions.update);
                }
            }

            //Remove the UserInfo from the Cache, as it has been modified
            DataCache.ClearUserCache(portalSettings.PortalId, user.Username);
        }
Example #38
0
        public void UpdateUserRole(int portalId, int userId, int roleId, RoleStatus status, bool isOwner, bool cancel)
        {
            UserInfo user = UserController.GetUserById(portalId, userId);
            UserRoleInfo userRole = GetUserRole(portalId, userId, roleId);
            var eventLogController = new EventLogController();
            if (cancel)
            {
                if (userRole != null && userRole.ServiceFee > 0.0 && userRole.IsTrialUsed)
                {
                    //Expire Role so we retain trial used data
                    userRole.ExpiryDate = DateTime.Now.AddDays(-1);
                    userRole.Status = status;
                    userRole.IsOwner = isOwner;
                    provider.UpdateUserRole(userRole);
                    eventLogController.AddLog(userRole, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_UPDATED);
                }
                else
                {
                    //Delete Role
                    DeleteUserRoleInternal(portalId, userId, roleId);
                    eventLogController.AddLog("UserId",
                                       userId.ToString(CultureInfo.InvariantCulture),
                                       PortalController.GetCurrentPortalSettings(),
                                       UserController.GetCurrentUserInfo().UserID,
                                       EventLogController.EventLogType.USER_ROLE_DELETED);
                }
            }
            else
            {
                int UserRoleId = -1;
                DateTime ExpiryDate = DateTime.Now;
                DateTime EffectiveDate = Null.NullDate;
                bool IsTrialUsed = false;
                int Period = 0;
                string Frequency = "";
                if (userRole != null)
                {
                    UserRoleId = userRole.UserRoleID;
                    EffectiveDate = userRole.EffectiveDate;
                    ExpiryDate = userRole.ExpiryDate;
                    IsTrialUsed = userRole.IsTrialUsed;
                }
                RoleInfo role = TestableRoleController.Instance.GetRole(portalId, r => r.RoleID == roleId);
                if (role != null)
                {
                    if (IsTrialUsed == false && role.TrialFrequency != "N")
                    {
                        Period = role.TrialPeriod;
                        Frequency = role.TrialFrequency;
                    }
                    else
                    {
                        Period = role.BillingPeriod;
                        Frequency = role.BillingFrequency;
                    }
                }
                if (EffectiveDate < DateTime.Now)
                {
                    EffectiveDate = Null.NullDate;
                }
                if (ExpiryDate < DateTime.Now)
                {
                    ExpiryDate = DateTime.Now;
                }
                if (Period == Null.NullInteger)
                {
                    ExpiryDate = Null.NullDate;
                }
                else
                {
                    switch (Frequency)
                    {
                        case "N":
                            ExpiryDate = Null.NullDate;
                            break;
                        case "O":
                            ExpiryDate = new DateTime(9999, 12, 31);
                            break;
                        case "D":
                            ExpiryDate = ExpiryDate.AddDays(Period);
                            break;
                        case "W":
                            ExpiryDate = ExpiryDate.AddDays(Period * 7);
                            break;
                        case "M":
                            ExpiryDate = ExpiryDate.AddMonths(Period);
                            break;
                        case "Y":
                            ExpiryDate = ExpiryDate.AddYears(Period);
                            break;
                    }
                }
                if (UserRoleId != -1 && userRole != null)
                {
                    userRole.ExpiryDate = ExpiryDate;
                    userRole.Status = status;
                    userRole.IsOwner = isOwner;
                    provider.UpdateUserRole(userRole);
                    eventLogController.AddLog(userRole, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_UPDATED);
                }
                else
                {
                    AddUserRole(portalId, userId, roleId, status, isOwner, EffectiveDate, ExpiryDate);
                }
            }

            //Remove the UserInfo from the Cache, as it has been modified
            DataCache.ClearUserCache(portalId, user.Username);
            TestableRoleController.Instance.ClearRoleCache(portalId);
        }
 /// <summary>
 /// 多条件查询
 /// </summary>
 /// <param name="name">名字</param>
 /// <param name="description">描述</param>
 /// <param name="startCreateTime">结束时间</param>
 /// <param name="endCreateTime">开始时间</param>
 /// <param name="status">状态</param>
 /// <returns></returns>
 public IList<Role> QueryByCondtion(string name, string description, DateTime? startCreateTime, DateTime? endCreateTime, RoleStatus status = RoleStatus.正常)
 {
     return _roleRepository.QueryByCondtion(name, description, startCreateTime, endCreateTime, status);
 }
Example #40
0
 /// <summary>
 /// 禁用角色
 /// </summary>
 public void Disable() {
     this.status = RoleStatus.Disabled;
 }