Ejemplo n.º 1
0
        protected static FR_L5PR_GPGFPGID_1319 Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_GPGFPGID_1319 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5PR_GPGFPGID_1319();
            returnValue.Result = new L5PR_GPGFPGID_1319();
            //Put your code here
            L5PR_GPGFT_1315 resultProjectGroup = new L5PR_GPGFT_1315();

            ORM_TMS_PRO_Project_Group.Query projectGroupQuery = new ORM_TMS_PRO_Project_Group.Query();
            projectGroupQuery.TMS_PRO_Project_GroupID = Parameter.TMS_PRO_Project_GroupID;
            projectGroupQuery.IsDeleted    = false;
            projectGroupQuery.Tenant_RefID = securityTicket.TenantID;

            List <ORM_TMS_PRO_Project_Group> projectGroups = ORM_TMS_PRO_Project_Group.Query.Search(Connection, Transaction, projectGroupQuery);

            if (projectGroups.Count == 0)
            {
                return(null);
            }
            ORM_TMS_PRO_Project_Group projectGroup = projectGroups.FirstOrDefault();
            resultProjectGroup.TMS_PRO_Project_GroupID  = projectGroup.TMS_PRO_Project_GroupID;
            resultProjectGroup.ProjectGroup_Name        = projectGroup.ProjectGroup_Name;
            resultProjectGroup.ProjectGroup_Description = projectGroup.ProjectGroup_Description;
            returnValue.Result.ProjectGroup             = resultProjectGroup;

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_L5PR_GPGFT_1315_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5PR_GPGFT_1315_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_Plannico_Projects.Atomic.Retrieval.SQL.cls_Get_ProjectGroups_For_Tenant.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;
            List <L5PR_GPGFT_1315> results = new List <L5PR_GPGFT_1315>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "TMS_PRO_Project_GroupID", "ProjectGroup_Name_DictID", "ProjectGroup_Description_DictID" });
                while (reader.Read())
                {
                    L5PR_GPGFT_1315 resultItem = new L5PR_GPGFT_1315();
                    //0:Parameter TMS_PRO_Project_GroupID of type Guid
                    resultItem.TMS_PRO_Project_GroupID = reader.GetGuid(0);
                    //1:Parameter ProjectGroup_Name of type Dict
                    resultItem.ProjectGroup_Name             = reader.GetDictionary(1);
                    resultItem.ProjectGroup_Name.SourceTable = "tms_pro_project_groups";
                    loader.Append(resultItem.ProjectGroup_Name);
                    //2:Parameter ProjectGroup_Description of type Dict
                    resultItem.ProjectGroup_Description             = reader.GetDictionary(2);
                    resultItem.ProjectGroup_Description.SourceTable = "tms_pro_project_groups";
                    loader.Append(resultItem.ProjectGroup_Description);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw ex;
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = results.ToArray();
            return(returnStatus);
        }