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

            FR_L5BR_GBMFTID_1537 functionReturn = new FR_L5BR_GBMFTID_1537();

            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_BreakModels_For_TemplateID", ex);
            }
            return(functionReturn);
        }
コード例 #2
0
        protected static FR_L5BR_GBMFTID_1537 Execute(DbConnection Connection, DbTransaction Transaction, P_L5BR_GBMFTID_1537 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var             returnValue = new FR_L5BR_GBMFTID_1537();
            L5BR_GBMFT_1503 breakModel  = new L5BR_GBMFT_1503();

            ORM_CMN_PPS_BreakTime_Template breakTimeTemplate = new ORM_CMN_PPS_BreakTime_Template();
            breakTimeTemplate.Load(Connection, Transaction, Parameter.CMN_PPS_BreakTime_TemplateID);
            breakModel.BreakTimeTemplate_Name_DictID = breakTimeTemplate.BreakTimeTemplate_Name;
            breakModel.CMN_PPS_BreakTime_TemplateID  = breakTimeTemplate.CMN_PPS_BreakTime_TemplateID;

            int duration = 0;
            ORM_CMN_PPS_BreakTime_Template_Assignment.Query breakeTimeAssigmentQuery = new ORM_CMN_PPS_BreakTime_Template_Assignment.Query();
            breakeTimeAssigmentQuery.IsDeleted                = false;
            breakeTimeAssigmentQuery.Tenant_RefID             = securityTicket.TenantID;
            breakeTimeAssigmentQuery.BreakTime_Template_RefID = breakTimeTemplate.CMN_PPS_BreakTime_TemplateID;
            List <ORM_CMN_PPS_BreakTime_Template_Assignment> breakTimeAssignemnts = ORM_CMN_PPS_BreakTime_Template_Assignment.Query.Search(Connection, Transaction, breakeTimeAssigmentQuery);
            foreach (var assignment in breakTimeAssignemnts)
            {
                ORM_CMN_PPS_BreakTime breakeTime = new ORM_CMN_PPS_BreakTime();
                breakeTime.Load(Connection, Transaction, assignment.BreakTime_RefID);
                if (breakeTime.IsBreakfastBreak)
                {
                    breakModel.BreakfestDuration = breakeTime.Default_Duration_in_sec;
                }
                else if (breakeTime.IsDinnerBreak)
                {
                    breakModel.DinnerDuration = breakeTime.Default_Duration_in_sec;
                }
                else if (breakeTime.IsLunchBreak)
                {
                    breakModel.LunchDuration = breakeTime.Default_Duration_in_sec;
                }
                else
                {
                    duration += breakeTime.Default_Duration_in_sec;
                }
            }
            breakModel.Duration        = duration;
            breakModel.Office_RefID    = breakTimeTemplate.BoundTo_Office_RefID;
            breakModel.Workarea_RefID  = breakTimeTemplate.BoundTo_Workarea_RefID;
            breakModel.Workplace_RefID = breakTimeTemplate.BoundTo_Workplace_RefID;


            returnValue.Result            = new L5BR_GBMFTID_1537();
            returnValue.Result.BreakModel = breakModel;

            //Put your code here
            return(returnValue);

            #endregion UserCode
        }