private void GenerateContainer(Task task, TaskStatusType status)
 {
     Panel pnlContainer = new Panel();
     pnlContainer.ID = task.ID.ToString();
     pnlContainer.CssClass = "task-container";
     Panel pnlTime = new Panel();
     pnlTime.CssClass = "time";
     Label lblTime = new Label();
     lblTime.ID = pnlContainer.ID + "time";
     lblTime.Text = task.EndDate.ToString("dd-MMMM-yy");
     pnlTime.Controls.Add(lblTime);
     pnlContainer.Controls.Add(pnlTime);
     Panel pnlTaskInfo = new Panel();
     pnlTaskInfo.CssClass = "task-info";
     Panel pnlTaskHeading = new Panel();
     pnlTaskHeading.CssClass = "task-heading";
     Label lblTaskHeading = new Label();
     lblTaskHeading.ID = pnlContainer.ID + "task-heading";
     lblTaskHeading.Text = task.Name;
     pnlTaskHeading.Controls.Add(lblTaskHeading);
     pnlTaskInfo.Controls.Add(pnlTaskHeading);
     pnlTaskInfo.Controls.Add(new LiteralControl("<br/>"));
     Label lblTaskDescription = new Label();
     lblTaskDescription.Text = task.Description;
     lblTaskDescription.ID = pnlContainer.ID + "task-description";
     pnlTaskInfo.Controls.Add(lblTaskDescription);
     pnlTaskInfo.Controls.Add(new LiteralControl("<br/>"));
     pnlTaskInfo.Controls.Add(new LiteralControl("<br/>"));
     Label lblTaskStatus = new Label();
     lblTaskStatus.Text = "<b>Status: " + status + "</b>";
     pnlTaskInfo.Controls.Add(lblTaskStatus);
     pnlContainer.Controls.Add(pnlTaskInfo);
     Label lblAssignedDate = new Label();
     lblAssignedDate.CssClass = "assigned-date";
     lblAssignedDate.Text = "Assigned On: " + task.StartDate.ToString("dd-MMMM-yy");
     pnlContainer.Controls.Add(lblAssignedDate);
     left.Controls.Add(pnlContainer);
 }
Esempio n. 2
0
        public static string ParceActivityStatus(TaskStatusType status)
        {
            switch (status)
            {
            case TaskStatusType.NotStarted:
                return(ActivityStatusListAttribute.Open);

            case TaskStatusType.Completed:
                return(ActivityStatusListAttribute.Completed);

            case TaskStatusType.InProgress:
                return(ActivityStatusListAttribute.InProcess);

            case TaskStatusType.Deferred:
                return(ActivityStatusListAttribute.Rejected);

            case TaskStatusType.WaitingOnOthers:
                return(ActivityStatusListAttribute.InProcess);

            default:
                return(ActivityStatusListAttribute.Draft);
            }
        }
 /// <summary>
 /// This method updates the status of a task.
 /// </summary>
 /// <param name="taskID">An integer parameter containing the ID of the task.</param>
 /// <param name="status">An object of Enum TaskStatusType containing the updated status.</param>
 /// <returns>It returns true if the status is successfully updated.</returns>
 public bool UpdateTaskStatus(int taskID,TaskStatusType status,int facultyID)
 {
     SqlParameter TaskID = new SqlParameter("taskID", taskID);
     SqlParameter TaskStatusID = new SqlParameter("taskStatusID", (int)status);
     SqlParameter FacultyID = new SqlParameter("facultyID", facultyID);
     List<SqlParameter> parameterCollection = new List<SqlParameter>() { TaskID, TaskStatusID, FacultyID };
     int rowsAffected = 0;
     using(DBDataHelper helper = new DBDataHelper())
     {
         rowsAffected = helper.GetRowsAffected("dbo.UpdateTaskStatus", SQLTextType.Stored_Proc, parameterCollection);
     }
     if (rowsAffected != 0)
         return true;
     else
         return false;
 }
        /// <summary>
        /// This method gets all the tasks assigned by a HOD alongwith all the faculties who have been assigned that task and their task status.
        /// </summary>
        /// <param name="hodID">An integer parameter containing the id of the HOD.</param>
        /// <returns>It returns a list of tasks given by a hod.</returns>
        public List<Task> GetAllTasksAssignedByAHOD(int hodID)
        {
            SqlParameter HodID = new SqlParameter("hodID", hodID);
            List<SqlParameter> parameterCollection = new List<SqlParameter> { HodID };
            DataTable table = new DataTable();
            List<Task> tasks = new List<Task>();
            using (DBDataHelper helper = new DBDataHelper())
            {
                table = helper.GetDataTable("dbo.GetAllTasksAssignedByAHOD", SQLTextType.Stored_Proc, parameterCollection);
            }
            foreach (DataRow row in table.Rows)
            {
                Task t = new Task
                {
                    ID = int.Parse(row["TaskID"].ToString()),
                    Name = row["Name"].ToString(),
                    Description = row["Description"].ToString(),
                    StartDate = DateTime.Parse(row["StartDate"].ToString()),
                    EndDate = DateTime.Parse(row["EndDate"].ToString()),
                    Priority = (PriorityType)(Enum.Parse(typeof(PriorityType), row["PriorityID"].ToString())),
                    Type = (TaskType)(Enum.Parse(typeof(TaskType), row["TaskTypeID"].ToString())),
                    ReminderTime = int.Parse(row["ReminderTime"].ToString())
                };
                t.AssignedTo = GetAllFacultiesHavingTheTask(t.ID);
                for (int i = 0; i < t.AssignedTo.Count; i++)
                {
                    TaskStatusType status = new TaskStatusType();
                    SqlParameter TaskID = new SqlParameter("taskID", t.ID);
                    SqlParameter FacultyID = new SqlParameter("facultyID", t.AssignedTo[i].ID);
                    List<SqlParameter> col = new List<SqlParameter> { TaskID, FacultyID };
                    using (DBDataHelper helper = new DBDataHelper())
                    {
                        status = (TaskStatusType)(Enum.Parse(typeof(TaskStatusType), helper.GetDataTable("dbo.GetTaskStatus", SQLTextType.Stored_Proc, col).Rows[0]["TaskStatusID"].ToString()));
                    }
                    Dictionary<Task, TaskStatusType> abc = new Dictionary<Task, TaskStatusType>();
                    abc.Add(t, status);
                    t.AssignedTo[i].Tasks = abc;
                }

                tasks.Add(t);
            }
            return tasks;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationRuleBase" /> class.
 /// </summary>
 /// <param name="endpointID">endpointID (required).</param>
 /// <param name="orgID">The ID of the organization that owns this notification rule. (required).</param>
 /// <param name="status">status (required).</param>
 /// <param name="name">Human-readable name describing the notification rule. (required).</param>
 /// <param name="sleepUntil">sleepUntil.</param>
 /// <param name="every">The notification repetition interval..</param>
 /// <param name="offset">Duration to delay after the schedule, before executing check..</param>
 /// <param name="runbookLink">runbookLink.</param>
 /// <param name="limitEvery">Don&#39;t notify me more than &lt;limit&gt; times every &lt;limitEvery&gt; seconds. If set, limit cannot be empty..</param>
 /// <param name="limit">Don&#39;t notify me more than &lt;limit&gt; times every &lt;limitEvery&gt; seconds. If set, limitEvery cannot be empty..</param>
 /// <param name="tagRules">List of tag rules the notification rule attempts to match. (required).</param>
 /// <param name="description">An optional description of the notification rule..</param>
 /// <param name="statusRules">List of status rules the notification rule attempts to match. (required).</param>
 /// <param name="labels">labels.</param>
 /// <param name="links">links.</param>
 public NotificationRuleBase(string endpointID = default(string), string orgID = default(string), TaskStatusType status = default(TaskStatusType), string name = default(string), string sleepUntil = default(string), string every = default(string), string offset = default(string), string runbookLink = default(string), int?limitEvery = default(int?), int?limit = default(int?), List <TagRule> tagRules = default(List <TagRule>), string description = default(string), List <StatusRule> statusRules = default(List <StatusRule>), List <Label> labels = default(List <Label>), NotificationRuleBaseLinks links = default(NotificationRuleBaseLinks)) : base()
 {
     // to ensure "endpointID" is required (not null)
     if (endpointID == null)
     {
         throw new InvalidDataException("endpointID is a required property for NotificationRuleBase and cannot be null");
     }
     else
     {
         this.EndpointID = endpointID;
     }
     // to ensure "orgID" is required (not null)
     if (orgID == null)
     {
         throw new InvalidDataException("orgID is a required property for NotificationRuleBase and cannot be null");
     }
     else
     {
         this.OrgID = orgID;
     }
     // to ensure "status" is required (not null)
     if (status == null)
     {
         throw new InvalidDataException("status is a required property for NotificationRuleBase and cannot be null");
     }
     else
     {
         this.Status = status;
     }
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for NotificationRuleBase and cannot be null");
     }
     else
     {
         this.Name = name;
     }
     // to ensure "tagRules" is required (not null)
     if (tagRules == null)
     {
         throw new InvalidDataException("tagRules is a required property for NotificationRuleBase and cannot be null");
     }
     else
     {
         this.TagRules = tagRules;
     }
     // to ensure "statusRules" is required (not null)
     if (statusRules == null)
     {
         throw new InvalidDataException("statusRules is a required property for NotificationRuleBase and cannot be null");
     }
     else
     {
         this.StatusRules = statusRules;
     }
     this.SleepUntil  = sleepUntil;
     this.Every       = every;
     this.Offset      = offset;
     this.RunbookLink = runbookLink;
     this.LimitEvery  = limitEvery;
     this.Limit       = limit;
     this.Description = description;
     this.Labels      = labels;
     this.Links       = links;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NotificationRule" /> class.
 /// </summary>
 public NotificationRule(string orgID = default(string), TaskStatusType status = default(TaskStatusType), string name = default(string), string sleepUntil = default(string), string every = default(string), string offset = default(string), string cron = default(string), string runbookLink = default(string), int?limitEvery = default(int?), int?limit = default(int?), List <TagRule> tagRules = default(List <TagRule>), string description = default(string), List <StatusRule> statusRules = default(List <StatusRule>), List <Label> labels = default(List <Label>)) : base(orgID, status, name, sleepUntil, every, offset, cron, runbookLink, limitEvery, limit, tagRules, description, statusRules, labels)
 {
 }
        /// <summary>
        /// Define the task item via setting taskStatus value.
        /// </summary>
        /// <param name="subject">The subject of the task.</param>
        /// <param name="taskStatus">Status element value of the task.</param>
        /// <returns>The task object.</returns>
        public static TaskType DefineTaskItem(string subject, TaskStatusType taskStatus)
        {
            TaskType taskNew = DefineTaskItem(subject, null);

            if (taskStatus == TaskStatusType.Completed)
            {
                taskNew.CompleteDate = DateTime.UtcNow.Date;
                taskNew.CompleteDateSpecified = true;
            }

            taskNew.Status = taskStatus;
            taskNew.StatusSpecified = true;
            return taskNew;
        }
 public bool UpdateTaskStatus(int taskID, TaskStatusType status, int facultyID)
 {
     return repository.UpdateTaskStatus(taskID, status, facultyID);
 }
Esempio n. 9
0
 internal void SetStatus(TaskStatusType type, string text)
 {
     Status       = type;
     StatusString = text;
 }