/// <summary>
    /// Ensures displaying of task detail with dependence on querystring settings.
    /// </summary>
    protected void EnsureForceTask()
    {
        // Check whethe isn't postback
        if (!RequestHelper.IsPostBack())
        {
            // Try get task id from query string
            int taskId = QueryHelper.GetInteger("taskid", 0);
            if (taskId > 0)
            {
                // Try get task info and check whether is assigned to current project
                ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(taskId);
                if ((pti != null) && (pti.ProjectTaskProjectID == ProjectID))
                {
                    // Check whether current user can see required private task
                    if (pti.ProjectTaskIsPrivate)
                    {
                        // Keep current user
                        var cui = MembershipContext.AuthenticatedUser;
                        if (!IsAuthorizedPerProjectEdit() && (pti.ProjectTaskOwnerID != cui.UserID) && (pti.ProjectTaskAssignedToUserID != cui.UserID))
                        {
                            return;
                        }
                    }

                    EditTask(taskId);
                }
            }
        }
    }
示例#2
0
    /// <summary>
    /// Reminder button OK clicked.
    /// </summary>
    /// <param name="sender">Sender object</param>
    /// <param name="e">Event args</param>
    protected void btnReminderOK_onClick(object sender, EventArgs e)
    {
        string errorMessage = "";

        if (txtReminderText.Text.Length > 0)
        {
            ProjectTaskInfo taskInfo = ProjectTaskInfoProvider.GetProjectTaskInfo(this.ReminderTaskID);
            if (taskInfo != null)
            {
                if (taskInfo.ProjectTaskAssignedToUserID > 0)
                {
                    ProjectTaskInfoProvider.SendNotificationEmail(ProjectTaskEmailNotificationTypeEnum.TaskReminder, taskInfo, CMSContext.CurrentSiteName, txtReminderText.Text);
                    lblInfo.Text = GetString("pm.projecttask.remindersent");
                }
                else
                {
                    errorMessage = GetString("pm.projecttask.remindernoassignee");
                }
            }
        }
        else
        {
            errorMessage = GetString("pm.projecttask.remindermessageerror");
        }

        if (String.IsNullOrEmpty(errorMessage))
        {
            CloseAjaxWindow();
        }
        else
        {
            ShowReminderPopup();
            lblReminderError.Text = errorMessage;
        }
    }
示例#3
0
    /// <summary>
    /// Creates project task. Called when the "Create task" button is pressed.
    /// </summary>
    private bool CreateProjectTask()
    {
        ProjectInfo             project  = ProjectInfoProvider.GetProjectInfo("MyNewProject", SiteContext.CurrentSiteID, 0);
        ProjectTaskStatusInfo   status   = ProjectTaskStatusInfoProvider.GetProjectTaskStatusInfo("NotStarted");
        ProjectTaskPriorityInfo priority = ProjectTaskPriorityInfoProvider.GetProjectTaskPriorityInfo("Normal");

        if ((project != null) && (status != null) && (priority != null))
        {
            // Create new project task object
            ProjectTaskInfo newTask = new ProjectTaskInfo();

            int currentUserID = MembershipContext.AuthenticatedUser.UserID;

            // Set the properties
            newTask.ProjectTaskDisplayName      = "My new task";
            newTask.ProjectTaskCreatedByID      = currentUserID;
            newTask.ProjectTaskOwnerID          = currentUserID;
            newTask.ProjectTaskAssignedToUserID = currentUserID;
            newTask.ProjectTaskStatusID         = status.TaskStatusID;
            newTask.ProjectTaskPriorityID       = priority.TaskPriorityID;
            newTask.ProjectTaskProjectID        = project.ProjectID;

            // Save the project task
            ProjectTaskInfoProvider.SetProjectTaskInfo(newTask);

            return(true);
        }
        return(false);
    }
示例#4
0
    /// <summary>
    /// Checks whether current user can delete task.
    /// </summary>
    /// <param name="permissionType">Permission type</param>
    /// <param name="modulePermissionType">Module permission type</param>
    /// <param name="sender">Sender object</param>
    void ucTaskList_OnCheckPermissionsExtended(string permissionType, string modulePermissionType, CMSAdminControl sender)
    {
        int itemID = ucTaskEdit.ItemID;

        // If edit task ItemID is 0, try get from list
        if (itemID == 0)
        {
            itemID = ucTaskList.SelectedItemID;
        }

        // Get task info for currently deleted task
        ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(itemID);

        // Check permission only for existing tasks and tasks assigned to some project
        if ((pti != null) && (pti.ProjectTaskProjectID > 0))
        {
            // Check whether user is allowed to modify or delete task
            if (!ProjectInfoProvider.IsAuthorizedPerProject(pti.ProjectTaskProjectID, permissionType, CMSContext.CurrentUser))
            {
                lblError.Visible      = true;
                lblError.Text         = GetString("pm.project.permission");
                sender.StopProcessing = true;
            }
        }
    }
示例#5
0
    /// <summary>
    /// Gets and updates project task. Called when the "Get and update task" button is pressed.
    /// Expects the CreateProjectTask method to be run first.
    /// </summary>
    private bool GetAndUpdateProjectTask()
    {
        // Prepare the parameters
        string where = "ProjectTaskDisplayName LIKE N'My new task%'";
        string orderBy = "";
        int    topN    = 0;
        string columns = "";

        // Get the data
        DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(tasks))
        {
            // Get the project task
            ProjectTaskInfo updateTask = new ProjectTaskInfo(tasks.Tables[0].Rows[0]);
            if (updateTask != null)
            {
                // Update the properties
                updateTask.ProjectTaskDisplayName = updateTask.ProjectTaskDisplayName.ToLowerCSafe();

                // Save the changes
                ProjectTaskInfoProvider.SetProjectTaskInfo(updateTask);

                return(true);
            }
        }

        return(false);
    }
示例#6
0
    /// <summary>
    /// Gets and bulk updates project tasks. Called when the "Get and bulk update tasks" button is pressed.
    /// Expects the CreateProjectTask method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateProjectTasks()
    {
        // Prepare the parameters
        string where = "ProjectTaskDisplayName LIKE N'My new task%'";
        string orderBy = "";
        int    topN    = 0;
        string columns = "";

        // Get the data
        DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(tasks))
        {
            // Loop through the individual items
            foreach (DataRow taskDr in tasks.Tables[0].Rows)
            {
                // Create object from DataRow
                ProjectTaskInfo modifyTask = new ProjectTaskInfo(taskDr);

                // Update the properties
                modifyTask.ProjectTaskDisplayName = modifyTask.ProjectTaskDisplayName.ToUpper();

                // Save the changes
                ProjectTaskInfoProvider.SetProjectTaskInfo(modifyTask);
            }

            return(true);
        }

        return(false);
    }
示例#7
0
 /// <summary>
 /// Clears current form.
 /// </summary>
 public override void ClearForm()
 {
     mProjectTaskObj = null;
     txtProjectTaskDisplayName.Text          = String.Empty;
     txtProjectTaskHours.Text                = String.Empty;
     txtProjectTaskProgress.Text             = String.Empty;
     chkProjectTaskIsPrivate.Checked         = false;
     dtpProjectTaskDeadline.SelectedDateTime = DateTimeHelper.ZERO_TIME;
     selectorOwner.UniSelector.Value         = String.Empty;
     selectorAssignee.UniSelector.Value      = String.Empty;
     htmlTaskDescription.Value               = String.Empty;
     drpTaskStatus.SelectedIndex             = 0;
     LoadDefaultPriority();
     base.ClearForm();
 }
 /// <summary>
 /// Sets breacrumbs for edit.
 /// </summary>
 private void SetBreadcrumbs(int projectTaskID)
 {
     // If project task is defined display task specific breadcrumbs
     if (projectTaskID != 0)
     {
         // Load project name
         ProjectTaskInfo pi = ProjectTaskInfoProvider.GetProjectTaskInfo(projectTaskID);
         if (pi != null)
         {
             lblEditBack.Text = " <span class=\"TitleBreadCrumbSeparator\">&nbsp;</span>" + HTMLHelper.HTMLEncode(pi.ProjectTaskDisplayName);
         }
     }
     // Dsiplay new task breadcrumb
     else
     {
         lblEditBack.Text = " <span class=\"TitleBreadCrumbSeparator\">&nbsp;</span>" + GetString("pm.projecttask.new");
     }
 }
 /// <summary>
 /// Sets breadcrumbs for edit.
 /// </summary>
 private void SetBreadcrumbs(int projectTaskID)
 {
     // If project task is defined display task specific breadcrumbs
     if (projectTaskID != 0)
     {
         // Load project name
         ProjectTaskInfo pi = ProjectTaskInfoProvider.GetProjectTaskInfo(projectTaskID);
         if (pi != null)
         {
             ucBreadcrumbs.Items[1].Text = HTMLHelper.HTMLEncode(pi.ProjectTaskDisplayName);
         }
     }
     // Display new task breadcrumb
     else
     {
         ucBreadcrumbs.Items[1].Text = GetString("pm.projecttask.new");
     }
 }
示例#10
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if ((projectId > 0) &&
            (CurrentMaster.HeaderActions.Actions != null))
        {
            string          editUrl = CurrentMaster.HeaderActions.Actions[0, 3];
            string          query   = "?projectid=" + projectId;
            ProjectTaskInfo taskObj = editElem.ProjectTaskObj;

            if (taskObj != null)
            {
                query += "&assigneeid=" + taskObj.ProjectTaskAssignedToUserID
                         + "&ownerid=" + taskObj.ProjectTaskOwnerID;
            }

            CurrentMaster.HeaderActions.Actions[0, 3] = ResolveUrl(editUrl + query);
            CurrentMaster.HeaderActions.ReloadData();
        }
    }
        public IHttpActionResult GetTasksByProjectId([FromUri] long projectId)
        {
            ProjectTaskInfo result = new ProjectTaskInfo();

            using (var context = new KanbanDBModel())
            {
                var cmd = context.Database.Connection.CreateCommand();
                cmd.CommandText = "[dbo].[GetTasksByProjectId]";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("ProjectId", projectId));

                try
                {
                    context.Database.Connection.Open();
                    var reader = cmd.ExecuteReader();

                    var projectQuery = ((IObjectContextAdapter)context)
                                       .ObjectContext
                                       .Translate <Project>(reader);

                    result.Project = projectQuery.FirstOrDefault();

                    reader.NextResult();

                    var taskQuery = ((IObjectContextAdapter)context)
                                    .ObjectContext
                                    .Translate <TaskInfo>(reader);

                    result.Tasks = taskQuery.ToArray();

                    return(Ok(result));
                }catch (Exception ex)
                {
                    return(InternalServerError(ex));
                }
                finally
                {
                    context.Database.Connection.Close();
                }
            }
        }
    /// <summary>
    /// Checks modify permission on task edit.
    /// </summary>
    /// <param name="permissionType">Permission type</param>
    /// <param name="modulePermissionType">Module permission type</param>
    /// <param name="sender">Sender object</param>
    private void ucTaskEdit_OnCheckPermissionsExtended(string permissionType, string modulePermissionType, CMSAdminControl sender)
    {
        // Indicates whether user is owner or assignee
        bool isInvolved = false;

        // Check whether taks is in edit mode
        if (ucTaskEdit.ItemID > 0)
        {
            // Get task info
            ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(ucTaskEdit.ItemID);
            // Check whether task exists
            if (pti != null)
            {
                // Keep current user
                var cui = MembershipContext.AuthenticatedUser;
                // If user is assignee or owenr set flag
                if ((pti.ProjectTaskAssignedToUserID == cui.UserID) || (pti.ProjectTaskOwnerID == cui.UserID))
                {
                    isInvolved = true;
                }
            }
        }


        // Check whether user is allowed to modify task
        if (!isInvolved && !ProjectInfoProvider.IsAuthorizedPerProject(ProjectID, permissionType, MembershipContext.AuthenticatedUser) && !IsAuthorizedPerProjectAccess())
        {
            // Set error message to the dialog
            ucTaskEdit.SetError(GetString("pm.project.permission"));
            // Stop edit control processing
            sender.StopProcessing = true;
            // Display dialog with HTML editor
            ucPopupDialogTask.Visible = true;
            // Set current project ID
            ucTaskEdit.ProjectID = ProjectID;
            // Show popup dialog for possibility of error on task edit form
            ucPopupDialogTask.Show();
            // Updade modal dialog update panel
            pnlUpdateModalTask.Update();
        }
    }
示例#13
0
    /// <summary>
    /// Checks whether current user can modify task.
    /// </summary>
    /// <param name="permissionType">Permission type</param>
    /// <param name="modulePermissionType">Module permission type</param>
    /// <param name="sender">Sender object</param>
    void ucTaskEdit_OnCheckPermissionsExtended(string permissionType, string modulePermissionType, CMSAdminControl sender)
    {
        // Get task info for currently deleted task
        ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(ucTaskEdit.ItemID);

        // Check permission only for existing tasks and tasks assigned to some project
        if ((pti != null) && (pti.ProjectTaskProjectID > 0))
        {
            // Keep current user
            CurrentUserInfo cui = CMSContext.CurrentUser;

            // Check access to project permission for modify action
            if ((String.Compare(permissionType, ProjectManagementPermissionType.MODIFY, true) == 0) && ProjectInfoProvider.IsAuthorizedPerProject(pti.ProjectTaskProjectID, ProjectManagementPermissionType.READ, cui))
            {
                // If user is owner or assignee => allow taks edit
                if ((pti.ProjectTaskOwnerID == cui.UserID) || (pti.ProjectTaskAssignedToUserID == cui.UserID))
                {
                    return;
                }
            }

            // Check whether user is allowed to modify task
            if (!ProjectInfoProvider.IsAuthorizedPerProject(pti.ProjectTaskProjectID, permissionType, cui))
            {
                // Set error message to the dialog
                ucTaskEdit.SetError(GetString("pm.project.permission"));
                // Stop edit control processing
                sender.StopProcessing = true;

                // Render dialog
                this.ucPopupDialog.Visible = true;
                // Show dialog
                ucPopupDialog.Show();
                // Update dialog panel
                pnlUpdateList.Update();
            }
        }
    }
示例#14
0
    /// <summary>
    /// Deletes project task. Called when the "Delete task" button is pressed.
    /// Expects the CreateProjectTask method to be run first.
    /// </summary>
    private bool DeleteProjectTask()
    {
        // Prepare the parameters
        string where = "ProjectTaskDisplayName LIKE N'My new task%'";
        string orderBy = "";
        int    topN    = 0;
        string columns = "";

        // Get the data
        DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns);

        if (!DataHelper.DataSourceIsEmpty(tasks))
        {
            // Get the project task
            ProjectTaskInfo deleteTask = new ProjectTaskInfo(tasks.Tables[0].Rows[0]);

            // Delete the project task
            ProjectTaskInfoProvider.DeleteProjectTaskInfo(deleteTask);

            return(deleteTask != null);
        }
        return(false);
    }
示例#15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageTitle title = PageTitle;

        // Prepare the header
        string name = "";

        if (editElem.ProjectTaskObj != null)
        {
            name = editElem.ProjectTaskObj.ProjectTaskDisplayName;
        }
        else
        {
            name = (projectId > 0) ? GetString("pm.projecttask.new") : GetString("pm.projecttask.newpersonal");
        }

        // Initialize breadcrumbs
        title.Breadcrumbs.Items.Add(new BreadcrumbItem()
        {
            Text        = (projectId > 0) ? GetString("pm.projecttask.list") : GetString("pm.projecttask"),
            RedirectUrl = ResolveUrl("~/CMSModules/ProjectManagement/Pages/Tools/ProjectTask/List.aspx?projectid=" + projectId),
        });
        title.Breadcrumbs.Items.Add(new BreadcrumbItem()
        {
            Text = HTMLHelper.HTMLEncode(name),
        });

        if ((projectId > 0) &&
            (editElem.ProjectTaskObj != null))
        {
            ProjectTaskInfo task   = editElem.ProjectTaskObj;
            HeaderAction    action = new HeaderAction();
            action.Text        = GetString("pm.projecttask.new");
            action.RedirectUrl = ResolveUrl(String.Format("Edit.aspx?projectid={0:D}&assigneeid={1:D}&ownerid={2:D}", projectId, task.ProjectTaskAssignedToUserID, task.ProjectTaskOwnerID));
            CurrentMaster.HeaderActions.AddAction(action);
        }
    }
    /// <summary>
    /// Gets and bulk updates project tasks. Called when the "Get and bulk update tasks" button is pressed.
    /// Expects the CreateProjectTask method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateProjectTasks()
    {
        // Prepare the parameters
        string where = "ProjectTaskDisplayName LIKE N'My new task%'";
        string orderBy = "";
        int topN = 0;
        string columns = "";

        // Get the data
        DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns);
        if (!DataHelper.DataSourceIsEmpty(tasks))
        {
            // Loop through the individual items
            foreach (DataRow taskDr in tasks.Tables[0].Rows)
            {
                // Create object from DataRow
                ProjectTaskInfo modifyTask = new ProjectTaskInfo(taskDr);

                // Update the properties
                modifyTask.ProjectTaskDisplayName = modifyTask.ProjectTaskDisplayName.ToUpper();

                // Save the changes
                ProjectTaskInfoProvider.SetProjectTaskInfo(modifyTask);
            }

            return true;
        }

        return false;
    }
    /// <summary>
    /// Deletes project task. Called when the "Delete task" button is pressed.
    /// Expects the CreateProjectTask method to be run first.
    /// </summary>
    private bool DeleteProjectTask()
    {
        // Prepare the parameters
        string where = "ProjectTaskDisplayName LIKE N'My new task%'";
        string orderBy = "";
        int topN = 0;
        string columns = "";

        // Get the data
        DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns);
        if (!DataHelper.DataSourceIsEmpty(tasks))
        {
            // Get the project task
            ProjectTaskInfo deleteTask = new ProjectTaskInfo(tasks.Tables[0].Rows[0]);

            // Delete the project task
            ProjectTaskInfoProvider.DeleteProjectTaskInfo(deleteTask);

            return (deleteTask != null);
        }
        return false;
    }
    /// <summary>
    /// Creates project task. Called when the "Create task" button is pressed.
    /// </summary>
    private bool CreateProjectTask()
    {
        ProjectInfo project = ProjectInfoProvider.GetProjectInfo("MyNewProject", CMSContext.CurrentSiteID, 0);
        ProjectTaskStatusInfo status = ProjectTaskStatusInfoProvider.GetProjectTaskStatusInfo("NotStarted");
        ProjectTaskPriorityInfo priority = ProjectTaskPriorityInfoProvider.GetProjectTaskPriorityInfo("Normal");

        if ((project != null) && (status != null) && (priority != null))
        {
            // Create new project task object
            ProjectTaskInfo newTask = new ProjectTaskInfo();

            int currentUserID = CMSContext.CurrentUser.UserID;

            // Set the properties
            newTask.ProjectTaskDisplayName = "My new task";
            newTask.ProjectTaskCreatedByID = currentUserID;
            newTask.ProjectTaskOwnerID = currentUserID;
            newTask.ProjectTaskAssignedToUserID = currentUserID;
            newTask.ProjectTaskStatusID = status.TaskStatusID;
            newTask.ProjectTaskPriorityID = priority.TaskPriorityID;
            newTask.ProjectTaskProjectID = project.ProjectID;

            // Save the project task
            ProjectTaskInfoProvider.SetProjectTaskInfo(newTask);

            return true;
        }
        return false;
    }
示例#19
0
    /// <summary>
    /// Saves the data.
    /// </summary>
    public bool Save()
    {
        // Validate the form
        if (Validate())
        {
            // New task
            if (this.ProjectTaskObj == null)
            {
                // New task - check permission of project task (ad-hoc task are allowed to create)
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.CREATE, CMSAdminControl.PERMISSION_MANAGE))
                {
                    return(false);
                }

                ProjectTaskInfo pi = new ProjectTaskInfo();
                pi.ProjectTaskProjectOrder = 0;
                pi.ProjectTaskUserOrder    = 0;
                pi.ProjectTaskProjectID    = ProjectID;
                pi.ProjectTaskCreatedByID  = CMSContext.CurrentUser.UserID;
                mProjectTaskObj            = pi;
            }
            else
            {
                this.ItemID = ProjectTaskObj.ProjectTaskID;
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.MODIFY, CMSAdminControl.PERMISSION_MANAGE))
                {
                    return(false);
                }
            }

            // Initialize object
            this.ProjectTaskObj.ProjectTaskDisplayName = this.txtProjectTaskDisplayName.Text.Trim();
            int assignedToUserId = ValidationHelper.GetInteger(selectorAssignee.UniSelector.Value, 0);
            if (assignedToUserId != this.ProjectTaskObj.ProjectTaskAssignedToUserID)
            {
                // If the task is reassigned - reset user order
                this.ProjectTaskObj.ProjectTaskUserOrder        = ProjectTaskInfoProvider.GetTaskMaxOrder(ProjectTaskOrderByEnum.UserOrder, assignedToUserId) + 1;
                this.ProjectTaskObj.ProjectTaskAssignedToUserID = assignedToUserId;
            }

            this.ProjectTaskObj.ProjectTaskProgress = ValidationHelper.GetInteger(this.txtProjectTaskProgress.Text, 0);
            this.ProjectTaskObj.ProjectTaskHours    = ValidationHelper.GetDouble(this.txtProjectTaskHours.Text, 0);
            this.ProjectTaskObj.ProjectTaskOwnerID  = ValidationHelper.GetInteger(selectorOwner.UniSelector.Value, 0);
            this.ProjectTaskObj.ProjectTaskDeadline = this.dtpProjectTaskDeadline.SelectedDateTime;
            if ((this.ProjectTaskObj.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) &&
                (this.ProjectTaskObj.ProjectTaskDeadline > DateTime.Now))
            {
                this.ProjectTaskObj.ProjectTaskNotificationSent = false;
            }
            this.ProjectTaskObj.ProjectTaskStatusID    = ValidationHelper.GetInteger(drpTaskStatus.SelectedValue, 0);
            this.ProjectTaskObj.ProjectTaskPriorityID  = ValidationHelper.GetInteger(drpTaskPriority.SelectedValue, 0);
            this.ProjectTaskObj.ProjectTaskIsPrivate   = this.chkProjectTaskIsPrivate.Checked;
            this.ProjectTaskObj.ProjectTaskDescription = htmlTaskDescription.ResolvedValue;



            // Use try/catch due to license check
            try
            {
                // Save object data to database
                ProjectTaskInfoProvider.SetProjectTaskInfo(this.ProjectTaskObj);

                this.ItemID = this.ProjectTaskObj.ProjectTaskID;
                this.RaiseOnSaved();

                this.lblInfo.Text = GetString("general.changessaved");
                return(true);
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text    = ex.Message;
            }
        }
        return(false);
    }
示例#20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Keep current user object
        CurrentUserInfo currentUser = CMSContext.CurrentUser;

        // Title element settings
        titleElem.TitleImage = GetImageUrl("Objects/PM_ProjectTask/object.png");
        titleElem.TitleText  = GetString("pm.projecttask.edit");

        #region "Header actions"

        if (CMSContext.CurrentUser.IsAuthenticated())
        {
            // New task link
            string[,] actions = new string[1, 7];
            actions[0, 0]     = HeaderActions.TYPE_LINKBUTTON;
            actions[0, 1]     = GetString("pm.projecttask.newpersonal");
            actions[0, 2]     = null;
            actions[0, 4]     = null;
            actions[0, 5]     = GetImageUrl("Objects/PM_Project/add.png");
            actions[0, 6]     = "new_task";

            HeaderActions.Actions          = actions;
            HeaderActions.ActionPerformed += new CommandEventHandler(actionsElem_ActionPerformed);
            HeaderActions.ReloadData();
        }
        #endregion

        // Switch by display type and set correct list grid name
        switch (this.TasksDisplayType)
        {
        // Project tasks
        case TasksDisplayTypeEnum.ProjectTasks:
            ucTaskList.OrderByType   = ProjectTaskOrderByEnum.NotSpecified;
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/ProjectTasks.xml";
            pnlListActions.Visible   = false;
            break;

        // Tasks owned by me
        case TasksDisplayTypeEnum.TasksOwnedByMe:
            ucTaskList.OrderByType   = ProjectTaskOrderByEnum.NotSpecified;
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/TasksOwnedByMe.xml";
            break;

        // Tasks assigned to me
        case TasksDisplayTypeEnum.TasksAssignedToMe:
            // Set not specified order by default
            ucTaskList.OrderByType = ProjectTaskOrderByEnum.NotSpecified;
            // If sitename is not defined => display task from all sites => use user order
            if (String.IsNullOrEmpty(this.SiteName))
            {
                ucTaskList.OrderByType = ProjectTaskOrderByEnum.UserOrder;
            }
            ucTaskList.Grid.OrderBy  = "TaskPriorityOrder ASC,ProjectTaskDeadline DESC";
            ucTaskList.Grid.GridName = "~/CMSModules/ProjectManagement/Controls/LiveControls/TasksAssignedToMe.xml";
            break;
        }

        #region "Force edit by TaskID in querystring"

        // Check whether is not postback
        if (!RequestHelper.IsPostBack())
        {
            // Try get value from request stroage which indicates whether force dialog is displayed
            bool isDisplayed = ValidationHelper.GetBoolean(RequestStockHelper.GetItem("cmspmforceitemdisplayed", true), false);

            // Try get task id from querystring
            int forceTaskId = QueryHelper.GetInteger("taskid", 0);
            if ((forceTaskId > 0) && (!isDisplayed))
            {
                ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(forceTaskId);
                ProjectInfo     pi  = ProjectInfoProvider.GetProjectInfo(pti.ProjectTaskProjectID);

                // Check whether task is defined
                // and if is assigned to some project, this project is assigned to current site
                if ((pti != null) && ((pi == null) || (pi.ProjectSiteID == CMSContext.CurrentSiteID)))
                {
                    bool taskIdValid = false;

                    // Switch by display type
                    switch (this.TasksDisplayType)
                    {
                    // Tasks created by me
                    case TasksDisplayTypeEnum.TasksOwnedByMe:
                        if (pti.ProjectTaskOwnerID == currentUser.UserID)
                        {
                            taskIdValid = true;
                        }
                        break;

                    // Tasks assigned to me
                    case TasksDisplayTypeEnum.TasksAssignedToMe:
                        if (pti.ProjectTaskAssignedToUserID == currentUser.UserID)
                        {
                            taskIdValid = true;
                        }
                        break;

                    // Project task
                    case TasksDisplayTypeEnum.ProjectTasks:
                        if (!String.IsNullOrEmpty(ProjectNames) && (pi != null))
                        {
                            string projectNames = ";" + ProjectNames.ToLower() + ";";
                            if (projectNames.Contains(";" + pi.ProjectName.ToLower() + ";"))
                            {
                                // Check whether user can see private task
                                if (!pti.ProjectTaskIsPrivate ||
                                    ((pti.ProjectTaskOwnerID == currentUser.UserID) || (pti.ProjectTaskAssignedToUserID == currentUser.UserID)) ||
                                    ((pi.ProjectGroupID > 0) && currentUser.IsGroupAdministrator(pi.ProjectGroupID)) ||
                                    ((pi.ProjectGroupID == 0) && (currentUser.IsAuthorizedPerResource("CMS.ProjectManagement", CMSAdminControl.PERMISSION_MANAGE))))
                                {
                                    taskIdValid = true;
                                }
                            }
                        }
                        break;
                    }

                    bool displayValid = true;

                    // Check whether do not display finished tasks is required
                    if (!this.ShowFinishedTasks)
                    {
                        ProjectTaskStatusInfo ptsi = ProjectTaskStatusInfoProvider.GetProjectTaskStatusInfo(pti.ProjectTaskStatusID);
                        if ((ptsi != null) && (ptsi.TaskStatusIsFinished))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether private task should be edited
                    if (!this.ShowPrivateTasks)
                    {
                        if (pti.ProjectTaskProjectID == 0)
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether ontime task should be edited
                    if (!this.ShowOnTimeTasks)
                    {
                        if ((pti.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) && (pti.ProjectTaskDeadline < DateTime.Now))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether overdue task should be edited
                    if (!this.ShowOverdueTasks)
                    {
                        if ((pti.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) && (pti.ProjectTaskDeadline > DateTime.Now))
                        {
                            displayValid = false;
                        }
                    }

                    // Check whether user is allowed to see project
                    if ((pi != null) && (ProjectInfoProvider.IsAuthorizedPerProject(pi.ProjectID, ProjectManagementPermissionType.READ, CMSContext.CurrentUser)))
                    {
                        displayValid = false;
                    }

                    // If task is valid and user has permissions to see this task display edit task dialog
                    if (displayValid && taskIdValid && ProjectTaskInfoProvider.IsAuthorizedPerTask(forceTaskId, ProjectManagementPermissionType.READ, CMSContext.CurrentUser, CMSContext.CurrentSiteID))
                    {
                        this.ucTaskEdit.ItemID = forceTaskId;
                        this.ucTaskEdit.ReloadData();
                        // Render dialog
                        this.ucPopupDialog.Visible = true;
                        this.ucPopupDialog.Show();
                        // Set "force dialog displayed" flag
                        RequestStockHelper.Add("cmspmforceitemdisplayed", true, true);
                    }
                }
            }
        }

        #endregion


        #region "Event handlers registration"

        // Register list action handler
        ucTaskList.OnAction += new CommandEventHandler(ucTaskList_OnAction);

        #endregion


        #region "Pager settings"

        // Paging
        if (!EnablePaging)
        {
            ucTaskList.Grid.PageSize = "##ALL##";
            ucTaskList.Grid.Pager.DefaultPageSize = -1;
        }
        else
        {
            ucTaskList.Grid.Pager.DefaultPageSize = PageSize;
            ucTaskList.Grid.PageSize    = this.PageSize.ToString();
            ucTaskList.Grid.FilterLimit = PageSize;
        }

        #endregion


        // Use postbacks on list actions
        ucTaskList.UsePostbackOnEdit = true;
        // Check delete permission
        ucTaskList.OnCheckPermissionsExtended += new CheckPermissionsExtendedEventHandler(ucTaskList_OnCheckPermissionsExtended);
        // Dont register JS edit script
        ucTaskList.RegisterEditScript = false;

        // Hide default ok button on edit
        ucTaskEdit.ShowOKButton = false;
        // Disable on site validators
        ucTaskEdit.DisableOnSiteValidators = true;
        // Check modify permission
        ucTaskEdit.OnCheckPermissionsExtended += new CheckPermissionsExtendedEventHandler(ucTaskEdit_OnCheckPermissionsExtended);
        // Build condition event
        ucTaskList.BuildCondition += new CMSModules_ProjectManagement_Controls_UI_ProjectTask_List.BuildConditionEvent(ucTaskList_BuildCondition);
    }
 /// <summary>
 /// Fill the "general" task info from the bottom of the screen
 /// </summary>
 /// <param name="task"></param>
 private void FillTaskInfo(ProjectTaskInfo task)
 {
     task.ScheduleInfo = new ProjectTaskSchedule();
     if (lueAssignedUser.LookupResultValue != null)
     {
         task.ScheduleInfo.AssignedResourceIds = new String[] { ((ITLXProjectResource)lueAssignedUser.LookupResultValue).ResourceUserId };
     }
     task.ContactId = (String)lueContact.LookupResultValue;
     task.Phase = pklPhase.PickListValue;
     task.Category = pklProjectTaskCategory.PickListValue;
     if (dteStartDate.DateTimeValue != null)
         task.ScheduleInfo.ScheduledStart = dteStartDate.DateTimeValue;
     else
         task.ScheduleInfo.ScheduledStart = DateTime.UtcNow;
     if (txtEstDuration.Text != "")
         task.ScheduleInfo.EstimatedDuration = TimeSpan.FromHours(Convert.ToDouble(txtEstDuration.Text));
     //task.ScheduleInfo.EstimatedDuration = TimeSpan.FromHours(1);
 }
示例#22
0
    /// <summary>
    /// Saves the data.
    /// </summary>
    public bool Save()
    {
        // Validate the form
        if (Validate())
        {
            // New task
            if (ProjectTaskObj == null)
            {
                // New task - check permission of project task (ad-hoc task are allowed to create)
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.CREATE, PERMISSION_MANAGE))
                {
                    return(false);
                }

                ProjectTaskInfo pi = new ProjectTaskInfo();
                pi.ProjectTaskProjectOrder = 0;
                pi.ProjectTaskUserOrder    = 0;
                pi.ProjectTaskProjectID    = ProjectID;
                pi.ProjectTaskCreatedByID  = MembershipContext.AuthenticatedUser.UserID;
                mProjectTaskObj            = pi;
            }
            else
            {
                ItemID = ProjectTaskObj.ProjectTaskID;
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.MODIFY, PERMISSION_MANAGE))
                {
                    return(false);
                }
            }

            // Initialize object
            ProjectTaskObj.ProjectTaskDisplayName = txtProjectTaskDisplayName.Text.Trim();
            int assignedToUserId = ValidationHelper.GetInteger(selectorAssignee.UniSelector.Value, 0);
            if (assignedToUserId != ProjectTaskObj.ProjectTaskAssignedToUserID)
            {
                // If the task is reassigned - reset user order
                ProjectTaskObj.ProjectTaskUserOrder        = ProjectTaskInfoProvider.GetTaskMaxOrder(ProjectTaskOrderByEnum.UserOrder, assignedToUserId) + 1;
                ProjectTaskObj.ProjectTaskAssignedToUserID = assignedToUserId;
            }

            ProjectTaskObj.ProjectTaskProgress = ValidationHelper.GetInteger(txtProjectTaskProgress.Text, 0);
            ProjectTaskObj.ProjectTaskHours    = ValidationHelper.GetDouble(txtProjectTaskHours.Text, 0);
            ProjectTaskObj.ProjectTaskOwnerID  = ValidationHelper.GetInteger(selectorOwner.UniSelector.Value, 0);
            ProjectTaskObj.ProjectTaskDeadline = dtpProjectTaskDeadline.SelectedDateTime;
            if ((ProjectTaskObj.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME) &&
                (ProjectTaskObj.ProjectTaskDeadline > DateTime.Now))
            {
                ProjectTaskObj.ProjectTaskNotificationSent = false;
            }
            ProjectTaskObj.ProjectTaskStatusID    = ValidationHelper.GetInteger(drpTaskStatus.SelectedValue, 0);
            ProjectTaskObj.ProjectTaskPriorityID  = ValidationHelper.GetInteger(drpTaskPriority.SelectedValue, 0);
            ProjectTaskObj.ProjectTaskIsPrivate   = chkProjectTaskIsPrivate.Checked;
            ProjectTaskObj.ProjectTaskDescription = htmlTaskDescription.ResolvedValue;


            // Use try/catch due to license check
            try
            {
                // Save object data to database
                ProjectTaskInfoProvider.SetProjectTaskInfo(ProjectTaskObj);

                ItemID = ProjectTaskObj.ProjectTaskID;
                RaiseOnSaved();

                ShowChangesSaved();
                return(true);
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
        }
        return(false);
    }
示例#23
0
    /// <summary>
    /// Saves the data.
    /// </summary>
    public bool Save()
    {
        // Validate the form
        if (Validate())
        {
            // New task
            if (this.ProjectTaskObj == null)
            {
                // New task - check permission of project task (ad-hoc task are allowed to create)
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.CREATE, CMSAdminControl.PERMISSION_MANAGE))
                {
                    return false;
                }

                ProjectTaskInfo pi = new ProjectTaskInfo();
                pi.ProjectTaskProjectOrder = 0;
                pi.ProjectTaskUserOrder = 0;
                pi.ProjectTaskProjectID = ProjectID;
                pi.ProjectTaskCreatedByID = CMSContext.CurrentUser.UserID;
                mProjectTaskObj = pi;
            }
            else
            {
                this.ItemID = ProjectTaskObj.ProjectTaskID;
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.MODIFY, CMSAdminControl.PERMISSION_MANAGE))
                {
                    return false;
                }
            }

            // Initialize object
            this.ProjectTaskObj.ProjectTaskDisplayName = this.txtProjectTaskDisplayName.Text.Trim();
            int assignedToUserId = ValidationHelper.GetInteger(selectorAssignee.UniSelector.Value, 0);
            if (assignedToUserId != this.ProjectTaskObj.ProjectTaskAssignedToUserID)
            {
                // If the task is reassigned - reset user order
                this.ProjectTaskObj.ProjectTaskUserOrder = ProjectTaskInfoProvider.GetTaskMaxOrder(ProjectTaskOrderByEnum.UserOrder, assignedToUserId) + 1;
                this.ProjectTaskObj.ProjectTaskAssignedToUserID = assignedToUserId;
            }

            this.ProjectTaskObj.ProjectTaskProgress = ValidationHelper.GetInteger(this.txtProjectTaskProgress.Text, 0);
            this.ProjectTaskObj.ProjectTaskHours = ValidationHelper.GetDouble(this.txtProjectTaskHours.Text, 0);
            this.ProjectTaskObj.ProjectTaskOwnerID = ValidationHelper.GetInteger(selectorOwner.UniSelector.Value, 0);
            this.ProjectTaskObj.ProjectTaskDeadline = this.dtpProjectTaskDeadline.SelectedDateTime;
            if ((this.ProjectTaskObj.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME)
                && (this.ProjectTaskObj.ProjectTaskDeadline > DateTime.Now))
            {
                this.ProjectTaskObj.ProjectTaskNotificationSent = false;
            }
            this.ProjectTaskObj.ProjectTaskStatusID = ValidationHelper.GetInteger(drpTaskStatus.SelectedValue, 0);
            this.ProjectTaskObj.ProjectTaskPriorityID = ValidationHelper.GetInteger(drpTaskPriority.SelectedValue, 0);
            this.ProjectTaskObj.ProjectTaskIsPrivate = this.chkProjectTaskIsPrivate.Checked;
            this.ProjectTaskObj.ProjectTaskDescription = htmlTaskDescription.ResolvedValue;

            // Use try/catch due to license check
            try
            {
                // Save object data to database
                ProjectTaskInfoProvider.SetProjectTaskInfo(this.ProjectTaskObj);

                this.ItemID = this.ProjectTaskObj.ProjectTaskID;
                this.RaiseOnSaved();

                this.lblInfo.Text = GetString("general.changessaved");
                return true;
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text = ex.Message;
            }
        }
        return false;
    }
 /// <summary>
 /// Update foreign keys for the task
 /// </summary>
 /// <param name="task"></param>
 /// <param name="parentEntity"></param>
 private void UpdateLinks(ProjectTaskInfo task, object parentEntity)
 {
     if (DialogService.DialogParameters.ContainsKey("ParentProjectId"))
     {
         // this allows for passing the links especially via the DialogParameters
         task.ProjectId = DialogService.DialogParameters["ParentProjectId"].ToString();
         if (DialogService.DialogParameters.ContainsKey("ParentMilestoneId"))
             task.MilestoneId = DialogService.DialogParameters["ParentMilestoneId"].ToString();
         if (DialogService.DialogParameters.ContainsKey("ParentTaskId"))
             task.ParentTaskId = DialogService.DialogParameters["ParentTaskId"].ToString();
         if (DialogService.DialogParameters.ContainsKey("ParentContractId"))
             task.ProjectContractId = DialogService.DialogParameters["ParentContractId"].ToString();
     }
     else if (parentEntity is ITLXProject)
     {
         task.ProjectId = (String)((ITLXProject)parentEntity).Id;
     }
     else if (parentEntity is ITLXProjectMilestone)
     {
         task.ProjectId = ((ITLXProjectMilestone)parentEntity).Timelink_projectsId;
         task.MilestoneId = ((ITLXProjectMilestone)parentEntity).Id.ToString();
     }
     else if (parentEntity is ITLXProjectTask)
     {
         task.ProjectId = ((ITLXProjectTask)parentEntity).Timelink_projectsId;
         task.MilestoneId = ((ITLXProjectTask)parentEntity).MilestoneId;
         // should set parent task id here...
         task.ParentTaskId = ((ITLXProjectTask)parentEntity).Id.ToString();
     }
 }
    /// <summary>
    /// Saves the data.
    /// </summary>
    public bool Save()
    {
        // Validate the form
        if (Validate())
        {
            // New task
            if (ProjectTaskObj == null)
            {
                // New task - check permission of project task (ad-hoc task are allowed to create)
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.CREATE, PERMISSION_MANAGE))
                {
                    return false;
                }

                ProjectTaskInfo pi = new ProjectTaskInfo();
                pi.ProjectTaskProjectOrder = 0;
                pi.ProjectTaskUserOrder = 0;
                pi.ProjectTaskProjectID = ProjectID;
                pi.ProjectTaskCreatedByID = MembershipContext.AuthenticatedUser.UserID;
                mProjectTaskObj = pi;
            }
            else
            {
                ItemID = ProjectTaskObj.ProjectTaskID;
                if (!CheckPermissions("CMS.ProjectManagement", ProjectManagementPermissionType.MODIFY, PERMISSION_MANAGE))
                {
                    return false;
                }
            }

            // Initialize object
            ProjectTaskObj.ProjectTaskDisplayName = txtProjectTaskDisplayName.Text.Trim();
            int assignedToUserId = ValidationHelper.GetInteger(selectorAssignee.UniSelector.Value, 0);
            if (assignedToUserId != ProjectTaskObj.ProjectTaskAssignedToUserID)
            {
                // If the task is reassigned - reset user order
                ProjectTaskObj.ProjectTaskUserOrder = ProjectTaskInfoProvider.GetTaskMaxOrder(ProjectTaskOrderByEnum.UserOrder, assignedToUserId) + 1;
                ProjectTaskObj.ProjectTaskAssignedToUserID = assignedToUserId;
            }

            ProjectTaskObj.ProjectTaskProgress = ValidationHelper.GetInteger(txtProjectTaskProgress.Text, 0);
            ProjectTaskObj.ProjectTaskHours = ValidationHelper.GetDouble(txtProjectTaskHours.Text, 0);
            ProjectTaskObj.ProjectTaskOwnerID = ValidationHelper.GetInteger(selectorOwner.UniSelector.Value, 0);
            ProjectTaskObj.ProjectTaskDeadline = dtpProjectTaskDeadline.SelectedDateTime;
            if ((ProjectTaskObj.ProjectTaskDeadline != DateTimeHelper.ZERO_TIME)
                && (ProjectTaskObj.ProjectTaskDeadline > DateTime.Now))
            {
                ProjectTaskObj.ProjectTaskNotificationSent = false;
            }
            ProjectTaskObj.ProjectTaskStatusID = ValidationHelper.GetInteger(drpTaskStatus.SelectedValue, 0);
            ProjectTaskObj.ProjectTaskPriorityID = ValidationHelper.GetInteger(drpTaskPriority.SelectedValue, 0);
            ProjectTaskObj.ProjectTaskIsPrivate = chkProjectTaskIsPrivate.Checked;
            ProjectTaskObj.ProjectTaskDescription = htmlTaskDescription.ResolvedValue;

            // Use try/catch due to license check
            try
            {
                // Save object data to database
                ProjectTaskInfoProvider.SetProjectTaskInfo(ProjectTaskObj);

                ItemID = ProjectTaskObj.ProjectTaskID;
                RaiseOnSaved();

                ShowChangesSaved();
                return true;
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
        }
        return false;
    }
    /// <summary>
    /// Gets and updates project task. Called when the "Get and update task" button is pressed.
    /// Expects the CreateProjectTask method to be run first.
    /// </summary>
    private bool GetAndUpdateProjectTask()
    {
        // Prepare the parameters
        string where = "ProjectTaskDisplayName LIKE N'My new task%'";
        string orderBy = "";
        int topN = 0;
        string columns = "";

        // Get the data
        DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns);
        if (!DataHelper.DataSourceIsEmpty(tasks))
        {
            // Get the project task
            ProjectTaskInfo updateTask = new ProjectTaskInfo(tasks.Tables[0].Rows[0]);
            if (updateTask != null)
            {
                // Update the properties
                updateTask.ProjectTaskDisplayName = updateTask.ProjectTaskDisplayName.ToLowerCSafe();

                // Save the changes
                ProjectTaskInfoProvider.SetProjectTaskInfo(updateTask);

                return true;
            }
        }

        return false;
    }
    /// <summary>
    /// Fill the "general" task info from the bottom of the screen
    /// </summary>
    /// <param name="task"></param>
    private void FillTaskInfo(ProjectTaskInfo task)
    {
        task.ScheduleInfo = new ProjectTaskSchedule();
        if (lueAssignedUser.LookupResultValue != null)
        {
            task.ScheduleInfo.AssignedResourceIds = new String[] { ((ITLXProjectResource)lueAssignedUser.LookupResultValue).ResourceUserId };
        }
        task.ContactId = (String)lueContact.LookupResultValue;
        task.Phase = pklPhase.PickListValue;
        task.Category = pklProjectTaskCategory.PickListValue;
        if (dteStartDate.DateTimeValue != null)
            task.ScheduleInfo.ScheduledStart = dteStartDate.DateTimeValue;
        else
            task.ScheduleInfo.ScheduledStart = DateTime.UtcNow;
        if (txtEstDuration.Text != "")
            task.ScheduleInfo.EstimatedDuration = TimeSpan.FromHours(Convert.ToDouble(txtEstDuration.Text));
        task.ScheduleInfo.EstimatedDuration = TimeSpan.FromHours(1);

        if (!string.IsNullOrEmpty(Convert.ToString(lueMilestone.LookupResultValue)))
        {
            lueMilestone.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.String;
            task.MilestoneId = lueMilestone.LookupResultValue.ToString();
            lueMilestone.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.Object;
        }

        if (!string.IsNullOrEmpty(Convert.ToString(lueParentTask.LookupResultValue)))
        {
            lueParentTask.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.String;
            task.ParentTaskId = lueParentTask.LookupResultValue.ToString();
            lueParentTask.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.Object;
        }
    }
    /// <summary>
    /// Update foreign keys for the task
    /// </summary>
    /// <param name="task"></param>
    /// <param name="parentEntity"></param>
    private void UpdateLinks(ProjectTaskInfo task, object parentEntity)
    {
        if (DialogService.DialogParameters.ContainsKey("ParentProjectId"))
        {
            // this allows for passing the links especially via the DialogParameters
            task.ProjectId = DialogService.DialogParameters["ParentProjectId"].ToString();
            if (DialogService.DialogParameters.ContainsKey("ParentMilestoneId"))
                task.MilestoneId = DialogService.DialogParameters["ParentMilestoneId"].ToString();
            if (DialogService.DialogParameters.ContainsKey("ParentTaskId"))
                task.ParentTaskId = DialogService.DialogParameters["ParentTaskId"].ToString();
            if (DialogService.DialogParameters.ContainsKey("ParentContractId"))
                task.ProjectContractId = DialogService.DialogParameters["ParentContractId"].ToString();
        }
        else if (parentEntity is ITLXProject)
        {
            task.ProjectId = (String)((ITLXProject)parentEntity).Id;
        }
        else if (parentEntity is ITLXProjectMilestone)
        {
            task.ProjectId = ((ITLXProjectMilestone)parentEntity).Timelink_projectsId;
            task.MilestoneId = ((ITLXProjectMilestone)parentEntity).Id.ToString();
        }
        else if (parentEntity is ITLXProjectTask)
        {
            task.ProjectId = ((ITLXProjectTask)parentEntity).Timelink_projectsId;
            task.MilestoneId = ((ITLXProjectTask)parentEntity).MilestoneId;
            // should set parent task id here...
            task.ParentTaskId = ((ITLXProjectTask)parentEntity).Id.ToString();
        }

        /*Code by Ambit so Save selected MileStone and Parent Task Start*/
        if (!string.IsNullOrEmpty(Convert.ToString(lueMilestone.LookupResultValue)))
        {
            lueMilestone.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.String;
            task.MilestoneId = lueMilestone.LookupResultValue.ToString();
            lueMilestone.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.Object;
        }

        if (!string.IsNullOrEmpty(Convert.ToString(lueParentTask.LookupResultValue)))
        {
            lueParentTask.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.String;
            task.ParentTaskId = lueParentTask.LookupResultValue.ToString();
            lueParentTask.LookupBindingMode = Sage.Platform.Controls.LookupBindingModeEnum.Object;
        }
        /*Code by Ambit so Save selected MileStone and Parent Task End*/
    }
示例#29
0
 /// <summary>
 /// Clears current form.
 /// </summary>
 public override void ClearForm()
 {
     mProjectTaskObj = null;
     txtProjectTaskDisplayName.Text = String.Empty;
     txtProjectTaskHours.Text = String.Empty;
     txtProjectTaskProgress.Text = String.Empty;
     chkProjectTaskIsPrivate.Checked = false;
     dtpProjectTaskDeadline.SelectedDateTime = DateTimeHelper.ZERO_TIME;
     selectorOwner.UniSelector.Value = String.Empty;
     selectorAssignee.UniSelector.Value = String.Empty;
     htmlTaskDescription.Value = String.Empty;
     drpTaskStatus.SelectedIndex = 0;
     LoadDefaultPriority();
     base.ClearForm();
 }
        private void BindData()
        {
            if (string.IsNullOrEmpty(ch.TID))
            {
                return;
            }
            else
            {
                this.TaskID = ch.TID;
                task        = BLL.ProjectTaskInfo.Instance.GetProjectTaskInfo(this.TaskID);

                if (task == null)
                {
                    return;
                }

                //custId = task.RelationID;
                //DataSource = (task.Source == 1 ? "2" : "1");
                switch (task.TaskStatus)
                {
                case 180000:    //未处理
                case 180001:    //处理中
                case 180002:    //审核拒绝
                case 180009:    //已驳回
                    IsBind = true;
                    break;

                default: break;
                }
                if (Request["Action"] != null)
                {
                    if (Request["Action"] != null && Request["Action"] == "view")
                    {
                        IsBind = false;
                    }
                }
            }
            //QueryCallRecordInfo query = new QueryCallRecordInfo();
            //query.TaskTypeID = 1;
            //if (task.Source == 2)//CRM库
            //{
            //    query.CustID = task.RelationID;
            //    query.TaskID = this.TaskID;
            //}
            //else if (task.Source == 1)//Excel导入
            //{
            //    query.NewCustID = int.Parse(task.RelationID);
            //    query.TaskID = this.TaskID;
            //    query.IsRelationIDOrCRMCustID = true;
            //}
            //int totalCount = 0;
            //string tableEndName = "";//只查询现表数据
            DataTable table = null; // BLL.CallRecordInfo.Instance.GetCallRecordsForRecord(query, 1, 100000, tableEndName, out totalCount);

            //设置数据源
            if (table != null && table.Rows.Count > 0)
            {
                repeater_Contact.DataSource = table;
            }
            //绑定列表数据
            repeater_Contact.DataBind();
        }