Beispiel #1
0
        public static string GetProfileName(UserLightPropertyCollection pc, string className)
        {
            if (pc[className + "_" + ProfileNameKey] == null)
                pc[className + "_" + ProfileNameKey] = GetFirstAvailableListViewProfile(className);

            return pc[className + "_" + ProfileNameKey];
        }
Beispiel #2
0
        public static string GetViewName(UserLightPropertyCollection pc)
        {
            if (pc[ProjectListViewNameKey] == null)
                pc[ProjectListViewNameKey] = GetFirstAvailableListViewProfile();

            return pc[ProjectListViewNameKey];
        }
Beispiel #3
0
 public static void SetProfileName(UserLightPropertyCollection pc, string className, string name)
 {
     pc[className + "_" + ProfileNameKey] = name;
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            pc = Security.CurrentUser.Properties;

            if (!IsPostBack)
            {
                BindDefaultValues();
                BindSavedData();
                BindClendarControl();
            }
            btnApply.Text = LocRM.GetString("Apply");
        }
Beispiel #5
0
 public static void SetViewName(UserLightPropertyCollection pc, string name)
 {
     pc[ProjectListViewNameKey] = name;
 }
Beispiel #6
0
        public static IList <GanttObject> GetAnalysisObjects(int originalPlanSlotId, int basePlanSlotId)
        {
            List <GanttObject> ret = new List <GanttObject>();

            IFormatProvider provider = CultureInfo.InvariantCulture;

            List <int> projects            = new List <int>();
            UserLightPropertyCollection pc = Security.CurrentUser.Properties;

            switch (pc["Report_ProjectListType"])
            {
            case "Custom":
                string projectList = pc["Report_ProjectListData"];
                if (!string.IsNullOrEmpty(projectList))
                {
                    foreach (string id in projectList.Split(';'))
                    {
                        int projectId;
                        if (int.TryParse(id.Trim(), out projectId))
                        {
                            projects.Add(projectId);
                        }
                    }
                }
                break;

            case "Portfolio":
                string    portfolioId = pc["Report_ProjectListData"];
                DataTable dt          = Project.GetListProjectGroupedByPortfolio(int.Parse(portfolioId, provider), 0, 0);
                foreach (DataRow row in dt.Rows)
                {
                    int projectId = (int)row["ProjectId"];
                    if (projectId > 0)
                    {
                        projects.Add(projectId);
                    }
                }
                break;

            default:                     // All projects
                using (IDataReader reader = Project.GetListProjects())
                {
                    while (reader.Read())
                    {
                        projects.Add((int)reader["ProjectId"]);
                    }
                }
                break;
            }

            List <int> collapsedProjects    = new List <int>();
            string     collapsedProjectList = pc["Report_CollapsedProjectsList"];

            if (!string.IsNullOrEmpty(collapsedProjectList))
            {
                foreach (string id in collapsedProjectList.Split(';'))
                {
                    int projectId;
                    if (int.TryParse(id.Trim(), out projectId))
                    {
                        if (!collapsedProjects.Contains(projectId))
                        {
                            collapsedProjects.Add(projectId);
                        }
                    }
                }
            }

            foreach (int projectId in projects)
            {
                GanttObject project = new GanttObject();

                project.Id              = projectId;
                project.IsProject       = true;
                project.IsCollapsed     = collapsedProjects.Contains(projectId);
                project.MilestonesCount = Task.TasksGetMilestonesCount(projectId);

                // O.R. [2009-03-30]: if current user is PM, then he can got AccessDeniedException for some projects
                try
                {
                    using (IDataReader reader = Project.GetProject(projectId))
                    {
                        if (reader.Read())
                        {
                            project.Title       = reader["Title"].ToString();
                            project.Start       = (DateTime)reader["TargetStartDate"];
                            project.Finish      = (DateTime)reader["TargetFinishDate"];
                            project.IsCompleted = !(bool)reader["IsActive"];
                        }
                    }
                }
                catch (AccessDeniedException)
                {
                    continue;
                }

                ret.Add(project);

                // Load milestones
                Dictionary <int, DateTime> originalPlan = null;
                if (originalPlanSlotId > 0)
                {
                    originalPlan = ProjectSpreadSheet.GetTaskHash(projectId, originalPlanSlotId);
                }

                Dictionary <int, DateTime> basePlan = null;
                if (basePlanSlotId > 0)
                {
                    basePlan = ProjectSpreadSheet.GetTaskHash(projectId, basePlanSlotId);
                }

                int milestonesCount = 0;
                using (IDataReader reader = Task.GetListTasksByProject(projectId))
                {
                    while (reader.Read())
                    {
                        if ((bool)reader["IsMilestone"])
                        {
                            GanttObject milestone = new GanttObject();

                            milestone.Id          = (int)reader["TaskId"];
                            milestone.IsProject   = false;
                            milestone.IsCompleted = (bool)reader["IsCompleted"];
                            milestone.Title       = reader["Title"].ToString();

                            if (originalPlan != null)
                            {
                                if (originalPlan.ContainsKey(milestone.Id))
                                {
                                    milestone.Start = originalPlan[milestone.Id];
                                }
                            }
                            else
                            {
                                milestone.Start = (DateTime)reader["StartDate"];
                            }

                            milestone.Finish = milestone.Start;

                            if (basePlan != null && basePlan.ContainsKey(milestone.Id))
                            {
                                milestone.Finish = basePlan[milestone.Id];
                            }

                            if (milestone.Start != DateTime.MinValue)
                            {
                                milestonesCount++;
                                if (!project.IsCollapsed)
                                {
                                    ret.Add(milestone);
                                }
                            }
                        }
                    }
                }

                project.MilestonesCount = milestonesCount;
            }

            return(ret);
        }
Beispiel #7
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     pcCurrentUser = Security.CurrentUser.Properties;
     if (pcCurrentUser["c_SortColumn"] == null)
         pcCurrentUser["c_SortColumn"] = "CreationDate DESC";
     BindToolbar();
     BindDataGrid();
 }