Beispiel #1
0
 public object Create(BLL.Governor o)
 {
     var dto = _mapper.Map<BLL.Governor, Governor>(o);
     _db.AddToGovernors(dto);
     _db.SaveChanges();
     return o;
 }
 public int GetIndexOf(BLL.WorkCalendar o, FilterParameterCollection filters, SortParameterCollection orderBy)
 {
     var condition = new FilterParameterCollection();
     condition.Add("Date", o.Date);
     if (filters != null)
         filters.OperatorActionResolver = opResolver;
     return _db.Holidays.AddFilters(filters).AddOrders(orderBy).IndexOf(condition);
 }
Beispiel #3
0
        public int GetIndexOf(BLL.AssetValue o, FilterParameterCollection filters, SortParameterCollection orderBy)
        {
            orderBy.DefaultOrder = defaultSorting;
            orderBy.PropertyNameResolver = propResolver;
            if (filters != null)
                filters.PropertyNameResolver = propResolver;

            return _db.Assets.AddFilters(filters).AddOrders(orderBy).IndexOf(o.Id);
        }
Beispiel #4
0
 public void Update(BLL.Governor o)
 {
     var proxy = o as IDtoProxy;
     if (proxy != null)
     {
         _db.UpdateObject(proxy.Dto);
         _db.SaveChanges(System.Data.Services.Client.SaveChangesOptions.ReplaceOnUpdate);
     }
 }
Beispiel #5
0
 public void Delete(BLL.Governor o)
 {
     var proxy = o  as IDtoProxy;
     if (proxy != null)
     {
         _db.DeleteObject(proxy.Dto);
         _db.SaveChanges();
     }
 }
Beispiel #6
0
        public void Update(BLL.AssetValue o)
        {
            var proxy = o as IDtoProxy;
            
            if (proxy != null)
            {
                Guid govId = o.Governor.Id;
                var dto = proxy.Dto as AssetValue;

                if (govId != dto.GovernorId)
                {
                    dto.GovernorId = govId;
                    dto.Governor = _db.Governors.GetById(govId);
                    o.Governor = ProxyActivator.CreateProxy<Governor, BLL.Governor>(dto.Governor);
                    //_db.SetLink(dto, "Governor", gov);
                }
                
                _db.UpdateObject(dto);
                _db.SaveChanges(System.Data.Services.Client.SaveChangesOptions.ReplaceOnUpdate);
            }

            o.GovernorId = o.Governor.Id;
        }
Beispiel #7
0
 public object Create(BLL.AssetValue o)
 {
     var dto = _mapper.Map<BLL.AssetValue, AssetValue>(o);
     dto.GovernorId = o.Governor.Id;
     //dto.Governor = _db.Governors.GetById(dto.GovernorId);
     _db.AddToAssets(dto);
     _db.SaveChanges();
     return o;
 }
Beispiel #8
0
 public int GetIndexOf(BLL.Governor o, FilterParameterCollection filters, SortParameterCollection orderBy)
 {
     return _db.Governors.AddFilters(filters).AddOrders(orderBy).IndexOf(o.Id);
 }