示例#1
0
        public HrsLeaveResult Insert(BizAppFlowEntity bizapp)
        {
            IDbSession session = SessionFactory.CreateSession();

            try
            {
                var result = Repository.Insert <BizAppFlowEntity>(session.Connection, bizapp);
                if (result > 0)
                {
                    HrsLeaveResult.ResultIdentity = result;
                    return(HrsLeaveResult.Success);
                }
                else
                {
                    return(HrsLeaveResult.Failed(""));
                }
            }
            catch (System.Exception exception)
            {
                return(HrsLeaveResult.Failed(exception.Message));
            }
            finally
            {
                session.Dispose();
            }
        }
示例#2
0
        public HrsLeaveResult Insert(LeaveEntity leave)
        {
            IDbSession session = SessionFactory.CreateSession();

            try
            {
                leave.CreatedDate = System.DateTime.Now;
                session.BeginTrans();
                dynamic result = Repository.Insert <LeaveEntity>(session.Connection, leave, session.Transaction);
                session.Commit();


                if (result > 0)
                {
                    HrsLeaveResult.ResultIdentity = result;
                    return(HrsLeaveResult.Success);
                }
                else
                {
                    return(HrsLeaveResult.Failed(""));
                }
            }
            catch (System.Exception exception)
            {
                session.Rollback();
                return(HrsLeaveResult.Failed(exception.Message));
            }
            finally
            {
                session.Dispose();
            }
        }