Наследование: System.Data.Objects.DataClasses.EntityObject
Пример #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProjects(Project project)
 {
     base.AddObject("Projects", project);
 }
Пример #2
0
 /// <summary>
 /// Create a new Project object.
 /// </summary>
 /// <param name="projectId">Initial value of the ProjectId property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 /// <param name="isArchived">Initial value of the IsArchived property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Project CreateProject(global::System.Int32 projectId, global::System.String description, global::System.Boolean isActive, global::System.Boolean isArchived, global::System.String name, global::System.Int32 createdBy, global::System.DateTime createdDate, global::System.Int32 modifiedBy, global::System.DateTime modifiedDate)
 {
     Project project = new Project();
     project.ProjectId = projectId;
     project.Description = description;
     project.IsActive = isActive;
     project.IsArchived = isArchived;
     project.Name = name;
     project.CreatedBy = createdBy;
     project.CreatedDate = createdDate;
     project.ModifiedBy = modifiedBy;
     project.ModifiedDate = modifiedDate;
     return project;
 }
Пример #3
0
        public ProjectData Insert(ProjectData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                           .GetManager(Database.ApplicationConnection, false))
            {
                var project = new Project();

                DataMapper.Map(data, project);

                ctx.ObjectContext.AddToProjects(project);

                ctx.ObjectContext.SaveChanges();

                data.ProjectId = project.ProjectId;

                return data;
            }
        }
Пример #4
0
        private void Fetch(Project project, ProjectData projectData)
        {
            DataMapper.Map(project, projectData);

            projectData.CreatedByUser = new UserData();
            DataMapper.Map(project.CreatedByUser, projectData.CreatedByUser);

            projectData.ModifiedByUser = new UserData();
            DataMapper.Map(project.ModifiedByUser, projectData.ModifiedByUser);
        }
Пример #5
0
        public ProjectData Update(ProjectData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                         .GetManager(Database.ApplicationConnection, false))
            {
                var project =
                    new Project
                    {
                        ProjectId = data.ProjectId
                    };

                ctx.ObjectContext.Projects.Attach(project);

                DataMapper.Map(data, project);

                ctx.ObjectContext.SaveChanges();

                return data;
            }
        }
Пример #6
0
 internal static void Map(ProjectData source, Project destination)
 {
     destination.ProjectId = source.ProjectId;
     destination.Name = source.Name;
     destination.Description = source.Description;
     destination.IsArchived = source.IsArchived;
     destination.IsActive = source.IsActive;
     destination.ModifiedBy = source.ModifiedBy;
     destination.ModifiedDate = source.ModifiedDate;
     destination.CreatedBy = source.CreatedBy;
     destination.CreatedDate = source.CreatedDate;
 }