示例#1
0
 private void Fetch(ProjectTracker.Dal.RoleDto data)
 {
     using (BypassPropertyChecks)
     {
         Id        = data.Id;
         Name      = data.Name;
         TimeStamp = data.LastChanged;
     }
 }
示例#2
0
 public void Update(RoleDto item)
 {
   var data = (from r in MockDb.Roles
              where r.Id == item.Id
              select r).FirstOrDefault();
   if (data == null)
     throw new DataNotFoundException("Role");
   data.Name = item.Name;
   data.LastChanged = MockDb.GetTimeStamp();
 }
示例#3
0
 private void Insert([Inject] IRoleDal dal)
 {
     using (BypassPropertyChecks)
     {
         var item = new ProjectTracker.Dal.RoleDto
         {
             Name = this.Name
         };
         dal.Insert(item);
         Id        = item.Id;
         TimeStamp = item.LastChanged;
     }
 }
示例#4
0
文件: RoleDal.cs 项目: Jaans/csla
 public void Insert(RoleDto item)
 {
   using (var ctx = ObjectContextManager<PTrackerEntities>.GetManager("PTrackerEntities"))
   {
     var newItem = new Role 
     { 
       Name = item.Name
     };
     ctx.ObjectContext.AddToRoles(newItem);
     ctx.ObjectContext.SaveChanges();
     item.Id = newItem.Id;
     item.LastChanged = newItem.LastChanged;
   }
 }
示例#5
0
 private void Update([Inject] IRoleDal dal)
 {
     using (BypassPropertyChecks)
     {
         var item = new ProjectTracker.Dal.RoleDto
         {
             Id          = this.Id,
             Name        = this.Name,
             LastChanged = this.TimeStamp
         };
         dal.Update(item);
         Id        = item.Id;
         TimeStamp = item.LastChanged;
     }
 }
示例#6
0
文件: RoleDal.cs 项目: Jaans/csla
    public void Update(RoleDto item)
    {
      using (var ctx = ObjectContextManager<PTrackerEntities>.GetManager("PTrackerEntities"))
      {
        var data = (from r in ctx.ObjectContext.Roles
                    where r.Id == item.Id
                    select r).FirstOrDefault();
        if (data == null)
          throw new DataNotFoundException("Role");
        if (!data.LastChanged.Matches(item.LastChanged))
          throw new ConcurrencyException("Role");

        data.Name = item.Name;
        var count = ctx.ObjectContext.SaveChanges();
        if (count == 0)
          throw new UpdateFailureException("Role");
        item.LastChanged = data.LastChanged;
      }
    }
示例#7
0
 public void Insert(RoleDto item)
 {
   item.Id = MockDb.Roles.Max(c => c.Id) + 1;
   var newItem = new RoleData { Id = item.Id, Name = item.Name, LastChanged = MockDb.GetTimeStamp() };
   MockDb.Roles.Add(newItem);
 }