本文整理汇总了C#中IItemService.GetObjectById方法的典型用法代码示例。如果您正苦于以下问题:C# IItemService.GetObjectById方法的具体用法?C# IItemService.GetObjectById怎么用?C# IItemService.GetObjectById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IItemService
的用法示例。
在下文中一共展示了IItemService.GetObjectById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateObject
public Maintenance CreateObject(Maintenance maintenance, IItemService _itemService, IItemTypeService _itemTypeService,
IUserService _userService, ICustomerService _customerService)
{
maintenance.Errors = new Dictionary<String, String>();
if (_validator.ValidCreateObject(maintenance, _itemService, _itemTypeService, _userService, _customerService))
{
Item item = _itemService.GetObjectById(maintenance.ItemId);
maintenance.ItemTypeId = item.ItemTypeId;
return _repository.CreateObject(maintenance);
}
else
{
return maintenance;
}
}
示例2: VHasItemTypeByItem
public Maintenance VHasItemTypeByItem(Maintenance maintenance, IItemService _itemService, IItemTypeService _itemTypeService)
{
Item item = _itemService.GetObjectById(maintenance.ItemId);
ItemType itemType = _itemTypeService.GetObjectById(item.ItemTypeId);
if (itemType == null)
{
maintenance.Errors.Add("ItemType", "Tidak boleh tidak ada");
}
return maintenance;
}
示例3: VHasItem
public Maintenance VHasItem(Maintenance maintenance, IItemService _itemService, ICustomerService _customerService)
{
Item item = _itemService.GetObjectById(maintenance.ItemId);
if (item == null)
{
maintenance.Errors.Add("Item", "Tidak boleh tidak ada");
}
Customer customer = _customerService.GetObjectById(item.CustomerId);
if (customer == null)
{
maintenance.Errors.Add("Customer", "Tidak boleh tidak ada");
}
if (customer.Id != maintenance.CustomerId)
{
maintenance.Errors.Add("CustomerId", "Tidak boleh berbeda dengan customerId dari item");
}
return maintenance;
}
示例4: VUpdateTypeIdHasMaintenance
public Item VUpdateTypeIdHasMaintenance(Item item, IItemService _itemService, IMaintenanceService _maintenanceService)
{
IList<Maintenance> maintenances = _maintenanceService.GetObjectsByItemId(item.Id);
if (maintenances.Any())
{
Item databaseitem = _itemService.GetObjectById(item.Id);
if (databaseitem.Id == item.Id && databaseitem.ItemTypeId != item.ItemTypeId)
{
item.Errors.Add("ItemTypeId", "Tidak boleh diubah jika terasosiasi dengan maintenance");
}
}
return item;
}
示例5: VUpdateCustomer
public Item VUpdateCustomer(Item item, IItemService _itemService)
{
Item databaseitem = _itemService.GetObjectById(item.Id);
if (databaseitem.Id == item.Id && databaseitem.CustomerId != item.CustomerId)
{
item.Errors.Add("ItemId", "Tidak boleh diubah");
}
return item;
}