当前位置: 首页>>代码示例>>C#>>正文


C# Session类代码示例

本文整理汇总了C#中Session的典型用法代码示例。如果您正苦于以下问题:C# Session类的具体用法?C# Session怎么用?C# Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Session类属于命名空间,在下文中一共展示了Session类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Session类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。