Exemple #1
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L5EM_CIEIM_1235 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();


            ORM_CMN_STR_Office_ResponsiblePerson.Query officeQuery = new ORM_CMN_STR_Office_ResponsiblePerson.Query();
            officeQuery.CMN_BPT_EMP_Employee_RefID = Parameter.EmployeeID;
            officeQuery.IsDeleted = false;
            if (ORM_CMN_STR_Office_ResponsiblePerson.Query.Exists(Connection, Transaction, officeQuery))
            {
                returnValue.Result = true;
            }

            ORM_CMN_STR_PPS_WorkArea_ResponsiblePerson.Query workAreaQuery = new ORM_CMN_STR_PPS_WorkArea_ResponsiblePerson.Query();
            workAreaQuery.CMN_BPT_EMP_Employee_RefID = Parameter.EmployeeID;
            workAreaQuery.IsDeleted = false;
            if (ORM_CMN_STR_PPS_WorkArea_ResponsiblePerson.Query.Exists(Connection, Transaction, workAreaQuery))
            {
                returnValue.Result = true;
            }

            ORM_CMN_STR_PPS_Workplace_ResponsiblePerson.Query workPlaceQuery = new ORM_CMN_STR_PPS_Workplace_ResponsiblePerson.Query();
            workPlaceQuery.CMN_BPT_EMP_Employee_RefID = Parameter.EmployeeID;
            workPlaceQuery.IsDeleted = false;
            if (ORM_CMN_STR_PPS_Workplace_ResponsiblePerson.Query.Exists(Connection, Transaction, workPlaceQuery))
            {
                returnValue.Result = true;
            }
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }
Exemple #2
0
        protected static FR_L5WA_GWAFWA_0907 Execute(DbConnection Connection, DbTransaction Transaction, P_L5WA_GWAFWA_0907 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5WA_GWAFWA_0907();
            returnValue.Result = new L5WA_GWAFWA_0907();

            L5WA_GWAFT_1201 result = new L5WA_GWAFT_1201();

            ORM_CMN_STR_PPS_WorkArea item = new ORM_CMN_STR_PPS_WorkArea();
            if (Parameter.WorkAreaID != Guid.Empty)
            {
                var resultWorkplace = item.Load(Connection, Transaction, Parameter.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 = Parameter.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();

            returnValue.Result.workarea = result;
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }