本文整理汇总了C#中Session.FindObject方法的典型用法代码示例。如果您正苦于以下问题:C# Session.FindObject方法的具体用法?C# Session.FindObject怎么用?C# Session.FindObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session.FindObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnLoad_Click
private void btnLoad_Click(object sender, EventArgs e)
{
session = new Session();
ProdOrder prodOrder;
txtProdOrderNo.Text = txtProdOrderNo.Text.Trim().ToUpper();
prodOrder = session.FindObject<ProdOrder>(new BinaryOperator("OrderNo", txtProdOrderNo.Text));
if (prodOrder == null)
{
XtraMessageBox.Show(string.Format("找不到此生产单号 {0} !!", txtProdOrderNo.Text));
clear();
return;
}
txtItemNo.Text = prodOrder.Item.ItemNo;
txtItemName.Text = prodOrder.Item.ItemName;
txtItemType.Text = prodOrder.Item.ItemType.ItemTypeName;
txtStartQty.Text = prodOrder.StartQty.ToString();
txtFinishQty.Text = prodOrder.FinishQty.ToString();
txtWipQty.Text = prodOrder.WipQty.ToString();
prodBomReturns = this.GetProdBomReturnIList(prodOrder);
gridProdOrderReturList.DataSource = prodBomReturns;
XPCollection<WareHouse> wareHouses = new XPCollection<WareHouse>(session);
lookupWarehouse.DataSource = wareHouses;
lookupWarehouse.ValueMember = "This";
lookupWarehouse.DisplayMember = "WarehouseName";
btnPost.Enabled = true;
}
示例2: FindIdentityValue
int FindIdentityValue(QueryParameterCollection queryParameterCollection, SimpleDataLayer simpleDataLayer) {
using (var session = new Session(simpleDataLayer) { IdentityMapBehavior = IdentityMapBehavior.Strong }) {
var typeName = queryParameterCollection[0].Value.ToString();
var assemblyName = queryParameterCollection[1].Value.ToString();
return session.FindObject<XPObjectType>(type => type.TypeName == typeName && type.AssemblyName == assemblyName).Oid;
}
}
示例3: GetNextValue
public static int GetNextValue(IDataLayer dataLayer, string sequencePrefix) {
if(dataLayer == null)
throw new ArgumentNullException("dataLayer");
if(sequencePrefix == null)
sequencePrefix = string.Empty;
int attempt = 1;
while(true) {
try {
using(var generatorSession = new Session(dataLayer)) {
var generator =
generatorSession.FindObject<XpoSequencer>(new OperandProperty("SequencePrefix") ==sequencePrefix) ??
new XpoSequencer(generatorSession) {SequencePrefix = sequencePrefix};
generator.Counter++;
generator.Save();
return generator.Counter;
}
}
catch(LockingException) {
if(attempt >= MaxIdGenerationAttempts)
throw;
}
if(attempt > MaxIdGenerationAttempts / 2)
Thread.Sleep(new Random().Next(MinConflictDelay, MaxConflictDelay));
attempt++;
}
}
示例4: TypeExists
bool TypeExists(DataStoreManagerSimpleDataLayer dataLayer, InsertStatement stm1) {
if (dataLayer.IsMainLayer)
return false;
var session = new Session(dataLayer) { IdentityMapBehavior = IdentityMapBehavior.Strong };
var value = stm1.Parameters.ToList()[0].Value as string;
var xpObjectType = session.FindObject<XPObjectType>(type => type.TypeName == value);
return xpObjectType != null;
}
示例5: GetSetting
public static SystemSetting GetSetting(Session s)
{
if (_setting == null)
{
_setting = s.FindObject<SystemSetting>(null);
}
return _setting;
}
示例6: FindDefaultTemplate
public static ICodeTemplate FindDefaultTemplate(TemplateType templateType, Session session, Type codeTemplateType, CodeDomProvider codeDomProvider){
const ICodeTemplate template = null;
var binaryOperator = new BinaryOperator(template.GetPropertyName(x => x.TemplateType),templateType);
var isDefault = new BinaryOperator(template.GetPropertyName(x => x.IsDefault),true);
var provider = new BinaryOperator(template.GetPropertyName(x => x.CodeDomProvider),codeDomProvider);
return session.FindObject(PersistentCriteriaEvaluationBehavior.InTransaction,
codeTemplateType, new GroupOperator(binaryOperator, isDefault,provider))
as ICodeTemplate;
}
示例7: Find
public static IPersistentClassInfo Find(Session session, string referenceTypeFullName)
{
const IPersistentClassInfo persistentClassInfo = null;
string propertyName = persistentClassInfo.GetPropertyName(x => x.PersistentAssemblyInfo) + "." + persistentClassInfo.GetPropertyName(x => x.PersistentAssemblyInfo.Name);
var binaryOperator = new BinaryOperator(propertyName, referenceTypeFullName.Substring(0,referenceTypeFullName.IndexOf(".")));
var operands = new BinaryOperator(persistentClassInfo.GetPropertyName(x=>x.Name),referenceTypeFullName.Substring(referenceTypeFullName.IndexOf(".")+1));
return session.FindObject(PersistentCriteriaEvaluationBehavior.InTransaction, WCTypesInfo.Instance.FindBussinessObjectType<IPersistentClassInfo>(), new GroupOperator(binaryOperator, operands)) as IPersistentClassInfo;
}
示例8: GetAuditTrail
XPBaseCollection GetAuditTrail(Session session, XPBaseObject xpBaseObject, Type auditedObjectWeakReferenceType) {
var binaryOperator = new BinaryOperator("TargetType", session.GetObjectType(xpBaseObject));
var operands = new BinaryOperator("TargetKey", XPWeakReference.KeyToString(session.GetKeyValue(xpBaseObject)));
var auditObjectWR = (XPWeakReference) session.FindObject(auditedObjectWeakReferenceType,new GroupOperator(binaryOperator,operands));
if (auditObjectWR != null) {
var baseCollection = (XPBaseCollection) auditObjectWR.ClassInfo.GetMember("AuditDataItems").GetValue(auditObjectWR);
baseCollection.BindingBehavior = CollectionBindingBehavior.AllowNone;
return baseCollection;
}
return null;
}
示例9: GetInstance
public static Company GetInstance(Session session)
{
Company result = session.FindObject<Company>(null);
if (result == null)
{
result = new Company(session) { CompanyName = "My Company" };
result.Save();
}
return result;
}
示例10: GetAuditTrail
public static XPCollection<XpandAuditDataItemPersistent> GetAuditTrail(Session session, object obj){
var auditObjectWr = session.FindObject<XpandAuditedObjectWeakReference>(
new GroupOperator(
new BinaryOperator("TargetType", session.GetObjectType(obj)),
new BinaryOperator("TargetKey", KeyToString(session.GetKeyValue(obj)))
));
if (auditObjectWr != null){
auditObjectWr.AuditDataItems.BindingBehavior = CollectionBindingBehavior.AllowNone;
return auditObjectWr.AuditDataItems;
}
return null;
}
示例11: CalcProdOrderPs
private BindingList<ProdOrderP> CalcProdOrderPs(Session session)
{
UnitOfWork uow = (UnitOfWork)session;
Vendor vendor = session.FindObject<Vendor>(new BinaryOperator("No", "NWC"));
WareHouse defaultWH = session.FindObject<WareHouse>(CriteriaOperator.Parse("WarehouseName == 'KP'"));
XPClassInfo poLineClass;
CriteriaOperator criteria;
SortingCollection sortProps;
poLineClass = uow.GetClassInfo(typeof(PurchOrderLine));
criteria = CriteriaOperator.Parse(string.Format("Vendor.Oid = '{0}' AND OrderStatus = '{1}' ", vendor.Oid, PurchOrderLine.PurchOrderStatus.Active));
sortProps = new SortingCollection(null);
sortProps.Add(new SortProperty("NeedDate", SortingDirection.Descending));
ICollection poLines = uow.GetObjects(poLineClass, criteria, sortProps, int.MaxValue, false, true);
BindingList<ProdOrderP> ProdOrderPs = new BindingList<ProdOrderP>();
Dictionary<string, float> dictWHQty = new Dictionary<string, float>();
Dictionary<string, float> dictProdOrderQty;
dictProdOrderQty = GetDictProdOrderQty(uow);
// dictProdOrderQty.Add(WorkCenterNo-PartNo-Status)
foreach (PurchOrderLine poLine in poLines)
{
ProdOrderP pop = new ProdOrderP(uow);
pop.SetDefaultWH(defaultWH);
pop.SetPurchOrderLine(poLine);
pop.SetupRouteList();
pop.SetDictWH(dictWHQty);
pop.SetDictProdOrderQty(dictProdOrderQty);
pop.CalcNeed();
ProdOrderPs.Add(pop);
}
return ProdOrderPs;
}
示例12: GetInstance
public static ProdOrderSetting GetInstance(Session session)
{
ProdOrderSetting setting = session.FindObject<ProdOrderSetting>(null);
if (setting == null)
{
session.BeginTransaction();
setting = new ProdOrderSetting(session);
setting.Save();
session.CommitTransaction();
}
return setting;
}
示例13: GetInstance
public static ProdRouteListDateSetting GetInstance(Session session)
{
ProdRouteListDateSetting setting = session.FindObject<ProdRouteListDateSetting>(null);
if (setting == null)
{
session.BeginTransaction();
setting = new ProdRouteListDateSetting(session);
setting.LastReportDate = DateTime.Today.AddYears(-10);
setting.Save();
session.CommitTransaction();
}
return setting;
}
示例14: GetConfiguration
ISerializationConfiguration GetConfiguration(Session session, Type type) {
var serializationConfigurationType = TypesInfo.Instance.SerializationConfigurationType;
ISerializationConfiguration configuration;
var findObject = session.FindObject(PersistentCriteriaEvaluationBehavior.InTransaction, serializationConfigurationType,
SerializationConfigurationQuery.GetCriteria(type, _serializationConfigurationGroup));
if (findObject != null)
configuration = (ISerializationConfiguration)findObject;
else {
configuration =
(ISerializationConfiguration)ReflectionHelper.CreateObject(serializationConfigurationType, session);
configuration.SerializationConfigurationGroup = _serializationConfigurationGroup;
configuration.TypeToSerialize = type;
new ClassInfoGraphNodeBuilder().Generate(configuration);
}
return configuration;
}
示例15: GetContentByID
/// <summary>
/// 根据ID查询消费项目
/// </summary>
/// <param name="ContentID"></param>
/// <param name="DBSession"></param>
/// <returns></returns>
public t_Consume_Content GetContentByID(string ContentID, Session DBSession)
{
if (string.IsNullOrEmpty(ContentID))
{
return null;
}
// 查询条件
GroupOperator groupCriteria = new GroupOperator(
GroupOperatorType.And,
new BinaryOperator("State", 0, BinaryOperatorType.Equal),
new BinaryOperator("Content_ID", ContentID, BinaryOperatorType.Equal)
);
return DBSession.FindObject<t_Consume_Content>(groupCriteria);
}