///<summary> /// Method Invocation of wrapper classes ///<summary> protected static FR_L5CM_CSNU_1524 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5CM_CSNU_1524 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { bool cleanupConnection = Connection == null; bool cleanupTransaction = Transaction == null; FR_L5CM_CSNU_1524 functionReturn = new FR_L5CM_CSNU_1524(); 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 { } throw ex; } return(functionReturn); }
protected static FR_L5CM_CSNU_1524 Execute(DbConnection Connection, DbTransaction Transaction, P_L5CM_CSNU_1524 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5CM_CSNU_1524(); StructureBuilderUtil structureBuilderUtil = new StructureBuilderUtil(); TreeNodeUtil treeNodeUtil = new TreeNodeUtil(); structureBuilderUtil.company = cls_Get_Company_Structure_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result;; structureBuilderUtil.sessionToken = securityTicket.SessionTicket; structureBuilderUtil.addEmployees = false; structureBuilderUtil.sessionSettings = cls_Get_Settings_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result; structureBuilderUtil.startDate = cls_Get_CalculationTimeFramesForTenant.Invoke(Connection, Transaction, securityTicket).Result.Min(x => x.CalculationTimeframe_StartDate).Date; structureBuilderUtil.endDate = DateTime.Now; structureBuilderUtil.hidenNodeType = CompanyStructureType.None; structureBuilderUtil.employees = new L5EM_GEFT_0959[0]; EmployeeUtils employeeUtil = new EmployeeUtils(); structureBuilderUtil.employeeUtil = employeeUtil; returnValue.Result = new L5CM_CSNU_1524(); List <Node> companyStructure = structureBuilderUtil.organizeData(DateTime.Now); Node node = treeNodeUtil.findNodeForID(companyStructure[0], Parameter.ParentRefID); if (node != null && node.Children.Count != 0) { if (node.Children[0].data is L5OF_GOFT_1157) { var officeQuery = new ORM_CMN_STR_Office.Query(); officeQuery.Tenant_RefID = securityTicket.TenantID; officeQuery.IsDeleted = false; officeQuery.Office_ShortName = Parameter.ShortName; var officeQueryRes = ORM_CMN_STR_Office.Query.Search(Connection, Transaction, officeQuery); if (officeQueryRes.Count > 0) { if (officeQueryRes.Count > 0) { returnValue.Result.OfficeID = officeQueryRes[0].CMN_STR_OfficeID; returnValue.Result.OfficeShortName = officeQueryRes[0].Office_ShortName; } } } else if (node.Children[0].data is L5WA_GWAFT_1201) { var workareaQuery = new ORM_CMN_STR_PPS_WorkArea.Query(); workareaQuery.Tenant_RefID = securityTicket.TenantID; workareaQuery.IsDeleted = false; workareaQuery.ShortName = Parameter.ShortName; if (node.data is L5WA_GWAFT_1201) { workareaQuery.Parent_RefID = Parameter.ParentRefID; } else { workareaQuery.Office_RefID = Parameter.ParentRefID; } var workareaQueryRes = ORM_CMN_STR_PPS_WorkArea.Query.Search(Connection, Transaction, workareaQuery); if (workareaQueryRes.Count > 0) { returnValue.Result.WorkAreaID = workareaQueryRes[0].CMN_STR_PPS_WorkAreaID; returnValue.Result.WorkAreaShortName = workareaQueryRes[0].ShortName; } } else if (node.Children[0].data is L5WP_GWFT_1203) { var workplaceQuery = new ORM_CMN_STR_PPS_Workplace.Query(); workplaceQuery.Tenant_RefID = securityTicket.TenantID; workplaceQuery.IsDeleted = false; workplaceQuery.ShortName = Parameter.ShortName; workplaceQuery.WorkArea_RefID = Parameter.ParentRefID; var workplaceQueryRes = ORM_CMN_STR_PPS_Workplace.Query.Search(Connection, Transaction, workplaceQuery); if (workplaceQueryRes.Count > 0) { if (workplaceQueryRes.Count > 0) { returnValue.Result.WorkPlaceID = workplaceQueryRes[0].CMN_STR_PPS_WorkplaceID; returnValue.Result.WorkPlaceShortName = workplaceQueryRes[0].ShortName; } } } } return(returnValue); #endregion UserCode }