示例#1
0
        public void WorkingStopwatch(WorkingType workingType, User user)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Press ENTER to stop.");
            string stop = Console.ReadLine();

            if (stop == "")
            {
                stopwatch.Stop();
                TimeSpan time          = stopwatch.Elapsed;
                double   convertedTime = Convert.ToDouble(time.TotalSeconds);
                if (workingType == WorkingType.Home)
                {
                    user.Home += convertedTime / 60;
                }
                if (workingType == WorkingType.Office)
                {
                    user.Office += convertedTime / 60;
                }
                user.TimeWorking += convertedTime / 60;
                Console.WriteLine($"Time spent on this activity [{Title}] (For total time go to statistics in the main menu): {Math.Round(convertedTime / 60, 2)} minutes.");
                Console.WriteLine("Press any key to go back to the Main Menu.");
                Console.ReadKey();
            }
        }
        public async Task <IHttpActionResult> PutWorkingType(int id, WorkingType workingType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
 public Job(string jobTitle, string jobDescription, WorkingType jobType, string companyID)
 {
     JobTitle       = jobTitle;
     DatePosted     = DateTime.Now;
     JobDescription = jobDescription;
     JobType        = jobType;
     CompanyID      = companyID;
 }
        public async Task <IHttpActionResult> GetWorkingType(int id)
        {
            WorkingType workingType = await db.WorkingTypes.FindAsync(id);

            if (workingType == null)
            {
                return(NotFound());
            }

            return(Ok(workingType));
        }
        public async Task <IHttpActionResult> PostWorkingType(WorkingType workingType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.WorkingTypes.Add(workingType);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = workingType.id }, workingType));
        }
示例#6
0
 public override Entity SetEntityData(dynamic jsonobj)
 {
     if (jsonobj.IsDefined("WorkingType"))
     {
         _worktype = (WorkingType)jsonobj.WorkingType;
     }
     base.SetEntityData((object)jsonobj);
     if (_worktype == WorkingType.FromBlock)
     {
         AnimeSpeed = 3;
     }
     return(this);
 }
        public async Task <IHttpActionResult> DeleteWorkingType(int id)
        {
            WorkingType workingType = await db.WorkingTypes.FindAsync(id);

            if (workingType == null)
            {
                return(NotFound());
            }

            db.WorkingTypes.Remove(workingType);
            await db.SaveChangesAsync();

            return(Ok(workingType));
        }
示例#8
0
        public WorkingTypeModel Post(WorkingTypeModel model)
        {
            var workingType = new WorkingType
            {
                Name        = model.Name,
                IsHoliday   = model.IsHoliday,
                IsFlexitime = model.IsFlexitime
            };

            _workingTypeRepository.Save(workingType);
            SaveChanges();

            model.Id = workingType.Id;

            return(model);
        }
示例#9
0
    private void WorkingTypeChanged()
    {
        string text         = "When changing the working type, any other hallway or chunk objects have to be removed from the scene first.\nRemove instances?";
        bool   dialogResult = EditorUtility.DisplayDialog("Working type changed", text, "Yes", "Cancel");

        if (dialogResult)
        {
            DestroyMultiple(SceneInstances);
            DestroyMultiple(SceneObjects);
            OriginalObject = null;
        }
        else
        {
            workingType = prevType;
        }
    }
示例#10
0
		public override Entity SetEntityData(dynamic jsonobj)
		{
			if (jsonobj.IsDefined("WorkingType"))
				_worktype = (WorkingType) jsonobj.WorkingType;
			base.SetEntityData((object) jsonobj);
			if (_worktype == WorkingType.FromBlock)
				AnimeSpeed = 3;
			return this;
		}
示例#11
0
 public static string NotificationTitle(WorkingType workingType, MarketOrderType marketOrderType, string symbol)
 => $"[{workingType.GetDescription()}] => {marketOrderType.GetDescription()} [{symbol}]";
示例#12
0
    // Use this for initialization
    void OnGUI()
    {
        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button("New", EditorStyles.miniButtonLeft))
        {
            CreateNewChunk();
        }

        GUI.enabled = OriginalObject != null;
        if (GUILayout.Button("Save", EditorStyles.miniButtonMid))
        {
            SaveChunk();
        }
        GUI.enabled = true;

        if (GUILayout.Button("Load", EditorStyles.miniButtonRight))
        {
            LoadChunk();
        }

        EditorGUILayout.EndHorizontal();

        prevType    = workingType;
        workingType = (WorkingType)EditorGUILayout.EnumPopup("Target", workingType);

        if (workingType != prevType)
        {
            WorkingTypeChanged();
        }

        if (OriginalObject == null)
        {
            EditorGUILayout.HelpBox("No " + WorkingTypeName + " found in the scene. " + WorkingTypeName + "s have to be tagged with " +
                                    DefaultTag + " and there should only be one instance at a time", MessageType.Warning);
        }

        string chunkName = OriginalObject == null ? "none" : OriginalObject.name;

        EditorGUILayout.LabelField(WorkingTypeName + " name", chunkName);
        EditorGUILayout.LabelField("Path", GlobalPaths.AbsoluteChunkPath);

        GUILayout.Space(20);

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        GUI.enabled = OriginalObject != null;

        if (GUILayout.Button("Preview " + WorkingTypeName, EditorStyles.miniButtonLeft))
        {
            InstantiateChunk(DateTime.Now.Millisecond);
        }

        if (GUILayout.Button("Restore", EditorStyles.miniButtonRight))
        {
            Restore();
        }
        EditorGUILayout.EndHorizontal();

        seed = EditorGUILayout.IntField("Seed", seed);
        EditorGUILayout.LabelField("Generation time", durationMillis.ToString() + " ms");

        //Update Scene when seed changes
        if (seed != prevSeed)
        {
            InstantiateChunk(seed);
        }
        GUI.enabled = true;
        prevSeed    = seed;
    }
示例#13
0
 void Awake()
 {
     Debug.Log("enable");
     workingType = TypeInScene;
     prevType    = workingType;
 }