本文整理汇总了C#中IUnitOfWork.GetById方法的典型用法代码示例。如果您正苦于以下问题:C# IUnitOfWork.GetById方法的具体用法?C# IUnitOfWork.GetById怎么用?C# IUnitOfWork.GetById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUnitOfWork
的用法示例。
在下文中一共展示了IUnitOfWork.GetById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrganizationByPaymentType
public static Organization GetOrganizationByPaymentType(IUnitOfWork uow, PaymentType paymentType)
{
string organizationParameter="";
switch (paymentType) {
case PaymentType.cash:
organizationParameter = CashOrganization;
break;
case PaymentType.cashless:
organizationParameter = CashlessOrganization;
break;
case PaymentType.barter:
organizationParameter = CashlessOrganization;
break;
}
if (MainSupport.BaseParameters.All.ContainsKey (organizationParameter)) {
int id = -1;
id = int.Parse (MainSupport.BaseParameters.All [organizationParameter]);
if (id == -1)
return null;
return uow.GetById<Organization> (id);
}
return null;
}
示例2: GetMyUser
public static User GetMyUser(IUnitOfWork uow)
{
return uow.GetById<User> (QSProjectsLib.QSMain.User.Id);
}
示例3: UpdateReturnedOperations
public virtual void UpdateReturnedOperations(IUnitOfWork uow, Dictionary<int, decimal> returnedNomenclatures)
{
foreach(var returned in returnedNomenclatures)
{
var item = ReturnedItems.FirstOrDefault(x => x.Nomenclature.Id == returned.Key);
if(item == null && returned.Value != 0)
{
item = new SelfDeliveryDocumentReturned()
{
Amount = returned.Value,
Document = this,
Nomenclature = uow.GetById<Nomenclature>(returned.Key)
};
item.CreateOperation(Warehouse, TimeStamp);
ReturnedItems.Add(item);
}
else if(item != null && returned.Value == 0)
{
ReturnedItems.Remove(item);
}
else if(item != null && returned.Value != 0)
{
item.Amount = returned.Value;
item.UpdateOperation(Warehouse);
}
}
}
示例4: FillFromRouteList
public virtual void FillFromRouteList(IUnitOfWork uow, bool warehouseOnly)
{
ObservableItems.Clear();
if (RouteList == null || (Warehouse == null && warehouseOnly))
return;
var goods = Repository.Logistics.RouteListRepository.GetGoodsInRLWithoutEquipments(uow,
RouteList, warehouseOnly ? Warehouse : null);
var nomenclatures = uow.GetById<Nomenclature>(goods.Select(x => x.NomenclatureId).ToArray());
foreach(var inRoute in goods)
{
ObservableItems.Add(new CarLoadDocumentItem(){
Document = this,
Nomenclature = nomenclatures.First(x => x.Id == inRoute.NomenclatureId),
AmountInRouteList = inRoute.Amount,
Amount = inRoute.Amount
});
}
var equipmentsInRoute = Repository.Logistics.RouteListRepository.GetEquipmentsInRL(uow,
RouteList, warehouseOnly ? Warehouse : null);
nomenclatures = uow.GetById<Nomenclature>(equipmentsInRoute.Select(x => x.NomenclatureId).ToArray());
var equipments = uow.GetById<Equipment>(equipmentsInRoute.Select(x => x.EquipmentId).ToArray());
foreach(var inRoute in equipmentsInRoute)
{
ObservableItems.Add(new CarLoadDocumentItem(){
Document = this,
Nomenclature = nomenclatures.First(x => x.Id == inRoute.NomenclatureId),
Equipment = equipments.First(x => x.Id == inRoute.EquipmentId),
AmountInRouteList = 1,
Amount = 1
});
}
}
示例5: UpdateItemsFromStock
public virtual void UpdateItemsFromStock(IUnitOfWork uow)
{
var inStock = Repository.StockRepository.NomenclatureInStock(uow, Warehouse.Id, TimeStamp);
foreach(var itemInStock in inStock)
{
var item = Items.FirstOrDefault(x => x.Nomenclature.Id == itemInStock.Key);
if (item != null)
item.AmountInDB = itemInStock.Value;
else
{
ObservableItems.Add(
new InventoryDocumentItem()
{
Nomenclature = uow.GetById<Nomenclature>(itemInStock.Key),
AmountInDB = itemInStock.Value,
AmountInFact = 0,
Document = this
});
}
}
foreach(var item in Items)
{
if (!inStock.ContainsKey(item.Nomenclature.Id))
item.AmountInDB = 0;
}
}
示例6: FillItemsFromStock
public virtual void FillItemsFromStock(IUnitOfWork uow)
{
var inStock = Repository.StockRepository.NomenclatureInStock(uow, Warehouse.Id);
if (inStock.Count == 0)
return;
var nomenclatures = uow.GetById<Nomenclature>(inStock.Select(p => p.Key).ToArray());
ObservableItems.Clear();
foreach(var itemInStock in inStock)
{
ObservableItems.Add(
new InventoryDocumentItem(){
Nomenclature = nomenclatures.First(x => x.Id == itemInStock.Key),
AmountInDB = itemInStock.Value,
AmountInFact = 0,
Document = this
}
);
}
}