本文整理汇总了C#中SessionScopeWrapper类的典型用法代码示例。如果您正苦于以下问题:C# SessionScopeWrapper类的具体用法?C# SessionScopeWrapper怎么用?C# SessionScopeWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionScopeWrapper类属于命名空间,在下文中一共展示了SessionScopeWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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
};
}
}
示例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);
}
}
示例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>();
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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>();
}
}
示例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"));
}
}
示例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;
}
}
示例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;
}
}