本文整理汇总了C#中Session类的典型用法代码示例。如果您正苦于以下问题:C# Session类的具体用法?C# Session怎么用?C# Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Session类属于命名空间,在下文中一共展示了Session类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CustomDialog
public CustomDialog(Session session)
: base(session)
{
InitializeComponent();
LoadResources();
}
开发者ID:Eun,项目名称:WixSharp,代码行数:7,代码来源:CustomDialog.cs
示例2: MongoQueryExplainsExecutionPlansForFlyweightQueries
public void MongoQueryExplainsExecutionPlansForFlyweightQueries()
{
using (var session = new Session())
{
session.Drop<TestProduct>();
session.DB.GetCollection<TestProduct>().CreateIndex(p => p.Supplier.Name, "TestIndex", true, IndexOption.Ascending);
session.Add(new TestProduct
{
Name = "ExplainProduct",
Price = 10,
Supplier = new Supplier { Name = "Supplier", CreatedOn = DateTime.Now }
});
// To see this manually you can run the following command in Mongo.exe against
//the Product collection db.Product.ensureIndex({"Supplier.Name":1})
// Then you can run this command to see a detailed explain plan
// db.Product.find({"Supplier.Name":"abc"})
// The following query is the same as running: db.Product.find({"Supplier.Name":"abc"}).explain()
var query = new Expando();
query["Supplier.Name"] = Q.Equals("Supplier");
var result = session.DB.GetCollection<TestProduct>().Explain(query);
Assert.Equal("BtreeCursor TestIndex", result.Cursor);
}
}
开发者ID:JornWildt,项目名称:NoRM,代码行数:30,代码来源:MongoOptimizationTests.cs
示例3: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName != "Download")
return;
using (ISession session = new Session())
{
DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
DateTime endDate = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));
int count = 0;
DataSet ds = Report.SaleByCategoryStat(session, startDate, endDate, -1, 0, false, ref count);
string fileName = DownloadUtil.DownloadXls("Sale_ByCat_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYCAT_",
new List<DownloadFormat>()
{
new DownloadFormat(DataType.Text, "产品类别", "CatName"),
new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
new DownloadFormat(DataType.Number, "总采购", "PurQty"),
new DownloadFormat(DataType.Number, "销售率(%)", "SaleRate"),
new DownloadFormat(DataType.Number, "换货量", "ExcgQty"),
new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate"),
new DownloadFormat(DataType.Number, "退货量", "RtnQty"),
new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate")
}, ds);
this.frameDownload.Attributes["src"] = fileName;
}
WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
}
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:29,代码来源:SaleByCategoryStat.aspx.cs
示例4: TestAlreadyLoggedOn
public async void TestAlreadyLoggedOn()
{
var session = new Session(BasicServerConnectionMock);
await session.LogOn(BasicAuthenticationMock);
Assert.IsNotNull(session.UserInfo);
await AssertEx.ThrowsAsync<InvalidOperationException>(async () => await session.LogOn(BasicAuthenticationMock));
}
开发者ID:alexguo88,项目名称:Kfstorm.DoubanFM.Core,代码行数:7,代码来源:SessionTests.cs
示例5: GetClassInfo
private XPClassInfo GetClassInfo(Session session, string assemblyQualifiedName, IEnumerable<Type> persistentTypes) {
Type classType = persistentTypes.Where(type => type.FullName == assemblyQualifiedName).SingleOrDefault();
if (classType != null) {
return session.GetClassInfo(classType);
}
return null;
}
开发者ID:aries544,项目名称:eXpand,代码行数:7,代码来源:XpoObjectMerger.cs
示例6: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Delete")
{
bool deleted = false;
using (ISession session = new Session())
{
session.BeginTransaction();
try
{
foreach (RepeaterItem item in this.rptVendor.Items)
{
HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox;
if (chk != null && chk.Checked)
{
int mid = Cast.Int(chk.Attributes["mid"]), lid = Cast.Int(chk.Attributes["lid"]);
deleted = deleted || RestrictLogis2Member.Delete(session, lid, mid) > 0;
}
}
session.Commit();
if (deleted)
QueryAndBindData(session, magicPagerMain.CurrentPageIndex, magicPagerMain.PageSize, true);
}
catch (Exception ex)
{
session.Rollback();
WebUtil.ShowError(this, ex);
}
}
}
}
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:31,代码来源:RestrictLogis2MemberManager.aspx.cs
示例7: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName != "Download")
return;
using (ISession session = new Session())
{
DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
DateTime endDate = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));
int count = 0;
DataSet ds = Report.SaleBySKUStat(session, startDate, endDate, this.txtItemCode.Text, Cast.Enum<Report_SaleByCode_OrderBy>(this.drpSort.SelectedValue), this.chkIncludeNoSale.Checked, -1, 0, false, ref count);
string fileName = DownloadUtil.DownloadXls("Sale_BySKU_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYSKU_",
new List<DownloadFormat>()
{
new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
new DownloadFormat(DataType.Text, "名称", "ItemName"),
new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
new DownloadFormat(DataType.Number, "总采购", "PurQty"),
new DownloadFormat(DataType.Number, "销售率(%)", "SaleRate"),
new DownloadFormat(DataType.Number, "换货量", "ExcgQty"),
new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate"),
new DownloadFormat(DataType.Number, "退货量", "RtnQty"),
new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate"),
new DownloadFormat(DataType.Number, "现有库存", "StoQty")
}, ds);
this.frameDownload.Attributes["src"] = fileName;
}
WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
}
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:33,代码来源:SaleBySKUStat.aspx.cs
示例8: MagicItemCommand
protected void MagicItemCommand(object sender, MagicItemEventArgs e)
{
if (e.CommandName == "Delete")
{
try
{
using (ISession session = new Session())
{
session.BeginTransaction();
try
{
for (int i = 0; i < this.rptSDHead.Items.Count; i++)
{
System.Web.UI.HtmlControls.HtmlInputCheckBox objCheckBox = this.rptSDHead.Items[i].FindControl("checkbox") as System.Web.UI.HtmlControls.HtmlInputCheckBox;
if (objCheckBox.Checked)
INVCheckHead.Delete(session, objCheckBox.Attributes["value"].Trim());
}
session.Commit();
QueryAndBindData(session, 1, this.magicPagerMain.PageSize, true);
}
catch (Exception ex)
{
session.Rollback();
throw ex;
}
}
}
catch (Exception ex)
{
WebUtil.ShowError(this, "ɾ��ʧ��,�������Ա��ϵ!\r\nʧ����Ϣ:" + ex.Message);
return;
}
}
}
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:34,代码来源:InventoryCheckManage.aspx.cs
示例9: Load
public void Load(IServiceProvider serviceProvider)
{
try
{
s_traceContext = (ITraceContext)serviceProvider.GetService(typeof(ITraceContext));
//must have the icelib sdk license to get the session as a service
s_session = (Session)serviceProvider.GetService(typeof(Session));
s_connection = new Connection.Connection(s_session);
}
catch (ArgumentNullException)
{
s_traceContext.Error("unable to get Icelib Session, is the ICELIB SDK License available?");
Debug.Fail("unable to get service. Is the ICELIB SDK licence available?");
throw;
}
s_interactionManager = new InteractionManager(s_session, (IQueueService)serviceProvider.GetService(typeof(IQueueService)), s_traceContext);
s_statusManager = new CicStatusService(s_session, s_traceContext);
s_notificationService = (INotificationService)serviceProvider.GetService(typeof(INotificationService));
s_settingsManager = new SettingsManager();
s_deviceManager = new DeviceManager(s_traceContext, new SpokesDebugLogger(s_traceContext));
s_statusChanger = new StatusChanger(s_session, s_statusManager, s_deviceManager, s_settingsManager);
s_notificationServer = new NotificationServer(s_deviceManager, s_settingsManager, s_notificationService);
s_hookSwitchManager = new InteractionSyncManager(s_interactionManager, s_deviceManager, (IQueueService)serviceProvider.GetService(typeof(IQueueService)), s_traceContext, s_connection);
s_outboundEventNotificationService = new OutboundEventNotificationService(s_session, s_statusManager, s_deviceManager, s_traceContext);
s_traceContext.Always("Plantronics AddIn Loaded");
}
开发者ID:gildas,项目名称:Plantronics,代码行数:33,代码来源:AddIn.cs
示例10: RunAsAdminInstall
public static ActionResult RunAsAdminInstall(Session session)
{
MessageBox.Show("RunAsAdminInstall", "Embedded Managed CA");
session.Log("Begin RunAsAdminInstall Hello World");
return ActionResult.Success;
}
开发者ID:Eun,项目名称:WixSharp,代码行数:7,代码来源:setup.cs
示例11: Handle
public void Handle(Session Session, String data)
{
SFDataPacket Packet = new SFDataPacket(new string[] { "L", "1", "0", "0", "0" });
byte[] InitDisplay = Encoding.Default.GetBytes(Encoders.DecryptMsg(Packet.create_message(), false) + "\0");
Session.Sock.NoDelay = true;
Session.Sock.Send(InitDisplay);
}
开发者ID:CL2BU,项目名称:WickedSrv,代码行数:7,代码来源:LogoutMessageEvent.cs
示例12: MyCheckSql
public static ActionResult MyCheckSql(Session session)
{
MessageBox.Show("MyCheckSql", "Embedded Managed CA");
session.Log("Begin MyCheckSql Hello World");
return ActionResult.Success;
}
开发者ID:Eun,项目名称:WixSharp,代码行数:7,代码来源:setup.cs
示例13: MyAdminAction
public static ActionResult MyAdminAction(Session session)
{
MessageBox.Show("Hello World!!!!!!!!!!!", "Embedded Managed CA (Admin)");
session.Log("Begin MyAdminAction Hello World");
return ActionResult.Success;
}
开发者ID:Eun,项目名称:WixSharp,代码行数:7,代码来源:setup.cs
示例14: CompareVersionAtUpgrade
public static ActionResult CompareVersionAtUpgrade(Session session)
{
MessageBox.Show("CompareVersionAtUpgrade", "Embedded Managed CA");
session.Log("Begin CompareVersionAtUpgrade Hello World");
return ActionResult.Success;
}
开发者ID:Eun,项目名称:WixSharp,代码行数:7,代码来源:setup.cs
示例15: GetClassTypeFilter
public static CriteriaOperator GetClassTypeFilter(this Type type, Session session) {
XPClassInfo xpClassInfo = session.GetClassInfo(type);
XPObjectType xpObjectType = session.GetObjectType(xpClassInfo);
return XPObject.Fields.ObjectType.IsNull() |
XPObject.Fields.ObjectType == new OperandValue(xpObjectType.Oid);
}
开发者ID:noxe,项目名称:eXpand,代码行数:7,代码来源:CriteriaOperatorExtensions.cs
示例16: ConnectShouldThrowProxyExceptionWhenHttpProxyResponseDoesNotContainStatusLine
public void ConnectShouldThrowProxyExceptionWhenHttpProxyResponseDoesNotContainStatusLine()
{
var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
using (var proxyStub = new HttpProxyStub(proxyEndPoint))
{
proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Whatever\r\n"));
proxyStub.Start();
using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
{
try
{
session.Connect();
Assert.Fail();
}
catch (ProxyException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("HTTP response does not contain status line.", ex.Message);
}
}
}
}
开发者ID:delfinof,项目名称:ssh.net,代码行数:25,代码来源:SessionTest.HttpProxy.cs
示例17: ShowColorDropDown
public static void ShowColorDropDown(DropDownButtonWidget color, Session.Client client,
OrderManager orderManager, ColorPickerPaletteModifier preview)
{
Action<ColorRamp> onSelect = c =>
{
if (client.Bot == null)
{
Game.Settings.Player.ColorRamp = c;
Game.Settings.Save();
}
color.RemovePanel();
orderManager.IssueOrder(Order.Command("color {0} {1}".F(client.Index, c)));
};
Action<ColorRamp> onChange = c => preview.Ramp = c;
var colorChooser = Game.LoadWidget(orderManager.world, "COLOR_CHOOSER", null, new WidgetArgs()
{
{ "onSelect", onSelect },
{ "onChange", onChange },
{ "initialRamp", client.ColorRamp }
});
color.AttachPanel(colorChooser);
}
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:26,代码来源:LobbyUtils.cs
示例18: ConnectShouldThrowProxyExceptionWhenHttpProxyReturnsHttpStatusOtherThan200
public void ConnectShouldThrowProxyExceptionWhenHttpProxyReturnsHttpStatusOtherThan200()
{
var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
using (var proxyStub = new HttpProxyStub(proxyEndPoint))
{
proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
proxyStub.Start();
using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
{
try
{
session.Connect();
Assert.Fail();
}
catch (ProxyException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("HTTP: Status code 501, \"Custom\"", ex.Message);
}
}
}
}
开发者ID:delfinof,项目名称:ssh.net,代码行数:25,代码来源:SessionTest.HttpProxy.cs
示例19: Close
public static void Close(RCVHead head)
{
try
{
using (ISession session = new Session())
{
try
{
session.BeginTransaction();
head.Close(session, false);
session.Commit();
}
catch (Exception er1)
{
session.Rollback();
log.Error(string.Format("�ջ���{0}ǩ����ɣ��Զ��ر�ʱ�����쳣", head.OrderNumber), er1);
return;
}
}
}
catch (Exception er)
{
log.Error(string.Format("�ջ���{0}ǩ����ɣ��Զ��ر�ʱ�����쳣�����������ݿ�", head.OrderNumber), er);
return;
}
}
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:26,代码来源:RCVHeadImpl.cs
示例20: ConnectShouldSkipHeadersWhenHttpProxyReturnsHttpStatus200
public void ConnectShouldSkipHeadersWhenHttpProxyReturnsHttpStatus200()
{
var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
using (var proxyStub = new HttpProxyStub(proxyEndPoint))
{
proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 200 OK\r\n"));
proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Content-Type: application/octet-stream\r\n"));
proxyStub.Responses.Add(Encoding.ASCII.GetBytes("\r\n"));
proxyStub.Responses.Add(Encoding.ASCII.GetBytes("SSH-666-SshStub"));
proxyStub.Start();
using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
{
try
{
session.Connect();
Assert.Fail();
}
catch (SshConnectionException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("Server version '666' is not supported.", ex.Message);
}
}
}
}
开发者ID:delfinof,项目名称:ssh.net,代码行数:28,代码来源:SessionTest.HttpProxy.cs
注:本文中的Session类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论