/// <summary>
        /// The Page_Load event handler on this User Control is used to
        /// obtain a DataReader of task information from the Tasks
        /// table, and then databind the results to a templated DataList
        /// server control.  It uses the Rainbow.TasksDB()
        /// data component to encapsulate all data functionality.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                sortField                  = Settings["TASKS_SORT_FIELD"].ToString();
                sortDirection              = "ASC";
                ViewState["SortField"]     = sortField;
                ViewState["SortDirection"] = sortDirection;
            }
            else
            {
                sortField     = (string)ViewState["SortField"];
                sortDirection = (string)ViewState["sortDirection"];
            }

            myDataView = new DataView();

            // Obtain task information from Tasks table
            // and bind to the DataGrid Control
            TasksDB tasks = new TasksDB();

            DataSet taskData = tasks.GetTasks(ModuleID);

            myDataView = taskData.Tables[0].DefaultView;

            if (!Page.IsPostBack)
            {
                myDataView.Sort = sortField + " " + sortDirection;
            }

            BindGrid();
        }
        /// <summary>
        /// The OnUpdate event handler on this Page is used to either
        /// create or update an task. It uses the Rainbow.TasksDB()
        /// data component to encapsulate all data functionality.
        /// Note: This procedure is automaticall called on Update
        /// </summary>
        /// <param name="e"></param>
        protected override void OnUpdate(EventArgs e)
        {
            // Calling base we check if the user has rights on updating
            base.OnUpdate(e);

            // Only Update if the Entered Data is Valid
            if (Page.IsValid == true)
            {
                // Create an instance of the Task DB component
                TasksDB tasks = new TasksDB();

                if (ItemID == 0)
                {
                    // Add the task within the Tasks table

                    //by Manu
                    //First get linked task modules
                    string[] linkedModules = moduleSettings["TASKS_LINKED_MODULES"].ToString().Split(';');

                    for (int i = 0; i < linkedModules.Length; i++)
                    {
                        int linkedModuleID = int.Parse(linkedModules[i]);

                        //If not module is null or current
                        if (linkedModuleID != 0 && linkedModuleID != ModuleID)
                        {
                            //Add to linked

                            //Get default assignee from module setting
                            Hashtable linkedModuleSettings = ModuleSettings.GetModuleSettings(linkedModuleID, this);
                            string    linkedModuleAssignee = linkedModuleSettings["TASKS_DEFAULT_ASSIGNEE"].ToString();

                            tasks.AddTask(linkedModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email,
                                          TitleField.Text, DateTime.Parse(StartField.Text), DesktopText.Text,
                                          StatusField.SelectedItem.Value, PriorityField.SelectedItem.Value,
                                          linkedModuleAssignee, DateTime.Parse(DueField.Text),
                                          Int16.Parse(PercentCompleteField.Text));
                        }
                    }

                    //Add to current
                    tasks.AddTask(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, TitleField.Text,
                                  DateTime.Parse(StartField.Text), DesktopText.Text, StatusField.SelectedItem.Value,
                                  PriorityField.SelectedItem.Value, AssignedField.Text, DateTime.Parse(DueField.Text),
                                  Int16.Parse(PercentCompleteField.Text));
                }
                else
                {
                    // Update the task within the Tasks table
                    tasks.UpdateTask(ModuleID, ItemID, PortalSettings.CurrentUser.Identity.Email, TitleField.Text,
                                     DateTime.Parse(StartField.Text), DesktopText.Text, StatusField.SelectedItem.Value,
                                     PriorityField.SelectedItem.Value, AssignedField.Text, DateTime.Parse(DueField.Text),
                                     Int16.Parse(PercentCompleteField.Text));
                }

                // Redirect back to the portal home page
                RedirectBackToReferringPage();
            }
        }
예제 #3
0
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// and ItemID of the task to display.
        /// It then uses the Rainbow.TasksDB() data component
        /// to populate the page's edit controls with the task details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Verify that the current user has access to edit this module
            if (PortalSecurity.HasEditPermissions(ModuleID))
            {
                EditLink  = "<a href= \"TasksEdit.aspx?ItemID=" + ItemID;
                EditLink += "&mID=" + ModuleID + "\" class=\"Normal\">Edit</a>";
            }

            if (Page.IsPostBack == false)
            {
                //Chris Farrell, [email protected], 5/28/04.
                //Improper Identity seed in the ItemID means that there may be tasks
                //with a ItemID = 0.  This is not the way it should be, but there is no
                //reason to NOT show the task with ItemID = 0 and that helps reduce
                //the pains from this bug for users who already have data present.

                // Obtain a single row of Task information
                TasksDB       Tasks = new TasksDB();
                SqlDataReader dr    = Tasks.GetSingleTask(ItemID);

                try
                {
                    // Read first row from database
                    if (dr.Read())
                    {
                        TitleField.Text           = (string)dr["Title"];
                        longdesc.Text             = (string)dr["Description"];
                        StartField.Text           = ((DateTime)dr["StartDate"]).ToShortDateString();
                        DueField.Text             = ((DateTime)dr["DueDate"]).ToShortDateString();
                        CreatedBy.Text            = (string)dr["CreatedByUser"];
                        ModifiedBy.Text           = (string)dr["ModifiedByUser"];
                        PercentCompleteField.Text = ((Int32)dr["PercentComplete"]).ToString();
                        AssignedField.Text        = (string)dr["AssignedTo"];
                        CreatedDate.Text          = ((DateTime)dr["CreatedDate"]).ToString();
                        ModifiedDate.Text         = ((DateTime)dr["ModifiedDate"]).ToString();
                        StatusField.Text          =
                            General.GetString("TASK_STATE_" + (string)dr["Status"], (string)dr["Status"], StatusField);
                        PriorityField.Text =
                            General.GetString("TASK_PRIORITY_" + (string)dr["Priority"], (string)dr["Priority"],
                                              PriorityField);
                        // 15/7/2004 added localization by Mario Endara [email protected]
                        if (CreatedBy.Text == "unknown")
                        {
                            CreatedBy.Text = General.GetString("UNKNOWN", "unknown");
                        }
                        // 15/7/2004 added localization by Mario Endara [email protected]
                        if (ModifiedBy.Text == "unknown")
                        {
                            ModifiedBy.Text = General.GetString("UNKNOWN", "unknown");
                        }
                    }
                }
                finally
                {
                    dr.Close();
                }
            }
        }
예제 #4
0
        public TasksDB SetExisingtDocumentObj(TasksDB taskDBOriginal, TaskItem taskObjNew)
        {
            TasksDB task = new TasksDB();

            task.TaskName        = taskObjNew.TaskName;
            task.TaskDescription = taskObjNew.TaskDescription;
            task.Owner           = taskObjNew.Owner;
            task.IsComplete      = taskObjNew.IsComplete;
            task.Created_at      = taskDBOriginal.Created_at;
            task.Created_by      = taskDBOriginal.Created_by;
            task.Updated_at      = DateTime.Now;
            task.Updated_by      = taskObjNew.Owner;
            task.TaskId          = taskDBOriginal.TaskId;
            return(task);
        }
예제 #5
0
        public TasksDB SetNewTaskObj(TaskItem taskObj)
        {
            TasksDB task = new TasksDB();

            task.TaskName        = taskObj.TaskName;
            task.TaskDescription = taskObj.TaskDescription;
            task.Owner           = taskObj.Owner;
            task.IsComplete      = taskObj.IsComplete;
            task.Created_at      = DateTime.Now;
            task.Created_by      = taskObj.Owner;
            task.Updated_at      = DateTime.Now;
            task.Updated_by      = taskObj.Owner;
            task.TaskId          = Guid.NewGuid();
            return(task);
        }
        /// <summary>
        /// The OnDelete event handler on this Page is used to delete
        /// an task. It uses the Rainbow.TasksDB() data component to
        /// encapsulate all data functionality.
        /// Note:This procedure is automaticall called on Update
        /// </summary>
        /// <param name="e"></param>
        protected override void OnDelete(EventArgs e)
        {
            // Calling base we check if the user has rights on deleting
            base.OnUpdate(e);

            // Only attempt to delete the item if it is an existing item
            // (new items will have "ItemID" of 0)

            if (ItemID != 0)
            {
                TasksDB tasks = new TasksDB();
                tasks.DeleteTask(ItemID);
            }

            // Redirect back to the portal home page
            RedirectBackToReferringPage();
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name = "task" ></ param >
        /// < returns ></ returns >
        public Task <IActionResult> GetTasksResponse(TasksDB task)
        {
            //Adding this code to handle Empty Document
            if (task == null)
            {
                return(Task.FromResult <IActionResult>(new NotFoundResult()));
            }

            return(Task.FromResult <IActionResult>(new ObjectResult(new TaskResponse()
            {
                TaskId = task.TaskId,
                TaskName = task.TaskName,
                TaskDescription = task.TaskDescription,
                IsComplete = task.IsComplete,
                Create_At = task.Created_at,
                Owner = task.Owner
            })));
        }
예제 #8
0
    public void SpawnLabs()
    {
        labBlocks.Clear();
        toggleButtonOne = LabBlockContent.GetComponent <ToggleButtonOne>();
        toggleButtonOne.freeList();
        foreach (Transform child in LabBlockContent.transform)
        {
            Destroy(child.gameObject);
        }
        var tasksDB = new TasksDB();
        var reader  = tasksDB.getAllTasks();
        var i       = 0;

        while (reader.Read())
        {
            SpawnLab(i, Convert.ToInt32(reader[0]), reader[1].ToString(), reader[2].ToString(), reader[3].ToString());
            i++;
        }
        tasksDB.close();
    }
        /// <summary>
        /// The Page_Load event on this Page is used to obtain the ModuleID
        /// and ItemID of the task to edit.
        /// It then uses the Rainbow.TasksDB() data component
        /// to populate the page's edit controls with the task details.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, EventArgs e)
        {
            // If the page is being requested the first time, determine if an
            // task itemID value is specified, and if so populate page
            // contents with the task details

            //Chris Farrell, [email protected], 5/28/04
            //Added support for Rainbow WYSIWYG editors.
            //Editor placeholder setup
            HtmlEditorDataType h = new HtmlEditorDataType();

            h.Value     = moduleSettings["Editor"].ToString();
            DesktopText =
                h.GetEditor(DescriptionField, ModuleID, bool.Parse(moduleSettings["ShowUpload"].ToString()),
                            portalSettings);

            DesktopText.Width  = new Unit(moduleSettings["Width"].ToString());
            DesktopText.Height = new Unit(moduleSettings["Height"].ToString());
            //end Chris Farrell changes, 5/28/04


            //Set right popup url
            StartField.xPopupURL = Path.ApplicationRoot + "/DesktopModules/DateTextBox/popupcalendar.aspx";
            StartField.xImageURL = Path.ApplicationRoot + "/DesktopModules/DateTextBox/calendar.jpg";
            DueField.xPopupURL   = Path.ApplicationRoot + "/DesktopModules/DateTextBox/popupcalendar.aspx";
            DueField.xImageURL   = Path.ApplicationRoot + "/DesktopModules/DateTextBox/calendar.jpg";

            if (Page.IsPostBack == false)
            {
                StartField.Text = DateTime.Now.ToShortDateString();
                DueField.Text   = DateTime.Now.ToShortDateString();
                AddListItem("TASK_STATE_0", "Not Started", StatusField);
                AddListItem("TASK_STATE_1", "In Progress", StatusField);
                AddListItem("TASK_STATE_2", "Complete", StatusField);
                StatusField.SelectedIndex = 0;
                AddListItem("TASK_PRIORITY_0", "High", PriorityField);
                AddListItem("TASK_PRIORITY_1", "Normal", PriorityField);
                AddListItem("TASK_PRIORITY_2", "Low", PriorityField);

                PriorityField.SelectedIndex = 1;
                if (ItemID != 0)
                {
                    // Obtain a single row of Task information
                    TasksDB       Tasks = new TasksDB();
                    SqlDataReader dr    = Tasks.GetSingleTask(ItemID);

                    try
                    {
                        // Read first row from database
                        if (dr.Read())
                        {
                            TitleField.Text             = (string)dr["Title"];
                            StartField.Text             = ((DateTime)dr["StartDate"]).ToShortDateString();
                            DueField.Text               = ((DateTime)dr["DueDate"]).ToShortDateString();
                            CreatedBy.Text              = (string)dr["CreatedByUser"];
                            ModifiedBy.Text             = (string)dr["ModifiedByUser"];
                            PercentCompleteField.Text   = ((Int32)dr["PercentComplete"]).ToString();
                            AssignedField.Text          = (string)dr["AssignedTo"];
                            CreatedDate.Text            = ((DateTime)dr["CreatedDate"]).ToString();
                            ModifiedDate.Text           = ((DateTime)dr["ModifiedDate"]).ToString();
                            StatusField.SelectedIndex   = Convert.ToInt16((string)dr["Status"]);
                            PriorityField.SelectedIndex = Convert.ToInt16((string)dr["Priority"]);
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (CreatedBy.Text == "unknown")
                            {
                                CreatedBy.Text = General.GetString("UNKNOWN", "unknown");
                            }
                            // 15/7/2004 added localization by Mario Endara [email protected]
                            if (ModifiedBy.Text == "unknown")
                            {
                                ModifiedBy.Text = General.GetString("UNKNOWN", "unknown");
                            }

                            //Chris Farrell, [email protected], 5/28/04
                            //DescriptionField.Text = (string) dr["Description"];
                            DesktopText.Text = (string)dr["Description"];
                        }
                    }
                    finally
                    {
                        dr.Close();
                    }
                }
                else //default for new
                {
                    AssignedField.Text = moduleSettings["TASKS_DEFAULT_ASSIGNEE"].ToString();
                }
            }
        }