Beispiel #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (m_currentUser.Privileges.Equals(UserModel.UserPrivileges.ADMIN))
            {
                if (monthCalendar1.SelectionEnd.Date <= monthCalendar2.SelectionEnd.Date)
                {
                    ProjectUser  user1    = new ProjectUser();
                    ProjectModel project1 = new ProjectModel();
                    project1.Name        = textBox1.Text;
                    project1.Description = textBox2.Text;
                    project1.Active      = true;

                    ActivityModel activity = new ActivityModel();
                    activity.Name          = textBox3.Text;
                    activity.Description   = textBox4.Text;
                    activity.PlannedStart  = monthCalendar1.SelectionEnd;
                    activity.PlannedFinish = monthCalendar2.SelectionEnd;

                    project1.Activities.Add(activity);
                    project1.Persist();
                    project1.Activities[0].AssignUser(m_currentUser.Id);
                    project1.AssignUser(m_currentUser, pmsys_sim_engine.models.Role.LEAD);
                    System.Windows.Forms.MessageBox.Show("Project correctly created");
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("End date can not be prior to Start date");
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Just the admin can create projects");
            }
        }
Beispiel #2
0
        public void PersistProject()
        {
            UserModel user = new UserModel();

            user.Name       = "admin";
            user.Pswd       = "admin";
            user.Privileges = UserModel.UserPrivileges.ADMIN;
            user.Id         = user.Persist();


            ProjectModel project = new ProjectModel();

            project.Name        = "projectName";
            project.Description = "description";
            project.Active      = true;

            ActivityModel activity = new ActivityModel();

            activity.Name          = "name";
            activity.Description   = "desc";
            activity.PlannedStart  = new DateTime();
            activity.PlannedFinish = new DateTime();
            activity.ActualStart   = new DateTime();
            activity.ActualFinish  = new DateTime();

            project.Activities.Add(activity);
            project.Persist();

            project.AssignUser(user, Role.LEAD);

            project.Activities[0].AssignUser(user.Id);

            project.Activities[0].UpdateProgress(user.Id, 100, "finish");

            //project.Activities[0].RemoveUser(user.Id);
        }