Code: Select all
Exception Details: SoftPro.OrderTracking.Client.Lookups.AmbiguousLookupException: The ILookups.DisambiguateLookupRow event did not handle the situation where two lookups rows had the same key field and it was retrieved. at SoftPro.OrderTracking.Client.Lookups.ApplyLookupScope.LookupApplier.Retrieve(ITypeDescriptorContext context) at SoftPro.OrderTracking.Client.Lookups.ApplyLookupScope.LookupApplier.ExecuteInternal(ITypeDescriptorContext context) at SoftPro.OrderTracking.Client.Lookups.ApplyLookupScope.LookupApplier.Execute(EventHandler`1 disambiguateLookupRowGlobal, EventHandler`1 disambiguateLookupRowLocal, ITypeDescriptorContext context) at SoftPro.OrderTracking.Client.Lookups.ApplyLookupScope.ApplyInternal(ITypeDescriptorContext context) at SoftPro.OrderTracking.Client.Lookups.ApplyLookupScope.Apply(ITypeDescriptorContext context) at SoftPro.OrderTracking.Client.Orders.OrderBase`1.RootEntity_NestedPropertyChanged(Object sender, NestedPropertyChangedEventArgs e) at SoftPro.EntityModel.NestedPropertyChangedEventInstance.Fire() at SoftPro.EntityModel.EntityTransactionContext.<>c__DisplayClass26_0.b__0() at SoftPro.EntityModel.EntitySynchronizationContext.Invoke(Action action) at SoftPro.EntityModel.EntityTransactionContext.FireEvents() at SoftPro.EntityModel.EntityTransactionContext.Scope.Dispose() at SoftPro.OrderTracking.Client.Orders.OrderBase`1.SoftPro.OrderTracking.Client.Orders.IOrderPrivate.ApplyTemplate(IOrder source, OverlayAction action) at SoftPro.OrderTracking.Client.Orders.OrderBase`1.SoftPro.OrderTracking.Client.Orders.IOrder.ApplyTemplate(IOrder source)
Code: Select all
static private IOrder CreateNewOrder(SelectServer ss, IOrderStore os, List<string> tName, string baseNumber, SettlementType myST)
{
//Create an order number, and specify a template to overlay, as well as another order to overlay
OrderCreationSpec spec = new OrderCreationSpec();
spec.BaseNumber = baseNumber;
spec.SettlementType = myST;
IOrder order = null;
try
{
//set the specifications
order = os.NewOrder(spec);
//Save the order in the database.
os.ApplyChanges(order);
}
catch (Exception ex)
{
}
try
{
//apply the templates
foreach (string lonetName in tName)
{
List<IOrderInfo> search = os.Orders.Where(t => t.Number == lonetName).OrderBy(t => t.Number).ToList();
foreach (IOrderInfo mysearch in search)
{
using (IOrder template = os.OpenOrder(mysearch, OrderEditMode.ReadOnly))
{
order.ApplyTemplate(template);
os.ApplyChanges(order);
}
}
}
}
catch (Exception ex)
{
}
return order;
}