コード例 #1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5ST_GSTDFSTD_1426 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5ST_GSTDFSTD_1426 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5ST_GSTDFSTD_1426 functionReturn = new FR_L5ST_GSTDFSTD_1426();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                Guid errorID = Guid.NewGuid();
                ServerLog.Instance.Fatal("Application error occured. ErrorID = " + errorID, ex);
                throw new Exception("Exception occured in method cls_Get_ShiftTemplateDetail_For_ShiftTemplateDetailID", ex);
            }
            return(functionReturn);
        }
コード例 #2
0
        protected static FR_L5ST_GSTDFSTD_1426 Execute(DbConnection Connection, DbTransaction Transaction, P_L5ST_GSTDFSTD_1426 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5ST_GSTDFSTD_1426();
            returnValue.Result = new L5ST_GSTDFSTD_1426();
            returnValue.Result.ShiftTemplateDetail = new L5ST_GSTDFST_1402();

            var item = new ORM_CMN_PPS_ShiftTemplate_WorkDetail();
            item.Load(Connection, Transaction, Parameter.ShiftTemplateDetailID);
            returnValue.Result.ShiftTemplateDetail.CMN_PPS_ShiftTemplate_WorkDetailID = item.CMN_PPS_ShiftTemplate_WorkDetailID;
            returnValue.Result.ShiftTemplateDetail.Duration_in_sec         = item.Duration_in_sec;
            returnValue.Result.ShiftTemplateDetail.Required_StaffHeadCount = item.Required_StaffHeadCount;
            returnValue.Result.ShiftTemplateDetail.ShiftStart_Offset_sec   = item.ShiftStart_Offset_sec;
            returnValue.Result.ShiftTemplateDetail.WorkDetail_Note_Content = item.WorkDetail_Note_Content;
            returnValue.Result.ShiftTemplateDetail.WorkDetail_Note_Title   = item.WorkDetail_Note_Title;

            ORM_CMN_STR_PPS_WorkDetail_Activity.Query activityDetailQuery = new ORM_CMN_STR_PPS_WorkDetail_Activity.Query();
            activityDetailQuery.IsDeleted    = false;
            activityDetailQuery.Tenant_RefID = securityTicket.TenantID;
            activityDetailQuery.CMN_PPS_ShiftTemplate_WorkDetail_RefID = item.CMN_PPS_ShiftTemplate_WorkDetailID;
            List <ORM_CMN_STR_PPS_WorkDetail_Activity> activityDetails = ORM_CMN_STR_PPS_WorkDetail_Activity.Query.Search(Connection, Transaction, activityDetailQuery);
            if (activityDetails != null && activityDetails.Count != 0)
            {
                ORM_CMN_STR_PPS_WorkDetail_Activity activityDetail = activityDetails.FirstOrDefault();
                returnValue.Result.ShiftTemplateDetail.CMN_STR_PPS_Workplace_RefID = activityDetail.CMN_STR_PPS_Workplace_RefID;

                if (activityDetail.CMN_STR_PPS_Activity_RefID != Guid.Empty)
                {
                    ORM_CMN_STR_PPS_Activity activity = new ORM_CMN_STR_PPS_Activity();
                    activity.Load(Connection, Transaction, activityDetail.CMN_STR_PPS_Activity_RefID);
                    returnValue.Result.ShiftTemplateDetail.AbsenceReason_RefID = activity.AbsenceReason_RefID;
                }
            }
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }