/// <summary>
 ///     Adds a common task to the queue
 /// </summary>
 /// <param name="task"></param>
 internal static void Add(CommonTask task)
 {
     if (QueuedTasks.All(x => x != task))
     {
         QueuedTasks.Add(task);
     }
 }
        public ActionResult DeleteTask([FromQuery] CommonTask deleteTask)
        {
            if (!authUser.is_admin)
            {
                return(NotFound());
            }

            _repo.DeleteTask(deleteTask);
            return(Ok());
        }
        public ActionResult UpdateCompanyTasks(CommonTask commonTask)
        {
            if (!authUser.is_admin)
            {
                return(NotFound());
            }

            var l = new List <CommonTask>();

            l.Add(commonTask);
            _repo.AddTasksForAllClientCompany(l);
            return(Ok());
        }
        //[Authorization]
        public ActionResult AddCommonTask(CommonTask commonTask)
        {
            if (!authUser.is_admin)
            {
                return(NotFound());
            }

            if (commonTask == null)
            {
                return(NotFound());
            }
            _repo.AddCommonTask(commonTask);
            return(Ok());
        }
Exemple #5
0
        public void DeleteTask(CommonTask deleteCommonTask)
        {
            var commonTask = _context.CommonTasks.FirstOrDefault(x => x.Id == deleteCommonTask.Id);

            if (commonTask == null)
            {
                throw new Exception("Company not found");
            }

            var tasks = _context.Tasks.Where(x => x.CommonTaskId == commonTask.Id).ToList();

            _context.Tasks.RemoveRange(tasks); // delete tasks related to CommonTask
            _context.SaveChanges();

            _context.CommonTasks.Attach(commonTask); // delete this task
            _context.Remove(commonTask);

            _context.SaveChanges();
        }
Exemple #6
0
        public void AddCommonTask(CommonTask task)
        {
            if (string.IsNullOrEmpty(task.Name) || task.ActiveStartMonth <= 0 || task.ActiveEndMonth <= 0)
            {
                throw new Exception("აუცილებელია თასქის სახელი, დაწყების თვე და დასრულების თვე. მაგ. Name: თასქი1 ActiveStartMonth: 02 ActiveEndMonth: 02");
            }
            if (_context.CommonTasks.Count(x => x.Name == task.Name) > 0)
            {
                throw new Exception("ეს თასქი უკვე არსებობს.");
            }

            _context.CommonTasks.Add(task);
            _context.SaveChanges();

            var tasks = new List <CommonTask>();

            tasks.Add(task);
            AddTasksForAllClientCompany(tasks);
        }
Exemple #7
0
    void Update()
    {
        if (Input.GetKey(KeyCode.K) || Input.GetKey(KeyCode.LeftArrow))
        {
            CommonUIButtons.pulseBack();
            GameObject cobj = null;

            if ((index - 1) < 0)
            {
                index = Projector.objs.Count - 1;
                cobj  = Projector.objs[index];

                transform.position = cobj.transform.position;
                return;
            }

            --index;
            cobj = Projector.objs[index];

            transform.position = cobj.transform.position;
            return;
        }

        if (Input.GetKey(KeyCode.L) || Input.GetKey(KeyCode.RightArrow))
        {
            CommonUIButtons.pulseNext();
            GameObject cobj;

            if ((index + 1) > (Projector.objs.Count - 1))
            {
                index = 0;
                cobj  = Projector.objs[index];

                transform.position = cobj.transform.position;
                return;
            }

            ++index;
            cobj = Projector.objs[index];

            transform.position = cobj.transform.position;
            return;
        }

        if (Input.GetKey(KeyCode.H))
        {
            if (sfile)
            {
                return;
            }

            sfile  = true;
            freeze = true;

            Cursor.lockState = CursorLockMode.None;

            StartCoroutine(CommonTask.ExecuteAfterTime(0.1f, () => {
                Cursor.lockState = CursorLockMode.Confined;
                Cursor.visible   = true;
            }));

            StartCoroutine(CommonTask.ExecuteAfterTime(0.5f, () => {
                Cursor.lockState = CursorLockMode.Confined;
                string path      = EditorUtility.OpenFilePanel("Overwrite with data", "", "data");

                if (path.Length != 0)
                {
                    FileInfo file       = new FileInfo(path);
                    StreamReader reader = file.OpenText();
                    string text         = "";

                    while (text != null)
                    {
                        text = reader.ReadLine();
                        Projector.coords.Add(text);
                    }

                    Projector.createBees();
                    Projector.createGameObjects();
                }

                Cursor.lockState = CursorLockMode.None;

                StartCoroutine(CommonTask.ExecuteAfterTime(0.1f, () => {
                    Cursor.lockState = CursorLockMode.Locked;
                    Cursor.visible   = false;
                }));

                freeze = false;
            }));
        }
    }