本文整理汇总了C#中SessionScopeWrapper类的典型用法代码示例。如果您正苦于以下问题:C# SessionScopeWrapper类的具体用法?C# SessionScopeWrapper怎么用?C# SessionScopeWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionScopeWrapper类属于命名空间,在下文中一共展示了SessionScopeWrapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetPrimaryContactAddressStep
public static void GetPrimaryContactAddressStep( ICustevent custevent, out System.String result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper())
{
string sql = "select top 1 a.address1 from sysdba.opportunity_contact oc left join sysdba.contact c on oc.contactid=c.contactid left join sysdba.address a on a.entityid=c.contactid where oc.isprimary='T' and a.isprimary='T' and opportunityid='"+custevent.Id.ToString()+"'";
string add1 = session.CreateSQLQuery(sql).UniqueResult<string>();
sql = "select top 1 a.address2 from sysdba.opportunity_contact oc left join sysdba.contact c on oc.contactid=c.contactid left join sysdba.address a on a.entityid=c.contactid where oc.isprimary='T' and a.isprimary='T' and opportunityid='"+custevent.Id.ToString()+"'";
string add2 = session.CreateSQLQuery(sql).UniqueResult<string>();
sql = "select top 1 a.city from sysdba.opportunity_contact oc left join sysdba.contact c on oc.contactid=c.contactid left join sysdba.address a on a.entityid=c.contactid where oc.isprimary='T' and a.isprimary='T' and opportunityid='"+custevent.Id.ToString()+"'";
string city = session.CreateSQLQuery(sql).UniqueResult<string>();
sql = "select top 1 a.state from sysdba.opportunity_contact oc left join sysdba.contact c on oc.contactid=c.contactid left join sysdba.address a on a.entityid=c.contactid where oc.isprimary='T' and a.isprimary='T' and opportunityid='"+custevent.Id.ToString()+"'";
string state = session.CreateSQLQuery(sql).UniqueResult<string>();
sql = "select top 1 a.postalcode from sysdba.opportunity_contact oc left join sysdba.contact c on oc.contactid=c.contactid left join sysdba.address a on a.entityid=c.contactid where oc.isprimary='T' and a.isprimary='T' and opportunityid='"+custevent.Id.ToString()+"'";
string pcode = session.CreateSQLQuery(sql).UniqueResult<string>();
sql = "select top 1 a.country from sysdba.opportunity_contact oc left join sysdba.contact c on oc.contactid=c.contactid left join sysdba.address a on a.entityid=c.contactid where oc.isprimary='T' and a.isprimary='T' and opportunityid='"+custevent.Id.ToString()+"'";
string country = session.CreateSQLQuery(sql).UniqueResult<string>();
string fswon = string.Concat(add1," ",add2," ",city,", ",state," ",pcode," ",country);
result=fswon;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:27,代码来源:.4aef644b-2575-4265-a4d4-9e4aa92ed8d4.codesnippet.cs
示例2: RetrieveAuthenticationData
public static AuthenticationData RetrieveAuthenticationData(String providerName)
{
using (var sess = new SessionScopeWrapper())
{
var prov = sess.CreateQuery("from OAuthProvider where ProviderName=?")
.SetString(0, providerName)
.List<IOAuthProvider>().FirstOrDefault();
if (prov == null)
{
throw new Exception(String.Format("Unable to locate {0} provider in the configured OAuth providers", providerName));
}
var userToken = sess.CreateQuery("from UserOAuthToken where OAuthProvider.Id=? and User.Id=?")
.SetString(0, prov.Id.ToString())
.SetString(1, ApplicationContext.Current.Services.Get<IUserService>().UserId)
.List<IUserOAuthToken>()
.FirstOrDefault();
if (userToken == null || userToken.AccessToken == null)
{
throw new Exception(String.Format("Unable to locate authorization token for current user under {0} provider", providerName));
}
if (userToken.ExpirationDate != null && userToken.ExpirationDate < DateTime.Now)
{
// TODO: refresh, if possible?? (Not applicable to either Twitter or Linked in, though)
throw new Exception(String.Format("Authentication token for {0} provider has expired", providerName));
}
return new AuthenticationData
{
ConsumerKey = prov.ClientId,
ConsumerSecret = prov.Secret,
Token = userToken.AccessToken,
TokenSecret = userToken.AccessTokenSecret,
RefreshToken = userToken.RefreshToken
};
}
}
开发者ID:Saleslogix,项目名称:SLXSocial,代码行数:35,代码来源:AuthenticationData.cs
示例3: ReloadSalesOrderStep
public static void ReloadSalesOrderStep(IAddEditSalesOrder form, EventArgs args)
{
using (NHibernate.ISession session = new SessionScopeWrapper(false))
{
// forces NHibernate to reload the object
session.Refresh(form.CurrentEntity);
}
}
开发者ID:ssommerfeldt,项目名称:TAC_MAT,代码行数:8,代码来源:.0bab9df5-62c2-43e1-8d35-ebfaf85d0115.codesnippet.cs
示例4: GetMemberPhoneStep
public static void GetMemberPhoneStep( IMeetingTeam meetingteam, out System.String result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper())
{
string sql = "select phone from userinfo where userid='"+ meetingteam.UserID.ToString()+"'";
result=session.CreateSQLQuery(sql).UniqueResult<string>();
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:9,代码来源:.f079173c-44c3-44ad-988a-162546948e85.codesnippet.cs
示例5: GetFirstServiceWonStep
public static void GetFirstServiceWonStep(ICustfinancial custfinancial, out System.DateTime result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper()) {
string sql = "select min(actualclose) from opportunity_product where opportunityid='" + custfinancial.Id.ToString() + "'";
DateTime fswon = session.CreateSQLQuery(sql).UniqueResult<DateTime>();
result = fswon;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:9,代码来源:.ddc198ee-b1e1-461e-b386-34bdc17a7e81.codesnippet.cs
示例6: GetProductName
public static void GetProductName( IOrderSummaryDetail ordersummarydetail, out System.String result)
{
using (ISession session = new SessionScopeWrapper())
{
string sql = "select description from product where productid='"+ordersummarydetail.Productid.ToString()+"'";
string prodname = session.CreateSQLQuery(sql).UniqueResult<string>();
result=prodname;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:9,代码来源:.9fd59372-bc1e-4c20-a4c9-8019ea939fc1.codesnippet.cs
示例7: GetBusDevRepStep
public static void GetBusDevRepStep( ICustfinancial custfinancial, out System.String result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper()){
string sql = "select username from userinfo where userid=(select meetingmanager from accountconferon where accountid='"+custfinancial.Accountid+"')";
string fswon = session.CreateSQLQuery(sql).UniqueResult<string>();
result=fswon;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:9,代码来源:.114241c6-5039-47d9-8cad-c47a77a5e6ee.codesnippet.cs
示例8: GetTotalAnticRepBudgetStep
public static void GetTotalAnticRepBudgetStep( ICustfinancial custfinancial, out System.Decimal result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper()) {
string sql = "select sum(revenue) from order_summary_detail where ordertype='Anticipated' and opportunityid='" + custfinancial.Id.ToString() + "'";
decimal fswon = session.CreateSQLQuery(sql).UniqueResult<decimal>();
result = fswon;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:9,代码来源:.c4acbacc-2243-4250-ab17-b9babe70791e.codesnippet.cs
示例9: GetActualOrderRevStep
public static void GetActualOrderRevStep( IOrderSummaryDetail ordersummarydetail, out System.Decimal result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper()) {
string sql = "select revenue from order_summary_detail where ordertype='Actual' and order_summary_detailid='" + ordersummarydetail.Id.ToString() + "'";
decimal fswon = session.CreateSQLQuery(sql).UniqueResult<decimal>();
result = fswon;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:9,代码来源:.e3f1c4a7-9019-4574-b4d9-ac01ee5bf85a.codesnippet.cs
示例10: GetWonServiceRevStep
public static void GetWonServiceRevStep(ICustfinancial custfinancial, out System.Decimal result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper()) {
string sql = "select sum(extendedprice) from opportunity_product where status='Execution' and opportunityid='" + custfinancial.Id.ToString() + "'";
decimal fswon = session.CreateSQLQuery(sql).UniqueResult<decimal>();
result = fswon;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:9,代码来源:.018c5487-6a4d-4414-860a-b224726a4a3d.codesnippet.cs
示例11: Read
public IEnumerable<IRecord> Read()
{
using (var sess = new SessionScopeWrapper())
{
var qry = sess.CreateQuery(_query);
IList lst = qry.List();
foreach (object o in lst)
yield return new HqlRecordWrapper(o);
}
}
开发者ID:PmeyerSwiftpage,项目名称:NotificationEngine,代码行数:10,代码来源:HqlDataSource.cs
示例12: IsUserInTeam
/// <summary>
/// True if specified user is in specified team (or department).
/// Note that this will return true whether the user is a direct member of the team,
/// or manager of someone who is.
/// </summary>
/// <param name="userId"></param>
/// <param name="teamName"></param>
/// <returns></returns>
public static bool IsUserInTeam(String userId, String teamName)
{
using (var sess = new SessionScopeWrapper())
{
return 0 < sess.CreateQuery("select count(*) from OwnerRights sr where sr.User.Id=? and sr.Owner.OwnerDescription=?")
.SetString(0, userId)
.SetString(1, teamName)
.UniqueResult<long>();
}
}
开发者ID:valterbastianelli,项目名称:OpenSlx,代码行数:18,代码来源:SecUtils.cs
示例13: TestFormatOwner
public void TestFormatOwner()
{
String entityName = "Sage.SalesLogix.Entities.Contact";
using (var sess = new SessionScopeWrapper())
{
SessionFactoryImpl sf = (SessionFactoryImpl)sess.SessionFactory;
AbstractEntityPersister persister = (AbstractEntityPersister)(sf.GetEntityPersister(entityName));
Assert.AreEqual("Owner.OwnerDescription", SimpleLookup.DecomposePath(sf, persister, "SECCODEID", "8"));
}
}
开发者ID:valterbastianelli,项目名称:OpenSlx,代码行数:10,代码来源:TestSimpleLookup.cs
示例14: GetServiceNameStep
public static void GetServiceNameStep( ISalesOrderItem salesorderitem, out System.String result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper())
{
string sql = "select description from product where productid='"+salesorderitem.Product.Id+"'";
string prodname = session.CreateSQLQuery(sql).UniqueResult<string>();
result=prodname;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:10,代码来源:.6e6a9255-69e0-47e3-9342-31da4705511d.codesnippet.cs
示例15: GetPrimaryContactPhoneStep2
public static void GetPrimaryContactPhoneStep2( ICustevent custevent, out System.String result)
{
// TODO: Complete business rule implementation
using (ISession session = new SessionScopeWrapper())
{
string sql = "select top 1 c.workphone from sysdba.opportunity_contact oc left join sysdba.contact c on oc.contactid=c.contactid where oc.isprimary='T' and opportunityid='"+custevent.Id.ToString()+"'";
string fswon = session.CreateSQLQuery(sql).UniqueResult<string>();
result=fswon;
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:10,代码来源:.449b8e92-05c5-4cd9-ac83-a4ef9da646e4.codesnippet.cs
示例16: TestFormatUserName
public void TestFormatUserName()
{
String entityName = "Sage.SalesLogix.Entities.Contact";
using (var sess = new SessionScopeWrapper())
{
SessionFactoryImpl sf = (SessionFactoryImpl)sess.SessionFactory;
AbstractEntityPersister persister = (AbstractEntityPersister)(sf.GetEntityPersister(entityName));
Assert.AreEqual("AccountManager.UserInfo.UserName", SimpleLookup.DecomposePath(sf, persister, "ACCOUNTMANAGERID", "6"));
}
}
开发者ID:valterbastianelli,项目名称:OpenSlx,代码行数:10,代码来源:TestSimpleLookup.cs
示例17: LoadKeyColumns
public IList<OrmKeyColumn> LoadKeyColumns(string tableName)
{
Guard.ArgumentNotNullOrEmptyString(tableName, "tableName");
using (ISession session = new SessionScopeWrapper())
{
return session.CreateCriteria(typeof (OrmKeyColumn))
.Add(Expression.Eq("TableName", tableName))
.List<OrmKeyColumn>();
}
}
开发者ID:Saleslogix,项目名称:SLXMigration,代码行数:11,代码来源:OrmEntityLoaderService.cs
示例18: ValidateCommissionStep
public static void ValidateCommissionStep(IOpportunity opportunity, out Boolean result)
{
// TODO: Complete business rule implementation
result = false;
using (ISession session = new SessionScopeWrapper()) {
string strSQL = "select count(*) from salesorder where salescommission>0 and salescommission2>0 and accountid='"+opportunity.Account.Id.ToString()+"' and opportunityid='"+opportunity.Id.ToString()+"'";
int salesorder = session.CreateSQLQuery(strSQL).UniqueResult<int>();
if (salesorder > 0) {
result = true;
}
}
}
开发者ID:pebre77,项目名称:PrxS2,代码行数:12,代码来源:.2fb12515-4dda-400b-8382-43c028b43761.codesnippet.cs
示例19: Read
public IEnumerable<IRecord> Read(WorkItem workItem)
{
String query = String.Format("from {0} where {1}", _entity, workItem.EvaluateLiterals(_where, this));
using (var sess = new SessionScopeWrapper())
{
var qry = sess.CreateQuery(query);
IList lst = qry.List();
foreach (object o in lst)
yield return new EntityRecordWrapper(o);
}
}
开发者ID:nicocrm,项目名称:NotificationEngine,代码行数:12,代码来源:EntityDataSource.cs
示例20: TestDecomposePath
public void TestDecomposePath()
{
String entityName = "Sage.SalesLogix.Entities.Contact";
using (var sess = new SessionScopeWrapper())
{
SessionFactoryImpl sf = (SessionFactoryImpl)sess.SessionFactory;
AbstractEntityPersister persister = (AbstractEntityPersister)(sf.GetEntityPersister(entityName));
Assert.AreEqual("LastName", SimpleLookup.DecomposePath(sf, persister, "LASTNAME", "0"));
Assert.AreEqual("Address.PostalCode", SimpleLookup.DecomposePath(sf, persister, "ADDRESSID=ADDRESSID.ADDRESS!POSTALCODE", "0"));
Assert.AreEqual("AccountManager.UserInfo.UserName", SimpleLookup.DecomposePath(sf, persister, "ACCOUNTMANAGERID>USERID.USERINFO!USERNAME", "0"));
}
}
开发者ID:valterbastianelli,项目名称:OpenSlx,代码行数:12,代码来源:TestSimpleLookup.cs
注:本文中的SessionScopeWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论