コード例 #1
0
        public void EditTask(TaskViewModel TaskView)
        {
            TaskView.User         = null;
            TaskView.AssignedUser = null;
            TaskView.TaskStatus   = null;

            Model.Task OldTask = TaskRepository.GetByID(TaskView.ID);
            if (OldTask.File != null && TaskView.File == null)
            {
                TaskView.File = OldTask.File;
            }

            Model.Task Task = new Model.Task()
            {
                ID             = TaskView.ID,
                Description    = TaskView.Description,
                TaskStatusID   = TaskView.TaskStatusID,
                TaskStatus     = TaskView.TaskStatus,
                UserID         = TaskView.UserID,
                User           = TaskView.User,
                AssignedUserID = TaskView.AssignedUserID,
                AssignedUser   = TaskView.AssignedUser,
                File           = TaskView.File,
                Comments       = TaskView.Comments
            };

            TaskRepository.Edit(Task.ID, Task);
            SaveTask();
        }
コード例 #2
0
ファイル: AsanaClient.Task.cs プロジェクト: pocheptsov/nasana
            public Task CreateTask(Task task, params string[] whitelist)
            {
                Guard.NotNull("task", task);
                Guard.NotNull("task.Workspace", task.Workspace);

                return CreateTaskImpl(task, task.Workspace.Id, whitelist);
            }
コード例 #3
0
ファイル: Presenter.cs プロジェクト: dfrostpl/task_sheduler
 void t_controller_NeedToRun(object sender, EventArgs e)
 {
     Model.Task task = sender as Model.Task;
     task.Status = Model.TaskStatus.PROCESSING;
     _view.Invoke(new Action(delegate
     {
         _view.getTaskList().Items.Refresh();
     }));
     try
     {
         System.Diagnostics.Process.Start(task.ExecFile);
         task.Status = Model.TaskStatus.COMPLETED;
         _view.Invoke(new Action(delegate
         {
             _view.getCompletedTasks().Items.Add(task.ExecFile + "\t|\t" + task.Status);
             _view.getTaskList().Items.Refresh();
         }));
     }
     catch (Exception ex)
     {
         task.Status = Model.TaskStatus.FAILED;
         _view.Invoke(new Action(delegate
         {
             _view.ShowMessage(ex.Message);
             _view.getCompletedTasks().Items.Add(task.ExecFile + "\t|\t" + task.Status);
             _view.getTaskList().Items.Refresh();
         }));
     }
     finally
     {
         task.Status = Model.TaskStatus.WAITING;
         if (task.Period == Model.TaskPeriod.EVERYDAY)
         {
             task.Time = task.Time.AddDays(1);
         }
         else if (task.Period == Model.TaskPeriod.EVERYMONTH)
         {
             task.Time = task.Time.AddMonths(1);
         }
         else if (task.Period == Model.TaskPeriod.EVERYWEEK)
         {
             task.Time = task.Time.AddDays(7);
         }
         else if (task.Period == Model.TaskPeriod.ONCE)
         {
             _view.Invoke(new Action(delegate
             {
                 _view.getTaskList().Items.Remove(task);
             }));
             _model.Tasks.Remove(task);
         }
         _view.Invoke(new Action(delegate
         {
             _view.getTaskList().Items.Refresh();
         }));
     }
 }
コード例 #4
0
ファイル: Presenter.cs プロジェクト: dfrostpl/task_sheduler
        void _view_AddTaskEvent(object sender, EventArgs e)
        {
            Model.Task       task       = new Model.Task();
            IBrowser         browser    = new TaskBrowser();
            BrowserPresenter bPresenter = new BrowserPresenter(browser);

            bPresenter.Finished += bPresenter_Finished;
            bPresenter.ShowDialog(task);
        }
コード例 #5
0
ファイル: Task.cs プロジェクト: angad/ToDoOrNoToDo
 public Task(Task tsk)
 {
     this.id = tsk.getId();
     this.name = tsk.getName();
     this.description = tsk.getDesc();
     this.star = tsk.getStar();
     this.deadline = tsk.getDeadline();
     this.done = tsk.getDone();
 }
コード例 #6
0
 public Task CreateTask(Task task)
 {
     task.IsCompleted = false;
     _ctx.Tasks.Add(task);
     _ctx.SaveChanges();
     if (task.Id > 0)
     {
         return(task);
     }
     throw new Exception("Task can be insert");
 }
コード例 #7
0
        private void StartNewSolution(Task task)
        {
            IDialog dialog = SolutionNameDialog();
            string  name   = dialog.ShowNameDialog();

            if (name != null)
            {
                Solution newSolution = new Solution(name, Main.UserSession.Username, task);
                Dao.Factory.SolutionDao.AddSolution(newSolution);
                Content = new SolutionNavigation(newSolution, this);
            }
        }
コード例 #8
0
ファイル: Presenter.cs プロジェクト: dfrostpl/task_sheduler
        void _view_EditTaskEvent(object sender, EventArgs e)
        {
            if (_view.getTaskList().SelectedItem == null)
            {
                throw new Exception("Задание не выбрано");
            }
            Model.Task       task       = _view.getTaskList().SelectedItem as Model.Task;
            IBrowser         browser    = new TaskBrowser();
            BrowserPresenter bPresenter = new BrowserPresenter(browser);

            bPresenter.Finished += bPresenter_Finished;
            bPresenter.ShowDialog(task, true);
        }
コード例 #9
0
        public List <TaskViewModel> CloseTask(int ID)
        {
            Model.Task Task = TaskRepository.GetByID(ID);
            Task.User         = null;
            Task.AssignedUser = null;
            Task.TaskStatus   = null;
            Task.TaskStatusID = TaskStatusRepository.Get(x => x.Status == "Closed").FirstOrDefault().ID;
            TaskRepository.Edit(Task.ID, Task);
            SaveTask();

            List <TaskViewModel> AllTasks = GetTasks();

            return(AllTasks);
        }
コード例 #10
0
        public ViewModel()
        {
            TaskIsDone = new ActionCommand()
            {
                Action = () =>
                {
                    if (Index > -1 && Index < ToDo.Count && !Done.Contains<String>(ToDo.ElementAt(Index)))
                    {
                        Done.Add(ToDo.ElementAt(Index));
                        ToDo.RemoveAt(Index);
                    }
                }
            };

            NewTask = new ActionCommand()
            {
                Action = () =>
                {
                    if (TaskText != "" && TaskText != null && !ToDo.Contains<String>(TaskText))
                    {
                        Task t = new Task(Id, TaskText);
                        ToDo.Add(t.Content);
                        Id += 1;
                    }
                }
            };

            TaskIsToDo = new ActionCommand()
            {
                Action = () =>
                {
                    if (Index > -1 && Index < Done.Count && !ToDo.Contains<String>(Done.ElementAt(Index)))
                    {
                        ToDo.Add(Done.ElementAt(Index));
                        Done.RemoveAt(Index);
                    }
                }
            };

            _task = new List<string>();
            _done = new ObservableCollection<string>();
            _todo = new ObservableCollection<string>();

            Initialze();
        }
コード例 #11
0
 public void CreateTask(TaskViewModel TaskView, string UserId)
 {
     TaskView.UserID = UserId; //created by
     Model.Task Task = new Model.Task()
     {
         Description     = TaskView.Description,
         TaskStatusID    = TaskView.TaskStatusID,
         TaskStatus      = TaskView.TaskStatus,
         UserID          = TaskView.UserID,
         AssignedUserID  = TaskView.AssignedUserID,
         File            = TaskView.File,
         Comments        = TaskView.Comments,
         CreationDate    = DateTime.Now,
         LastUpdatedDate = DateTime.Now
     };
     TaskRepository.Add(Task);
     SaveTask();
 }
コード例 #12
0
        public void ValidateTask(Task task)
        {
            if (string.IsNullOrEmpty(task.Description))
            {
                throw new InvalidDataException("Task must have a description");
            }

            if (task.Description.Length < 5)
            {
                throw new InvalidDataException("Task description has to be at least 5 characters long");
            }
            // Id is an int and int is never null

            /*if (string.IsNullOrEmpty(task.AssigneeId.ToString()))
             * {
             *  throw new NullReferenceException("Task has to be assigned to someone");
             * }*/
        }
コード例 #13
0
        public TaskViewModel GetTaskByID(int ID)
        {
            Model.Task    Task          = TaskRepository.GetTaskDetails(ID);
            TaskViewModel TaskViewModel = new TaskViewModel()
            {
                ID             = Task.ID,
                Description    = Task.Description,
                TaskStatusID   = Task.TaskStatusID,
                TaskStatus     = Task.TaskStatus,
                UserID         = Task.UserID,
                User           = Task.User,
                AssignedUserID = Task.AssignedUserID,
                AssignedUser   = Task.AssignedUser,
                File           = Task.File,
                Comments       = Task.Comments
            };

            return(TaskViewModel);
        }
コード例 #14
0
ファイル: TaskManager.cs プロジェクト: angad/ToDoOrNoToDo
        public void add(string taskname, string deadline, bool star, string description, bool done)
        {
            // always backup before making change
            backup();

            // adding task
            maxTaskID++;
            Task newTask = new Task(maxTaskID, taskname, description, star, deadline, done);
            newTask.PropertyChanged += taskChange;
            newTask.BeforeChangeEvent += backup;

            TaskList.Add( newTask );

            // always add new task to view
            if (done == currentView)
            {
               ViewList.Add(newTask);
            }

            broadcastChange();
        }
コード例 #15
0
        /// <summary>
        /// Applies required configuration for enabling cache in SDK 1.8.0 version by:
        /// * Add MemcacheShim runtime installation.
        /// * Add startup task to install memcache shim on the client side.
        /// * Add default memcache internal endpoint.
        /// * Add cache diagnostic to local resources.
        /// * Add ClientDiagnosticLevel setting to service configuration.
        /// * Adjust web.config to enable auto discovery for the caching role.
        /// </summary>
        /// <param name="azureService">The azure service instance</param>
        /// <param name="webRole">The web role to enable caching on</param>
        /// <param name="isWebRole">Flag indicating if the provided role is web or not</param>
        /// <param name="cacheWorkerRole">The memcache worker role name</param>
        /// <param name="startup">The role startup</param>
        /// <param name="endpoints">The role endpoints</param>
        /// <param name="localResources">The role local resources</param>
        /// <param name="configurationSettings">The role configuration settings</param>
        private void Version180Configuration(
            AzureService azureService,
            string roleName,
            bool isWebRole,
            string cacheWorkerRole,
            Startup startup,
            Endpoints endpoints,
            LocalResources localResources,
            ref DefConfigurationSetting[] configurationSettings)
        {
            if (isWebRole)
            {
                // Generate cache scaffolding for web role
                azureService.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WebRole.ToString()),
                    roleName, new Dictionary<string, object>());

                // Adjust web.config to enable auto discovery for the caching role.
                string webCloudConfigPath = Path.Combine(azureService.Paths.RootPath, roleName, Resources.WebCloudConfig);
                string webConfigPath = Path.Combine(azureService.Paths.RootPath, roleName, Resources.WebConfigTemplateFileName);

                UpdateWebConfig(roleName, cacheWorkerRole, webCloudConfigPath);
                UpdateWebConfig(roleName, cacheWorkerRole, webConfigPath);
            }
            else
            {
                // Generate cache scaffolding for worker role
                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters[ScaffoldParams.RoleName] = cacheWorkerRole;

                azureService.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WorkerRole.ToString()),
                    roleName, parameters);
            }

            // Add startup task to install memcache shim on the client side.
            string cacheRuntimeUri = CloudRuntimeCollection.GetRuntimeUrl(Resources.CacheRuntimeValue, CacheRuntimeVersion);
            Debug.Assert(!string.IsNullOrEmpty(cacheRuntimeUri));
            Variable emulated = new Variable { name = Resources.EmulatedKey, RoleInstanceValue = new RoleInstanceValueElement { xpath = "/RoleEnvironment/Deployment/@emulated" } };
            Variable[] env = { emulated, new Variable { name = Resources.CacheRuntimeUrl, value = cacheRuntimeUri } };
            Task shimStartupTask = new Task { Environment = env, commandLine = Resources.CacheStartupCommand, executionContext = ExecutionContext.elevated };
            startup.Task = CloudServiceUtilities.ExtendArray<Task>(startup.Task, shimStartupTask);

            // Add default memcache internal endpoint.
            InternalEndpoint memcacheEndpoint = new InternalEndpoint
            {
                name = Resources.MemcacheEndpointName,
                protocol = InternalProtocol.tcp,
                port = Resources.MemcacheEndpointPort
            };
            endpoints.InternalEndpoint = CloudServiceUtilities.ExtendArray<InternalEndpoint>(endpoints.InternalEndpoint, memcacheEndpoint);

            // Enable cache diagnostic
            LocalStore localStore = new LocalStore
            {
                name = Resources.CacheDiagnosticStoreName,
                cleanOnRoleRecycle = false
            };
            localResources.LocalStorage = CloudServiceUtilities.ExtendArray<LocalStore>(localResources.LocalStorage, localStore);

            DefConfigurationSetting diagnosticLevel = new DefConfigurationSetting { name = Resources.CacheClientDiagnosticLevelAssemblyName };
            configurationSettings = CloudServiceUtilities.ExtendArray<DefConfigurationSetting>(configurationSettings, diagnosticLevel);

            // Add ClientDiagnosticLevel setting to service configuration.
            AddClientDiagnosticLevelToConfig(azureService.Components.GetCloudConfigRole(roleName));
            AddClientDiagnosticLevelToConfig(azureService.Components.GetLocalConfigRole(roleName));
        }
コード例 #16
0
 public Task UpdateTask(Task task)
 {
     _ctx.Entry(task).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     _ctx.SaveChanges();
     return(task);
 }
コード例 #17
0
 public void DeleteTask(int ID)
 {
     Model.Task Task = TaskRepository.GetByID(ID);
     TaskRepository.Delete(Task);
     SaveTask();
 }
コード例 #18
0
        /// <summary>   Calls DoAction with the task.Type parameter </summary>
        ///
        /// <remarks>   , 13/11/2017. </remarks>
        ///
        /// <param name="header">       The header. </param>
        /// <param name="connection">   The connection. </param>
        /// <param name="task">         The task. </param>

        public void ReceiveAction(PacketHeader header, Connection connection, Model.Task task)
        {
            //Console.WriteLine("Receive action type :"+task.Type);
            Client.Player.TaskState.Type = task.Type;
            DoActions(task.Type);
        }
コード例 #19
0
ファイル: API.cs プロジェクト: angad/ToDoOrNoToDo
 internal void displayDesc(Task t)
 {
     sendUpdateStatus(t.getDesc());
 }