///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5WA_GWAFT_1201_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5WA_GWAFT_1201_Array functionReturn = new FR_L5WA_GWAFT_1201_Array();

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

                functionReturn = Execute(Connection, Transaction, 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 { }

                throw new Exception("Exception occured in method cls_Get_WorkAreas_For_Tenant", ex);
            }
            return(functionReturn);
        }
        protected static FR_L5WA_GWAFT_1201_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L5WA_GWAFT_1201_Array();
            ORM_CMN_STR_PPS_WorkArea.Query workareaQuery = new ORM_CMN_STR_PPS_WorkArea.Query();
            workareaQuery.IsDeleted    = false;
            workareaQuery.Tenant_RefID = securityTicket.TenantID;
            List <ORM_CMN_STR_PPS_WorkArea> workareaResult     = ORM_CMN_STR_PPS_WorkArea.Query.Search(Connection, Transaction, workareaQuery);
            List <L5WA_GWAFT_1201>          workareaResultList = new List <L5WA_GWAFT_1201>();
            foreach (var workarea in workareaResult)
            {
                L5WA_GWAFT_1201 result = new L5WA_GWAFT_1201();

                ORM_CMN_STR_PPS_WorkArea item = new ORM_CMN_STR_PPS_WorkArea();
                var resultWorkplace           = item.Load(Connection, Transaction, workarea.CMN_STR_PPS_WorkAreaID);
                if (resultWorkplace.Status != FR_Status.Success || item.CMN_STR_PPS_WorkAreaID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(null);
                }

                result.CMN_CAL_CalendarInstance_RefID   = item.CMN_CAL_CalendarInstance_RefID;
                result.CMN_BPT_STA_SettingProfile_RefID = item.CMN_BPT_STA_SettingProfile_RefID;
                result.Office_RefID             = item.Office_RefID;
                result.Parent_RefID             = item.Parent_RefID;
                result.WorkAreaName             = item.Name;
                result.WorkAreaDescription      = item.Description;
                result.ShortName                = item.ShortName;
                result.CMN_STR_PPS_WorkAreaID   = item.CMN_STR_PPS_WorkAreaID;
                result.Default_StartWorkingHour = item.Default_StartWorkingHour;



                ORM_CMN_STR_PPS_WorkArea_2_CostCenter.Query workareaToCostcenterQuery = new ORM_CMN_STR_PPS_WorkArea_2_CostCenter.Query();
                workareaToCostcenterQuery.WorkArea_RefID = workarea.CMN_STR_PPS_WorkAreaID;
                workareaToCostcenterQuery.Tenant_RefID   = securityTicket.TenantID;
                workareaToCostcenterQuery.IsDeleted      = false;
                List <ORM_CMN_STR_PPS_WorkArea_2_CostCenter> workareaToCostcenterList = ORM_CMN_STR_PPS_WorkArea_2_CostCenter.Query.Search(Connection, Transaction, workareaToCostcenterQuery);
                if (workareaToCostcenterList.Count != 0)
                {
                    L5WA_GWAFT_1201_Costcenter costCenter     = new L5WA_GWAFT_1201_Costcenter();
                    ORM_CMN_STR_CostCenter     costCenterItem = new ORM_CMN_STR_CostCenter();
                    costCenterItem.Load(Connection, Transaction, workareaToCostcenterList[0].CostCenter_RefID);
                    if (!costCenterItem.IsDeleted)
                    {
                        costCenter.AssignmentID         = workareaToCostcenterList[0].AssignmentID;
                        costCenter.CMN_STR_CostCenterID = workareaToCostcenterList[0].CostCenter_RefID;
                        costCenter.CostcenterName       = costCenterItem.Name;
                        costCenter.InternalID           = costCenterItem.InternalID;
                        result.Costcenter = costCenter;
                    }
                }


                var responsiblePersonsQuery = new ORM_CMN_STR_PPS_WorkArea_ResponsiblePerson.Query();
                responsiblePersonsQuery.Tenant_RefID   = securityTicket.TenantID;
                responsiblePersonsQuery.WorkArea_RefID = item.CMN_STR_PPS_WorkAreaID;
                responsiblePersonsQuery.IsDeleted      = false;
                var responsiblePersonsList = ORM_CMN_STR_PPS_WorkArea_ResponsiblePerson.Query.Search(Connection, Transaction, responsiblePersonsQuery);
                List <L5WA_GWAFT_1201_ResponsiblePersons> responsiblePresonsResultList = new List <L5WA_GWAFT_1201_ResponsiblePersons>();
                foreach (var responsiblePerson in responsiblePersonsList)
                {
                    L5WA_GWAFT_1201_ResponsiblePersons responsiblePersonResult = new L5WA_GWAFT_1201_ResponsiblePersons();
                    responsiblePersonResult.CMN_BPT_EMP_EmployeeID = responsiblePerson.CMN_BPT_EMP_Employee_RefID;
                    responsiblePersonResult.CMN_STR_PPS_WorkArea_ResponsiblePersonID = responsiblePerson.CMN_STR_PPS_WorkArea_ResponsiblePersonID;

                    ORM_CMN_BPT_EMP_Employee employee = new ORM_CMN_BPT_EMP_Employee();
                    employee.Load(Connection, Transaction, responsiblePerson.CMN_BPT_EMP_Employee_RefID);

                    ORM_CMN_BPT_BusinessParticipant bParticipant = new ORM_CMN_BPT_BusinessParticipant();
                    bParticipant.Load(Connection, Transaction, employee.BusinessParticipant_RefID);

                    ORM_CMN_PER_PersonInfo person = new ORM_CMN_PER_PersonInfo();
                    person.Load(Connection, Transaction, bParticipant.IfNaturalPerson_CMN_PER_PersonInfo_RefID);

                    responsiblePersonResult.CMN_BPT_BusinessParticipantID = bParticipant.CMN_BPT_BusinessParticipantID;
                    responsiblePersonResult.FirstName            = person.FirstName;
                    responsiblePersonResult.LastName             = person.LastName;
                    responsiblePersonResult.CMN_PER_PersonInfoID = person.CMN_PER_PersonInfoID;
                    responsiblePersonResult.WorkArea_RefID       = item.CMN_STR_PPS_WorkAreaID;

                    responsiblePresonsResultList.Add(responsiblePersonResult);
                }

                result.ResponsiblePersons = responsiblePresonsResultList.ToArray();
                workareaResultList.Add(result);
            }
            returnValue.Result = workareaResultList.ToArray();

            //Put your code here
            return(returnValue);

            #endregion UserCode
        }