Пример #1
0
        public Common.Task getTask(int taskId)
        {
            SqlDataReader reader = null;

            Common.Task task = null;
            using (SqlCommand c = new SqlCommand(SELECT_TASK_BY_ID, connection))
            {
                c.Parameters.AddWithValue("task", taskId);
                reader = c.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        int    id          = reader.GetInt32(0);
                        int    taskGroupId = reader.GetInt32(1);
                        String name        = reader.GetString(2);
                        int    gradeType   = reader.GetInt32(3);
                        int    weight      = reader.GetInt32(4);
                        task = new Common.Task(id, taskGroupId, name, gradeType, weight);
                    }
                }
            }
            reader.Close();
            return(task);
        }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String updateInfo = "Latest changes -br--br-";

        client = new Client.ServerServicesClient();
        foreach (String values in Request.Form.Keys)
        {
            List <String> names = values.Split(',').ToList <String>();
            if (names != null)
            {
                String course       = names.ElementAt(0).Trim();
                String courseuserid = names.ElementAt(2).Trim();
                System.Diagnostics.Debug.WriteLine(course + " userid: " + courseuserid);
                client.UpdateReported(Convert.ToInt32(course), Convert.ToInt32(courseuserid));
                Common.Task courseName = client.getTask(Convert.ToInt32(course));
                Common.User firstName  = client.GetUserFromId(Convert.ToInt32(courseuserid));
                String      cn         = courseName.Name;
                String      fn         = firstName.Firstname;
                String      ln         = firstName.Lastname;
                updateInfo += "Approved " + courseName.Name + " for " + fn + " " + ln + "-br-";
            }
        }
        Response.Redirect("MainLadok.aspx?latest=" + updateInfo, true);
    }
        /// <summary>
        /// Return the value for the specified setting, if it exists in the given runtime environment
        /// </summary>
        /// <param name="environment">The runtime environment to search</param>
        /// <param name="key">The name of the setting</param>
        /// <param name="value">The value of the setting, if it is found, null otherwise</param>
        /// <returns>true if the setting is found in the given environment</returns>
        private static bool TryGetEnvironmentValue(Task[] tasks, string key, out string value)
        {
            value = string.Empty;

            foreach (Task task in tasks)
            {
                Variable[] environment = task.Environment;
                value = null;
                if (environment != null)
                {
                    foreach (Variable setting in environment)
                    {
                        if (string.Equals(setting.name, key, StringComparison.OrdinalIgnoreCase))
                        {
                            value = setting.value;
                            return true;
                        }
                    }
                }
            }

            return false;
        }
Пример #4
0
        /// <summary>
        /// Adds new startup task to the given role.
        /// </summary>
        /// <param name="roleName">The role name</param>
        /// <param name="commandLine">The startup task command line</param>
        /// <param name="context">The execution context</param>
        /// <param name="variables">The environment variables</param>
        public void AddStartupTask(
            string roleName,
            string commandLine,
            ExecutionContext context,
            params Variable[] variables)
        {
            Startup roleStartup = GetRoleStartup(roleName) ?? new Startup();
            Task newTask = new Task
            {
                Environment = variables,
                commandLine = commandLine,
                executionContext = context
            };

            roleStartup.Task = General.ExtendArray<Task>(roleStartup.Task, newTask);
        }
Пример #5
0
 public Common.Task getTask(int taskId)
 {
     SqlDataReader reader = null;
     Common.Task task = null;
     using (SqlCommand c = new SqlCommand(SELECT_TASK_BY_ID, connection))
     {
         c.Parameters.AddWithValue("task", taskId);
         reader = c.ExecuteReader();
         if (reader.HasRows)
         {
             while (reader.Read())
             {
                 int id = reader.GetInt32(0);
                 int taskGroupId = reader.GetInt32(1);
                 String name = reader.GetString(2);
                 int gradeType = reader.GetInt32(3);
                 int weight = reader.GetInt32(4);
                 task = new Common.Task(id, taskGroupId, name, gradeType, weight);
             }
         }
     }
     reader.Close();
     return task;
 }
Пример #6
0
        private void GroupJoinTasksProjects()
        {
            var p1 = new Project()
            {
                Name = "p1"
            };

            var p2 = new Project()
            {
                Name = "p2"
            };

            var t1 = new Task()
            {
                Parent = p1,
                Name = "P1.T1"
            };

            var t2 = new Task()
            {
                Parent = p1,
                Name = "P1.T2"
            };

            var t3 = new Task()
            {
                Parent = p2,
                Name = "P2.T1"
            };

            listingGroupJoin(new List<Task> { t1, t2, t3 }, new List<Project> { p1, p2 });
        }