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


C# ISession类代码示例

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


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

示例1: Execute

        public void Execute(ISession session, long taskId, DateTime sentDate)
        {
            bool closeSession = false;
            if (session == null)
            {
                session = _businessSafeSessionManager.Session;
                closeSession = true;
            }

            var systemUser = session.Load<UserForAuditing>(SystemUser.Id);

            var taskDueTomorrowEscalation = new EscalationTaskDueTomorrow()
            {
                TaskId = taskId,
                TaskDueTomorrowEmailSentDate = sentDate,
                CreatedBy = systemUser,
                CreatedOn = DateTime.Now
            };
            session.Save(taskDueTomorrowEscalation);

            //Log4NetHelper.Log.Debug("Saved EscalationTaskDueTomorrow sent indicator");

            if (closeSession)
            {
                session.Close();
            }
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:27,代码来源:TaskDueTomorrowEmailSentCommand.cs

示例2: CreatePurchaseRCV

        public static RCVHead CreatePurchaseRCV(ISession session, int userId, string poNumber, string note)
        {
            RCVHead head = new RCVHead();
            head._refOrderType = head._originalOrderType = POHead.ORDER_TYPE;
            head._refOrderNumber = head._orginalOrderNumber = poNumber.Trim().ToUpper();
            #region ���
            //��ʱ������ɹ��ջ����������òɹ������ķ�ʽ
            if (string.IsNullOrEmpty(head._refOrderNumber))
                throw new Exception("�ɹ�����Ϊ��");
            POHead po = POHead.Retrieve(session, head._refOrderNumber);
            if (po == null)
                throw new Exception(string.Format("�ɹ�����{0}������", head._refOrderNumber));
            if (po.Status != POStatus.Release)
                throw new Exception(string.Format("�ɹ�����{0}���Ƿ���״̬�������Խ����ջ���ҵ", head._refOrderNumber));
            if (po.ApproveResult != ApproveStatus.Approve)
                throw new Exception(string.Format("�ɹ�����{0}��û�����ǩ�ˣ������Խ����ջ���ҵ", head._refOrderNumber));
            #endregion
            head._orderTypeCode = RCVHead.ORD_TYPE_PUR;
            head._orderNumber = ERPUtil.NextOrderNumber(head._orderTypeCode);
            head._objectID = po.VendorID;
            head._locationCode = po.LocationCode;
            head._createUser = userId;
            head._note = note.Trim();
            EntityManager.Create(session, head);

            return head;
        }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:27,代码来源:RCVHeadImpl.cs

示例3: RecreateDb

 public void RecreateDb(ISession session)
 {
     InitSessionFactory();
     var sessionSource = new SessionSource(_fluentConfiguration);
     sessionSource.BuildSchema(session);
     session.Flush();
 }
开发者ID:saitodisse,项目名称:aspnet-webapi-knockout-restfull,代码行数:7,代码来源:NhCastle.cs

示例4: HandleEvent

 public void HandleEvent(EggIncubatorStatusEvent evt, ISession session)
 {
     Logger.Write(evt.WasAddedNow
         ? session.Translation.GetTranslation(TranslationString.IncubatorPuttingEgg, evt.KmRemaining)
         : session.Translation.GetTranslation(TranslationString.IncubatorStatusUpdate, evt.KmRemaining),
         LogLevel.Egg);
 }
开发者ID:Roywaller,项目名称:NecroBot,代码行数:7,代码来源:ConsoleEventListener.cs

示例5: IsExistsCode

        private void IsExistsCode(ISession session, Storehouse sh)
        {
            ICriteria criteria = session.CreateCriteria(typeof(Storehouse));

            ICriterion criterion = null;
            if (sh.Id != Guid.Empty)
            {
                criterion = Restrictions.Not(Restrictions.IdEq(sh.Id));
                criteria.Add(criterion);
            }

            criterion = Restrictions.Eq("StoreCode", sh.StoreCode);
            criteria.Add(criterion);
            //统计
            criteria.SetProjection(
                Projections.ProjectionList()
                .Add(Projections.Count("Id"))
                );

            int count = (int)criteria.UniqueResult();
            if (count > 0)
            {
                throw new EasyJob.Tools.Exceptions.StorehouseCodeIsExistsException();//库存Code已经存在
            }
        }
开发者ID:iEasyJob,项目名称:EasyJob,代码行数:25,代码来源:StorehouseController.cs

示例6: ChangeCommitted

        internal static bool ChangeCommitted(this ISessionPersistentObject al,CRUD Operation, IImportContext iic,  ISession session)
        {
            if (al == null)
                throw new Exception("Algo Error");

            bool needtoregister = false;

            IObjectStateCycle oa = al;

            switch (Operation)
            {
                case CRUD.Created:
                    needtoregister = true;
                    session.Save(al);
                    break;

                case CRUD.Update:
                    session.Update(al);         
                    oa.HasBeenUpdated();
                    break;

                case CRUD.Delete:
                    session.Delete(al);
                    oa.SetInternalState(ObjectState.Removed,iic);
                    break;
            }

            al.Context = null;

            return needtoregister;
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:31,代码来源:ISessionObjectExtension.cs

示例7: Set

 public void Set(ISession value)
 {
     if (value != null)
     {
         HttpContext.Current.Items.Add("NhbSession", value);
     }
 }
开发者ID:276398084,项目名称:KW.OrderManagerSystem,代码行数:7,代码来源:HttpSessionStorage.cs

示例8: Store

 public void Store(ISession session)
 {
     if (_nhSessions.Contains(GetThreadName()))
         _nhSessions[GetThreadName()] = session;
     else
         _nhSessions.Add(GetThreadName(), session);
 }
开发者ID:Defcoq,项目名称:Enterprise.Dev.Best.Practices,代码行数:7,代码来源:ThreadSessionStorageContainer.cs

示例9: session_MessageToUser

 void session_MessageToUser(ISession sender, SessionEventArgs e)
 {
     this.ParentForm.BeginInvoke(new MethodInvoker(delegate()
         {
             CF_displayMessage(e.Message);
         }));
 }
开发者ID:fotiDim,项目名称:spotify-for-centrafuse,代码行数:7,代码来源:Spotify.Session.cs

示例10: SessionAccess

        public SessionAccess(ISession session)
        {
            if (session == null)
                throw new ArgumentNullException("session");

            this.session = session;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:SessionAccess.cs

示例11: EmployeeRepository

        public EmployeeRepository(ISession session)
        {
            if (session == null)
                throw new ArgumentNullException("session");

                this.session = session;
        }
开发者ID:pjmagee,项目名称:DemoExercise,代码行数:7,代码来源:EmployeeRepository.cs

示例12: getExistingOrNewSession

        private ISession getExistingOrNewSession(NHibernate.ISessionFactory factory)
        {
            if (HttpContext.Current != null)
            {
                ISession session = GetExistingWebSession();
                if (session == null)
                {
                    session = openSessionAndAddToContext(factory);
                }
                else if (!session.IsOpen)
                {
                    session = openSessionAndAddToContext(factory);
                }

                return session;
            }

            if (currentSession == null)
            {
                currentSession = factory.OpenSession();
            }
            else if (!currentSession.IsOpen)
            {
                currentSession = factory.OpenSession();
            }

            return currentSession;
        }
开发者ID:TimBarcz,项目名称:groop,代码行数:28,代码来源:HybridSessionBuilder.cs

示例13: RegionRepository

 public RegionRepository(ISession session)
 {
     DataTable table;
     _ds = new DataSet("Province");
     DataSet p = session.CreateObjectQuery("select PRV_ID as Province_ID,PRV_CODE as \"Code\",PRV_NAME as \"Name\",PRV_ALIAS as \"Alias\" from Province")
         .Attach(typeof(Province))
         .DataSet();
     table = p.Tables[0];
     table.TableName = "p";
     table.Constraints.Add("PK_p", table.Columns["Province_ID"], true);
     p.Tables.Clear();
     _ds.Tables.Add(table);
     DataSet c = session.CreateObjectQuery("select PRV_ID as Province_ID,CITY_ID as City_ID,CITY_CODE as City_Code,CITY_NAME as \"Name\" from City")
         .Attach(typeof(City))
         .DataSet();
     table = c.Tables[0];
     table.TableName = "c";
     table.Constraints.Add("PK_c", table.Columns["City_ID"], true);
     c.Tables.Clear();
     _ds.Tables.Add(table);
     DataSet d = session.CreateObjectQuery("select CITY_ID as City_ID,DST_ID as District_ID,DST_NAME as \"Name\",DST_ZIPCODE as Zip_Code,DST_SHIP_TO as Door2Door from District")
         .Attach(typeof(District))
         .DataSet();
     table = d.Tables[0];
     table.TableName = "d";
     table.Constraints.Add("PK_d", table.Columns["District_ID"], true);
     d.Tables.Clear();
     _ds.Tables.Add(table);
 }
开发者ID:XtremeKevinChow,项目名称:rdroad,代码行数:29,代码来源:RegionRepository.cs

示例14: GetAllICQInfo

        /// <summary>
        /// Requests a full set of information about an ICQ account
        /// </summary>
        /// <param name="sess">A <see cref="ISession"/> object</param>
        /// <param name="screenname">The account for which to retrieve information</param>
        public static void GetAllICQInfo(ISession sess, string screenname)
        {
            if (!ScreennameVerifier.IsValidICQ(screenname))
            {
                throw new ArgumentException(screenname + " is not a valid ICQ screenname", "screenname");
            }

            SNACHeader sh = new SNACHeader();
            sh.FamilyServiceID = (ushort) SNACFamily.ICQExtensionsService;
            sh.FamilySubtypeID = (ushort) ICQExtensionsService.MetaInformationRequest;
            sh.Flags = 0x0000;
            sh.RequestID = Session.GetNextRequestID();

            ByteStream stream = new ByteStream();
            stream.WriteUshort(0x0001);
            stream.WriteUshort(0x000A);
            stream.WriteUshort(0x0008);
            stream.WriteUint(uint.Parse(sess.ScreenName));
            stream.WriteUshortLE(0x07D0);
            stream.WriteUshortLE((ushort) sh.RequestID);
            stream.WriteUshort(0x04B2);
            stream.WriteUint(uint.Parse(screenname));

            SNACFunctions.BuildFLAP(Marshal.BuildDataPacket(sess, sh, stream));
        }
开发者ID:pkt30,项目名称:OscarLib,代码行数:30,代码来源:SNAC15.cs

示例15: turnOnStatistics

 private static bool turnOnStatistics(ISession session)
 {
     var onOff = session.SessionFactory.Statistics.IsStatisticsEnabled;
     session.SessionFactory.Statistics.IsStatisticsEnabled = true;
     session.SessionFactory.Statistics.Clear();
     return onOff;
 }
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:7,代码来源:Fixture.cs


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