Inheritance: MonoBehaviour
        public AddEditStaff(string name, string staffID, string email, DateTime renewPasswordDate, DateTime dateOfBirth, DateTime joinDate, string gender, string position, string contact, bool defaultPassword, bool blocked)
        {
            InitializeComponent();
            lblStaffID.Text = staffID;
            txtName.Text = name;
            txtEmail.Text = email;
            dtpPswExpirateDate.Value = renewPasswordDate;
            dtpDoB.Value = dateOfBirth;
            dtpJoinDate.Value = joinDate;
            cbGender.Text = gender;
            isDefaultPassword = defaultPassword;

            cbGender.DropDownStyle = ComboBoxStyle.DropDown;
            cbPosition.DropDownStyle = ComboBoxStyle.DropDown;
            cbPosition.Text = position;
            txtContact.Text = contact;
            chkDefaultPsw.Checked = defaultPassword;
            chkBlocked.Checked = blocked;

            txtName.Enabled = false;
            txtEmail.Enabled = false;
            dtpPswExpirateDate.Enabled = false;
            dtpDoB.Enabled = false;
            dtpJoinDate.Enabled = false;
            cbGender.Enabled = false;

            if (defaultPassword == true)
            {
                chkDefaultPsw.Enabled = false;
            }

            currentAction = ActionType.Edit;
        }
Example #2
0
 /// <summary>
 /// Logs the specified username.
 /// </summary>
 /// <param name="username">The username.</param>
 /// <param name="ip">The ip.</param>
 /// <param name="action">The action.</param>
 public static void Log(string username, string ip, ActionType action)
 {
     using (SqlConnection conn = Config.DB.Open())
     {
         SqlHelper.GetDB().ExecuteNonQuery( "SaveIPLog", username, ip, (int) action);
     }
 }
Example #3
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.Victory)
     return type == ActionType.VictoryForever;
   else
     return true;
 }
Example #4
0
		public Instruction(ActionType type, int from, int to)
		{
			// Dupe can also use the other constructors, but specifying the target via this one is prefered even though it won't affect anything in the actual combine. This is required by the CondenseSlots logic to move the final base gem when no longer needed, but is also useful for debugging.
			this.Action = type;
			this.From = from;
			this.To = to;
		}
Example #5
0
        private double[] _results;  // global place to store the workload results for verication

        #endregion

        public ParallelInvokeTest(ParallelInvokeTestParameters parameters)
        {
            _count = parameters.Count;
            _actionType = parameters.ActionType;

            _actions = new Action[_count];
            _results = new double[_count];

            // intialize actions 
            for (int i = 0; i < _count; i++)
            {
                int iCopy = i;
                if (_actionType == ActionType.Empty)
                {
                    _actions[i] = new Action(delegate { });
                }
                else if (_actionType == ActionType.EqualWorkload)
                {
                    _actions[i] = new Action(delegate
                    {
                        _results[iCopy] = ZetaSequence(SEED);
                    });
                }
                else
                {
                    _actions[i] = new Action(delegate
                    {
                        _results[iCopy] = ZetaSequence((iCopy + 1) * SEED);
                    });
                }
            }
        }
Example #6
0
		public Instruction(ActionType action, int from, int to)
		{
			if (from < 0)
			{
				throw new ArgumentOutOfRangeException(nameof(from), "Invalid slot in instruction.");
			}

			if (to < 0)
			{
				throw new ArgumentOutOfRangeException(nameof(to), "Invalid slot in instruction.");
			}

			if (action == ActionType.Upgrade)
			{
				if (from != to)
				{
					throw new ArgumentException("From and to parameters are not equal in an Upgrade instruction.");
				}
			}
			else
			{
				if (from == to)
				{
					throw new ArgumentException("From and to parameters cannot be equal except in an Upgrade instruction.");
				}
			}

			this.Action = action;
			this.From = from;
			this.To = to;
		}
 public AddEditProduct(ref DataTable productList)
 {
     InitializeComponent();
     lblProductID.Text = mainController.GenerateNextAvailableProductID();
     currentProductList = productList;
     currentAction = ActionType.Add;
 }
Example #8
0
	public void SetAction(ActionType pendingAction)
	{
		Debug.Log("SET THIS ACTION: "+pendingAction);

		if (!m_hasAction)
		{
			if(pendingAction._energyCost < _uiController._currentEnergy)
			{
				LockActions();
				_uiController.ReduceEnergy(pendingAction._energyCost);

				//No action has yet been set
				m_hasAction = true;
				
				if(pendingAction._instantApply)
				{
					//We have an instant action
					ActivateAction(pendingAction);
				}
				else
				{
					//We have a queued action
					SetQueuedAction(pendingAction);
				}
			}
		}
	}
Example #9
0
 /*		Action (string actionName, Sprite actionSprite, ActionType actionType) {
     Name = actionName;
     Sprite = actionSprite;
     Type = actionType;
     Enabled = true;
 }*/
 public void setAction(string actionName, Sprite actionSprite, ActionType actionType)
 {
     Name = actionName;
     Sprite = actionSprite;
     Type = actionType;
     Enabled = true;
 }
Example #10
0
 [JsonConstructor] public PartyParam(string parameters,TargetParam targetparam,int targetType,ActionType type){
     Parameters=
         parameters.Split(new[]{','},StringSplitOptions.RemoveEmptyEntries).ToList().Select(Parse).ToArray();
     TargetParam=targetparam;
     TargetType=targetType;
     Type=type;
 }
Example #11
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.TurnAwayFromBell && type != ActionType.HitBell)
     return type == ActionType.TurnToBell;
   else
     return true;
 }
 public AddEditStock(DataTable product, DataTable stock)
 {
     InitializeComponent();
     productTable = product;
     stockTable = stock;
     currentAction = ActionType.Add;
 }
Example #13
0
        private static string GetDescription(KeyValuePair<Type, EntityType> current, ActionType type, object entity)
        {
            var builder = new StringBuilder();
            var firstFormat = string.Format("Сущность \"{0}\"",current.Value.GetEntityTypeName());
            const string idFormat = " с идентификатором \"{0}\"";
            const string nameFormat = " с названием \"{0}\"";
            var actionFormat = string.Format(" была {0}", type.GetActionTypeName());

            if (entity != null)
            {
                var idProp = entity.GetType().GetProperties().FirstOrDefault(c => c.Name.ToUpper().Contains("ID"));
                var nameProp = entity.GetType().GetProperties().FirstOrDefault(c => c.Name.ToUpper().Contains("NAME"));

                builder.Append(firstFormat);

                if (idProp != null)
                {
                    builder.Append(string.Format(idFormat, idProp.GetValue(entity)));
                }

                if (nameProp != null)
                {
                    builder.Append(string.Format(nameFormat, nameProp.GetValue(entity)));
                }

                builder.Append(actionFormat);
            }

            if (type == ActionType.Export || type == ActionType.Import)
            {
                builder.Append(type.GetActionTypeName());
            }

            return builder.ToString();
        }
Example #14
0
        public static void AddTransaction(DbContext context, ActionType type, object entity)
        {
            var currentData = entity.GetEnityType();
            var description = GetDescription(currentData, type, entity);

            int entityId = -1;
            var entityIdProp = entity == null ? null : entity.GetType().GetProperties().FirstOrDefault(c => c.Name.ToUpper().Contains("ID"));
            if (entityIdProp != null)
            {
                entityId = entityIdProp.GetValue(entity).MaybeAs<int>().GetOrDefault(-1);
                if (entityId == -1)
                {
                    var guid = entityIdProp.GetValue(entity).MaybeAs<Guid>().GetOrDefault(default(Guid));
                    entityId = guid == default(Guid) ? -1 : guid.GetHashCode();
                }
            }
            var tLog = new TransactionLog
            {
                ActionDateTime = DateTime.Now,
                ActionType = type,
                EntityType = currentData.Value,
                Description = description,
                EntityId = entityId
            };

            context.Set<TransactionLog>().Add(tLog);
        }
Example #15
0
        /// <summary>
        /// Creates new action exception.
        /// </summary>
        /// <param name="message">the message, as in ordinary exception</param>
        /// <param name="actionType">type of the action that caused the exception</param>
        /// <param name="innerException">exception that was catched to throw this one</param>
        public ActionException(string message, ActionType actionType, MemeType? memeType
				= MemeType.AreYouFuckingKiddingMe, Exception innerException = null)
            : base(SHOW_EXCEPTION_DETAILS ? GetExtendedMessage(message, innerException) :
				GetTypicalMessage(message, innerException), innerException)
        {
            SetInitialValues(message, actionType, memeType);
        }
Example #16
0
		public FeatureAction (XPathNavigator nav)
		{
			string val = Helpers.GetRequiredNonEmptyAttribute (nav, "type");
			type = Helpers.ConvertEnum <ActionType> (val, "type");

			val = Helpers.GetRequiredNonEmptyAttribute (nav, "when");
			when = Helpers.ConvertEnum <ActionWhen> (val, "when");

			XPathNodeIterator iter;
			StringBuilder sb = new StringBuilder ();
			
			switch (type) {
				case ActionType.Message:
				case ActionType.ShellScript:
					iter = nav.Select ("./text()");
					while (iter.MoveNext ())
						sb.Append (iter.Current.Value);
					if (type == ActionType.Message)
						message = sb.ToString ();
					else
						script = sb.ToString ();
					break;
					
				case ActionType.Exec:
					command = Helpers.GetRequiredNonEmptyAttribute (nav, "command");
					commandArguments = Helpers.GetOptionalAttribute (nav, "commndArguments");
					break;
			}
		}
Example #17
0
        public void AddAction(string playerA, string playerB, ActionType actionType, ModifierType modifyer, Weapon weapon, WhereType where, ArmyType teamA, ArmyType teamB)
        {
            Player playerGet = getPlayer(playerA, teamA);
            Player playerDo = null;
            
            //damage from the world (harrier, falling) will not be considered in this version
            if (playerB == string.Empty)
            {
                playerDo = playerGet;
            } else
            {
                playerDo = getPlayer(playerB, teamB);
            }

            switch (actionType)
            {
                case ActionType.Kill:
                    playerGet.AddAction(playerDo, ActionType.Die, modifyer, weapon, where);
                    playerDo.AddAction(playerGet, ActionType.Kill, modifyer, weapon, where);
                    break;
                case ActionType.Damage:
                    playerGet.AddAction(playerDo, ActionType.Damage, modifyer, weapon, where);
                    playerDo.AddAction(playerGet, ActionType.Damage, modifyer, weapon, where);
                    break;
            }
        }
Example #18
0
 public GameState(Dictionary<int, Entity> entities, ActionType type)
 {
     AllEntities = entities;
     Type = type;
     Player1 = new Player(entities, 1);
     Player2 = new Player(entities, 2);
 }
        /// <summary>
        /// Gets a default behavior for a path segment
        /// </summary>
        /// <param name="location"></param>
        /// <param name="vehicleState"></param>
        /// <param name="exit"></param>
        /// <param name="relative"></param>
        /// <param name="stopSpeed"></param>
        /// <param name="aMax"></param>
        /// <param name="dt">timestep in seconds</param>
        /// <returns></returns>
        public static PathFollowingBehavior DefaultStayInLaneBehavior(RndfLocation location, VehicleState vehicleState, 
            RndfWaypointID action, ActionType actionType, bool relative, double stopSpeed, double aMax, double dt,
            double maxSpeed, IPath path)
        {
            // get lane path
            //IPath path = RoadToolkit.LanePath(location.Partition.FinalWaypoint.Lane, vehicleState, relative);

            // check if the action is just a goal (note that exit and stop take precedence)
            if (actionType == ActionType.Goal)
            {
                // get maximum speed
                //double maxSpeed = location.Partition.FinalWaypoint.Lane.Way.Segment.SpeedInformation.MaxSpeed;
                //double maxSpeed = maxV;

                // generate path following behavior
                //return new PathFollowingBehavior(path, new ScalarSpeedCommand(maxSpeed));
                return null;
            }
            else
            {
                // get maximum speed
                //double maxSpeed = location.Partition.FinalWaypoint.Lane.Way.Segment.SpeedInformation.MaxSpeed;

                // get operational required distance to hand over to operational stop
                double distance = RoadToolkit.DistanceUntilOperationalStop(RoadToolkit.DistanceToWaypoint(location, action)-TahoeParams.FL);

                // get desired velocity
                double desiredSpeed = RoadToolkit.InferFinalSpeed(0, stopSpeed, distance, maxSpeed, aMax, dt);

                // generate path following behavior
                //return new PathFollowingBehavior(path, new ScalarSpeedCommand(desiredSpeed));
                return null;
            }
        }
Example #20
0
 public PlayerAction(Player player, Point targetPoint, ActionType actionType)
 {
     AffectedPlayer = player;
     this.TargetPoint = targetPoint;
     WayToTarget = new Queue<Point>();
     Type = actionType;
 }
Example #21
0
 public ActionContainer(ActionType actionType, string text, ISlot sourceSlot, ISlot targetSlot)
 {
     ActionType = actionType;
     Text = text;
     SourceSlot = sourceSlot;
     TargetSlot = targetSlot;
 }
Example #22
0
        public override ActionFeedback[] PerformAction(ActionType actionType, Actor actor, object[] args)
        {
            if (actionType == ActionType.CONSUME)
            {
                if (Effects.HasFlag(ConsumableEffect.FEED))
                {
                    //Eat
                    int newFeedingLevel = (int) actor.FeedingLevel + this.EffectPower;

                    actor.FeedingLevel = (FeedingLevel) ( (newFeedingLevel > 5) ? 5 : newFeedingLevel);
                }
                //How many have we got?
                if (this.TotalAmount > 1)
                {
                    this.TotalAmount--; //reduce by one
                }
                else
                {
                    //remove from inventory
                    actor.Inventory.Inventory.Remove(this.Category, this);
                }

                return new ActionFeedback[] { new LogFeedback(null, Color.Blue, "You consume the " + this.Name) };
            }
            else
            {
                return base.PerformAction(actionType, actor, args);
            }
        }
 public ActionInformation(Func<Tile, ActionAnimationScript> script, TileSelector abilityRange, Func<Tile, TileSelector> abilityAreaOfEffect, ActionType actionType)
 {
     Script = script;
     AbilityRange = abilityRange;
     AbilityAreaOfEffect = abilityAreaOfEffect;
     ActionType = actionType;
 }
Example #24
0
        private static void AppendDescriptionUsingContext(DbContext context, StringBuilder builder, EntityType type, ActionType aType, object entity)
        {
            string additionalInfo = string.Empty;
            string identity = string.Empty;
            var enrty = context.Entry(entity);

            var prop =
                enrty.Entity.GetType()
                    .GetProperties()
                    .FirstOrDefault(c => c.GetCustomAttributes(typeof(KeyAttribute), true).FirstOrDefault() != null);
            var name = enrty.Entity.GetType().GetProperties().FirstOrDefault(c => c.Name.Contains("Name"));

            identity = CreateIdentityString(entity, prop, identity, name);

            if (aType == ActionType.Updating)
            {
                additionalInfo = string.Format("Были изменены следующие поля: {0}",
                    string.Join(",", enrty.CurrentValues.PropertyNames));
            }

            if (aType != ActionType.Import || aType != ActionType.Export)
            {
                builder.Append(string.Format("Сущность \"{0}\" {1} была {2}.{3}", type.GetEntityTypeName(), identity,
                    aType.GetActionTypeName(), additionalInfo));
            }
        }
Example #25
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.ToCornerFront)
     return type == ActionType.ToCornerBack;
   else
     return true;
 }
Example #26
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.ExitDoor && type != ActionType.ExitDoorCarry)
     return type == ActionType.ExitDoorCarryHeavy;
   else
     return true;
 }
Example #27
0
 private static void GetRedirectActionTokenAndValue(ActionType action, out string token, out string value)
 {
     switch (action)
     {
         case ActionType.CheckFor301:
             token = "do301";
             value = "check";
             break;
         case ActionType.Redirect301:
             token = "do301";
             value = "true";
             break;
         case ActionType.Output404:
             token = "do404";
             value = "true";
             break;
         case ActionType.Redirect302:
             token = "do302";
             value = "true";
             break;
         default:
             token = "";
             value = "";
             break;
     }
 }
Example #28
0
 protected override bool IsActionAllowed(ActionType type)
 {
   if (type != ActionType.IdleToClimb && type != ActionType.JumpToClimb && (type != ActionType.IdleToFrontClimb && type != ActionType.IdleToSideClimb))
     return type == ActionType.JumpToSideClimb;
   else
     return true;
 }
Example #29
0
 public Action(ActionItem item, ActionType type, TimeSpan duration)
 {
     Id = Guid.NewGuid();
     Item = item;
     Duration = duration;
     Type = type;
 }
        /// <summary>
        /// Classifies files in <paramref name="sourceDirectory"/> in <paramref name="targetDirectory"/> grouped in
        /// sub directories by <paramref name="classificationOrder"/>.
        /// </summary>
        /// <returns>Task that represents the classification job.</returns>
        /// <param name="sourceDirectory">Source directory.</param>
        /// <param name="targetDirectory">Target directory.</param>
        /// <param name="recursive">
        /// If <c>true</c> classify recursively in all sub directories of <paramref name="sourceDirectory"/>; 
        /// otherwise only on <paramref name="sourceDirectory"/>.</param>
        /// <param name="actionType">
        /// Specify action to classify media files. 
        /// 'Copy' will copy media file in hierarchized directory. 
        /// 'Move' will move the media file. 
        /// Link will create a link, this can be used to create multiple hierarchisations.
        /// </param>
        /// <param name="hierarchy">Hierarchy of classification.
        /// <example>>If <paramref name="classificationOrder"/> is [Year, Month, Country], then folders will be
        /// like '/1996/03/Urugway'.</example>
        /// </param>
        public async Task ClassifyAsync(string sourceDirectory, string targetDirectory, bool recursive, ActionType actionType, params ClassificationType[] hierarchy)
        {
            if (sourceDirectory == null)
                throw new ArgumentNullException("sourceDirectory");
            if (targetDirectory == null)
                throw new ArgumentNullException("targetDirectory");
            if (hierarchy == null || !hierarchy.Any())
                throw new ArgumentNullException("classificationOrder");
            if (!_directory.Exists(sourceDirectory))
                throw new DirectoryNotFoundException(string.Format("Source directory '{0}' doesn't exists.", sourceDirectory));

            Log.I("Launching classification.");

            if (!_directory.Exists(targetDirectory))
            {
                Log.T("Target directory doesn't exists, create it.");
                _directory.CreateDirectory(targetDirectory);
            }

            var classificationTasks = _fileSystemHelper.ProcessForEachFilesAsync(
                new[] { sourceDirectory }, 
                recursive, 
                FileFilterProvider.TagFileMatcher, 
				(f, cts) => ClassifiyFileAsync(targetDirectory, f, actionType, hierarchy));

			await Task.WhenAll(classificationTasks);
        }