/// <summary>
        /// Updates the all projects cached query results when a project is updated
        /// </summary>
        void AllProjectsOnProjectUpdated(object sender, ProjectUpdatedEventArgs e)
        {
            QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.AllProjectsCacheItem);

            if (cachedQuery != null)
            {
                // updated the query results if needed
                List <Data.Project> allProjects = (List <Data.Project>)cachedQuery.Value;
                Data.Project        oldProject  = allProjects.FirstOrDefault(p => p.ProjectID == e.UpdatedProject.ProjectId);
                Data.Project        newProject  = e.UpdatedDbProject;
                if (oldProject != null && newProject != null)
                {
                    allProjects.Remove(oldProject);
                    allProjects.Add(newProject);
                }
                else if (newProject != null)
                {
                    allProjects.Add(newProject);
                }

                allProjects = SortList(allProjects);

                _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.AllProjectsCacheItem, allProjects);
            }
        }
        /// <summary>
        /// Exports the report.
        /// </summary>
        /// <param name="exportType">Type of the export.</param>
        private void ExportReport(ReportTypes exportType)
        {
            Data.Project project = GetBL <Logic.Business.Project.ProjectBL>().GetProject(ProjectId);
            if (project != null)
            {
                string sortExpression = gvItems.MasterTableView.SortExpressions.GetSortString();
                int    itemTypeId     = projectItemTypes.SelectedItemTypeId;
                budgetList.ItemTypeID = itemTypeId;

                BudgetSummaryReportParameters parameters = new BudgetSummaryReportParameters();
                parameters.SortExpression = sortExpression;
                parameters.ItemTypeId     = projectItemTypes.SelectedItemTypeId;
                parameters.UserId         = this.UserID;
                parameters.CultureName    = CultureName;
                parameters.ProjectId      = this.ProjectId;

                string fileName = string.Format("{0}_BudgetSummaryReport", project.ProjectName);

                string fileNameExtension;
                string encoding;
                string mimeType;

                byte[] reportBytes = UserWebReportHandler.GenerateBudgetSummaryReport(parameters, exportType,
                                                                                      out fileNameExtension, out encoding, out mimeType);
                Utils.ExportReport(reportBytes, mimeType, fileNameExtension, fileName);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Exports the report.
        /// </summary>
        /// <param name="exportType">Type of the export.</param>
        private void ExportReport(ReportTypes exportType)
        {
            string cultureName = string.Empty;

            Data.Project project = GetBL <Logic.Business.Project.ProjectBL>().GetProject(ProjectId);
            if (project != null)
            {
                cultureName = Support.GetCultureName(project.Country.CountryCode);

                string fileNameExtension;
                string encoding;
                string mimeType;
                string fileName = string.Format("{0}_Active_TaskList", project.ProjectName);

                ActiveTaskListReportParameters parameters = new ActiveTaskListReportParameters
                {
                    CultureName = cultureName,
                    ItemTypeId  = projectItemTypes.SelectedItemTypeId,
                    ProjectId   = ProjectId,
                    UserId      = this.UserID
                };

                byte[] reportBytes = UserWebReportHandler.GenerateActiveTaskListReport(parameters, exportType,
                                                                                       out fileNameExtension, out encoding, out mimeType);
                Utils.ExportReport(reportBytes, mimeType, fileNameExtension, fileName);
            }
        }
Beispiel #4
0
        protected void Insert(Data.Project data)
        {
            data.ProjectId   = this.ReadProperty(ProjectIdProperty);
            data.CreatedBy   = ((BusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;
            data.CreatedDate = DateTime.Now;

            this.Update(data);
        }
Beispiel #5
0
        public void AddProject(Data.Project project)
        {
            ProjectNode pNode = new ProjectNode(project);

            treeView.TreeNodes.Add(pNode);
            pNode.Update();
            treeView.Refresh();
        }
        static public Analytics Analyze(Data.Project project)
        {
            Analytics analytics = new Analytics();

            foreach (var kvp in project.Files)
            {
                analytics.Analyze(kvp.Key, project);
            }
            return(analytics);
        }
Beispiel #7
0
 private void okButton_Click(object sender, EventArgs e)
 {
     if (!System.IO.Directory.Exists(pathTextBox.Text))
     {
         warningLabel.Text = "path not found";
         return;
     }
     Data.Project project = Data.Project.Create(pathTextBox.Text);
     Controller.AddProject(project);
     this.Close();
 }
Beispiel #8
0
 public override bool IsThisFileType(string relativeFilePath, Data.Project project)
 {
     if (
         relativeFilePath.ToLower().EndsWith(".txt") ||
         relativeFilePath.EndsWith(".text")
         )
     {
         return(true);
     }
     return(false);
 }
Beispiel #9
0
        public Scanner(Data.Project p)
        {
            _project         = p;
            _queued          = new HashSet <string>();
            _scan_queue      = new List <FileInfo>();
            _system_includes = new Dictionary <string, string>();

            Errors   = new List <string>();
            NotFound = new HashSet <string>();

            CaseSensitive = IsCaseSensitive();
        }
Beispiel #10
0
        public GitPage(Data.Project project) : base(new ajkControls.Git.GitPanel(project.RootPath), project.Name)
        {
            IconImage = codeEditor.Global.IconImages.Git;

            gitPanel.BackColor = System.Drawing.Color.FromArgb(50, 50, 50);
            gitPanel.Dock      = System.Windows.Forms.DockStyle.Fill;
            gitPanel.Font      = new System.Drawing.Font("MS UI Gothic", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
            gitPanel.Location  = new System.Drawing.Point(3, 3);
            gitPanel.Name      = "codeEditor";
            gitPanel.Size      = new System.Drawing.Size(614, 433);
            gitPanel.TabIndex  = 0;
        }
Beispiel #11
0
 protected void Update(Data.Project data)
 {
     if (this.IsSelfDirty)
     {
         data.Name         = this.ReadProperty(NameProperty);
         data.Description  = this.ReadProperty(DescriptionProperty);
         data.IsActive     = this.ReadProperty(IsActiveProperty);
         data.IsArchived   = this.ReadProperty(IsArchivedProperty);
         data.Notes        = this.ReadProperty(NotesProperty);
         data.ModifiedBy   = ((BusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;
         data.ModifiedDate = DateTime.Now;
     }
 }
Beispiel #12
0
        /// <summary>
        /// Gets the free trial project end date.
        /// </summary>
        /// <param name="companyId">The company id.</param>
        /// <returns>Free Trial Project end date</returns>
        public DateTime GetFreeTrialProjectEndDate(int companyId)
        {
            ProjectBL projectBL         = new ProjectBL(DataContext);
            var       freeTrialProjects = projectBL.GetFreeTrialProjectsNotInClosedStatus(companyId);

            Data.Project freeTrialProject = freeTrialProjects.FirstOrDefault();

            if (freeTrialProject != null && freeTrialProject.ExpirationDate.HasValue)
            {
                return(freeTrialProject.ExpirationDate.Value);
            }

            return(Utils.Today);
        }
Beispiel #13
0
        public void LoadData(int projectId)
        {
            try
            {
                Data.Project p     = _CatalogueDb.Projects.Find(projectId);
                var          items = _CatalogueDb.ProjectItems.ToList();

                Project = _CatalogueDb.Projects.Include(p => p.Items).FirstOrDefault(p => p.Id == projectId)?.ToProjectWrapper()
                          ?? new ProjectWrapper(new Data.Project(""));
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error loading project: {e.Message}");
            }
        }
        /// <summary>
        /// Updates the all projects cached query results when a project is deleted
        /// </summary>
        void AllProjectsOnProjectDeleted(object sender, ProjectDeletedEventArgs e)
        {
            QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.AllProjectsCacheItem);

            if (cachedQuery != null)
            {
                List <Data.Project> allProjects    = (List <Data.Project>)cachedQuery.Value;
                Data.Project        deletedProject = allProjects.FirstOrDefault(p => p.ProjectID == e.DeletedProject.ProjectId);
                if (deletedProject != null)
                {
                    allProjects.Remove(deletedProject);
                    _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.AllProjectsCacheItem, allProjects);
                }
            }
        }
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Project = await _context.Project.SingleOrDefaultAsync(m => m.ID == id);

            if (Project == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Beispiel #16
0
        /// <summary>
        /// Sends the emails project is closed.
        /// </summary>
        private void SendEmailsProjectIsClosed()
        {
            List <User> projectUsers          = this.GetBL <ProjectBL>().GetProjectUsers(ProjectID);
            List <User> companyAdministrators = this.GetBL <ProjectBL>().GetCompanyAdministrators(CompanyID);
            //List<User> usersToInformProjectClosed = projectUsers.Concat(companyAdministrators).ToList<User>();
            List <User> usersToInformProjectClosed = projectUsers.Union(companyAdministrators).ToList <User>();

            Data.Project project         = DataContext.Projects.Where(p => p.ProjectId == ProjectID).FirstOrDefault();
            User         projectClosedBy = this.GetBL <ProjectBL>().GetProjectClosedBy(ProjectID);

            foreach (User user in usersToInformProjectClosed)
            {
                EmailSender.InformUsersProjectIsClosed(user.Email1, ProjectID, user.FirstName, (projectClosedBy.FirstName + " " + projectClosedBy.LastName), Support.GetCompanyNameById(CompanyID), project.ProjectName);
            }
        }
Beispiel #17
0
        public ProjectPropertyForm(Data.Project project)
        {
            InitializeComponent();
            this.project       = project;
            this.Icon          = ajkControls.Global.Icon;
            this.ShowInTaskbar = false;

            this.Text = project.Name + " Property";
            setText();

            if (FormCreated != null)
            {
                FormCreated(this, project);
            }
        }
Beispiel #18
0
 protected void Fetch(Data.Project data)
 {
     this.LoadProperty(ProjectIdProperty, data.ProjectId);
     this.LoadProperty(NameProperty, data.Name);
     this.LoadProperty(DescriptionProperty, data.Description);
     this.LoadProperty(IsActiveProperty, data.IsActive);
     this.LoadProperty(IsArchivedProperty, data.IsArchived);
     this.LoadProperty(NotesProperty, data.Notes);
     this.LoadProperty(ModifiedByProperty, data.ModifiedBy);
     this.LoadProperty(ModifiedByNameProperty, data.ModifiedByUser.Name);
     this.LoadProperty(ModifiedDateProperty, data.ModifiedDate);
     this.LoadProperty(CreatedByProperty, data.CreatedBy);
     this.LoadProperty(CreatedByNameProperty, data.CreatedByUser.Name);
     this.LoadProperty(CreatedDateProperty, data.CreatedDate);
 }
        /// <summary>
        /// Returns a shallow-copied list of a single project by project id.
        /// </summary>
        public Project GetProjectByProjectId(int projectId)
        {
            Project requestedProject = null;

            Data.Project requestedDbProject = (from p in _appInfo.GcContext.Projects
                                               where p.ProjectID == projectId
                                               select p).FirstOrDefault();

            if (requestedDbProject != null)
            {
                requestedProject = Project.CreateProject(requestedDbProject);
            }

            return(requestedProject);
        }
Beispiel #20
0
        protected override void DataPortal_DeleteSelf()
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Project
                {
                    ProjectId = this.ReadProperty(ProjectIdProperty)
                };

                ctx.ObjectContext.Projects.DeleteObject(data);

                ctx.ObjectContext.SaveChanges();
            }
        }
Beispiel #21
0
        private ItemAnalytics Analyze(string path, Data.Project project)
        {
            ItemAnalytics a;

            if (!Items.TryGetValue(path, out a))
            {
                a = new ItemAnalytics();
                Items.Add(path, a);
            }
            if (a.Analyzed)
            {
                return(a);
            }
            a.Analyzed = true;

            Data.SourceFile sf = project.Files[path];
            foreach (string include in sf.AbsoluteIncludes)
            {
                if (include == path)
                {
                    continue;
                }

                bool is_tu = Data.SourceFile.IsTranslationUnitPath(path);

                ItemAnalytics ai = Analyze(include, project);
                a.AllIncludes.Add(include);
                ai.AllIncludedBy.Add(path);
                if (is_tu)
                {
                    ai.TranslationUnitsIncludedBy.Add(path);
                }


                a.AllIncludes.UnionWith(ai.AllIncludes);
                foreach (string inc in ai.AllIncludes)
                {
                    Items[inc].AllIncludedBy.Add(path);
                    if (is_tu)
                    {
                        Items[inc].TranslationUnitsIncludedBy.Add(path);
                    }
                }
            }

            a.TotalIncludeLines = a.AllIncludes.Sum(f => project.Files[f].Lines);
            return(a);
        }
Beispiel #22
0
        public static Project CreateProject(Data.Project dbProject)
        {
            Data.Goal parentGoal = (from pt in dbProject.Goals
                                          select pt).FirstOrDefault();

            return new Project
            {
                ProjectId = dbProject.ProjectID,
                Title = dbProject.Title,
                CreatedDate = dbProject.CreatedDate,
                CompletedDate = dbProject.CompletedDate,
                EstimatedCost = dbProject.EstimatedCost,
                StatusId = dbProject.StatusID,
                ParentGoal = parentGoal == null ? null : Goal.CreateGoal(parentGoal)
            };
        }
Beispiel #23
0
        public async Task <ActionResult <ProjectResponse> > PostProject(DTO.Project input)
        {
            var project = new Data.Project
            {
                Title            = input.Title,
                Description      = input.Description,
                ProjectManagerId = input.ProjectManagerId
            };

            _db.Projects.Add(project);
            await _db.SaveChangesAsync();

            var result = project.MapProjectResponse();

            return(CreatedAtAction(nameof(GetProject),
                                   new { id = result.Id }, result));
        }
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Project = await _context.Project.FindAsync(id);

            if (Project != null)
            {
                _context.Project.Remove(Project);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Beispiel #25
0
        /// <summary>
        /// Gets the name of the booking.
        /// </summary>
        /// <returns></returns>
        private string GetBookingName()
        {
            Data.Booking booking = GetBL <InventoryBL>().GetBooking(BookingId);
            RelatedTableName = booking.RelatedTable;
            RelatedId        = booking.RelatedId;

            if (RelatedTableName == GlobalConstants.RelatedTables.Bookings.Project)
            {
                Data.Project project = GetBL <ProjectBL>().GetProject(RelatedId);
                return(project.ProjectName);
            }
            else
            {
                Data.NonProjectBooking nonProjectBooking = GetBL <InventoryBL>().GetNonProjectBooking(BookingId);
                return(nonProjectBooking.Name);
            }
        }
Beispiel #26
0
        /// <summary>
        /// Handles the ItemCommand event of the gvProjects control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridCommandEventArgs"/> instance containing the event data.</param>
        protected void gvProjects_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (!StopProcessing)
            {
                if (e.Item is GridDataItem)
                {
                    //Pay now for this project
                    GridDataItem dataItem  = (GridDataItem)e.Item;
                    int          projectId = (int)dataItem.GetDataKeyValue("ProjectId");
                    Data.Project project   = DataContext.Projects.Where(p => p.ProjectId == projectId).SingleOrDefault();

                    switch (e.CommandName)
                    {
                    case "Suspend":
                        popupSuspendReActivate.Title      = "Confirm Suspend";
                        divMsgSuspendReActivate.InnerText = "When you suspend a Project, it will become read-only for all users. " +
                                                            "This means you will not be able to add or edit any information, but you will still be able to view all " +
                                                            "elements of your Project. Suspended Projects are not included in your active Project count.";
                        popupSuspendReActivate.ShowPopup();
                        btnSuspendReActivate.CommandArgument = projectId.ToString();
                        break;

                    case "ReActivate":
                        sbPackageLimitsValidation.ProjectId = projectId;
                        if (sbPackageLimitsValidation.Validate())
                        {
                            //When ReActiving, we need to consider Free trial projects.
                            int prevoiusStatusCodeId = ProjectStatusHandler.GetPreviuosProjectStatusFromHistory(projectId);

                            popupSuspendReActivate.Title      = "Confirm Reactivate";
                            divMsgSuspendReActivate.InnerText = "When you reactivate a Project, all users will have the same access to the Project " +
                                                                "that they had before it was suspended. The Project will also be included in the active Project count.";
                            popupSuspendReActivate.ShowPopup();
                            btnSuspendReActivate.CommandArgument = projectId.ToString();

                            if (prevoiusStatusCodeId == Utils.GetCodeByValue("ProjectStatus", "FREETRIAL").CodeId)
                            {
                                freeTrialCodeId    = Support.GetCodeByValue("ProjectStatus", "FREETRIAL").CodeId;
                                UserOptInProjectId = projectId;
                            }
                        }
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Places the specified project into the db.
        /// If the project is already in the repository, an
        /// exception is thrown.
        /// </summary>
        public int AddProject(Project project)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            Data.Project dbProject = new Data.Project();
            int          nextId;

            if (AppInfo.Instance.GcContext.Projects.Count() == 0)
            {
                nextId = 1;
            }
            else
            {
                nextId = AppInfo.Instance.GcContext.Projects.Max(p => p.ProjectID) + 1;
            }

            dbProject.ProjectID     = nextId;
            dbProject.StatusID      = project.StatusId;
            dbProject.CreatedDate   = project.CreatedDate;
            dbProject.CompletedDate = project.CompletedDate;
            dbProject.Title         = project.Title;
            dbProject.EstimatedCost = project.EstimatedCost;
            if (project.ParentGoal != null)
            {
                dbProject.Goals.Add((from g in _appInfo.GcContext.Goals
                                     where g.GoalID == project.ParentGoal.GoalId
                                     select g).FirstOrDefault());
            }


            _appInfo.GcContext.AddToProjects(dbProject);
            _appInfo.GcContext.SaveChanges();

            project.ProjectId = dbProject.ProjectID;

            if (this.ProjectAdded != null)
            {
                this.ProjectAdded(this, new ProjectAddedEventArgs(project));
            }

            return(dbProject.ProjectID);
        }
Beispiel #28
0
        public static Task CreateTask(Data.Task dbTask)
        {
            Data.Project parentProject = (from pt in dbTask.Projects
                                          select pt).FirstOrDefault();

            return(new Task
            {
                TaskId = dbTask.TaskID,
                StatusId = dbTask.StatusID,
                PriorityId = dbTask.PriorityID,
                IsActive = dbTask.IsActive,
                CreatedDate = dbTask.CreatedDate,
                CompletedDate = dbTask.CompletedDate,
                Title = dbTask.Title,
                SortOrder = dbTask.SortOrder,
                ParentProject = parentProject == null ? null : Project.CreateProject(parentProject)
            });
        }
        /// <summary>
        /// Updates the all projects cached query results when a project is added
        /// </summary>
        void AllProjectsOnProjectAdded(object sender, ProjectAddedEventArgs e)
        {
            QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.AllProjectsCacheItem);

            if (cachedQuery != null)
            {
                // add the added item to the cached query results
                List <Data.Project> allProjects  = (List <Data.Project>)cachedQuery.Value;
                Data.Project        addedProject = _appInfo.GcContext.Projects.FirstOrDefault(p => p.ProjectID == e.NewProject.ProjectId);
                if (addedProject != null)
                {
                    allProjects.Add(addedProject);
                    // sort the query results according to the sort column
                    allProjects = SortList(allProjects);
                    _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.AllProjectsCacheItem, allProjects);
                }
            }
        }
Beispiel #30
0
        protected override void DataPortal_Insert()
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Project();

                this.Insert(data);

                ctx.ObjectContext.AddToProjects(data);

                ctx.ObjectContext.SaveChanges();

                this.LoadProperty(ProjectIdProperty, data.ProjectId);
                this.LoadProperty(CreatedByProperty, data.CreatedBy);
                this.LoadProperty(CreatedDateProperty, data.CreatedDate);
            }
        }
Beispiel #31
0
 public Project(string connectionString)
 {
     ctx = new BTSSContext(connectionString);
     project = new BTSS.Data.Project(connectionString);
 }