Esempio n. 1
0
        /// <summary>
        /// Action: GetMenuItem
        /// </summary>

        public static void GetMenuItem(HeContext heContext, int inParamId, out RCMenuItemRecord outParamRecord)
        {
            outParamRecord = new RCMenuItemRecord(null);

            try {
                outParamRecord = ENMenuItemEntity.GetRecordById(inParamId);
            } catch {
                using (Transaction trans = DatabaseAccess.ForCurrentDatabase.GetRequestTransaction()) {
                    string sql =
                        "SELECT " +
                        " [ID]" +
                        ", [ORDER]" +
                        ", [CAPTION]" +
                        " FROM " + ENMenuItemEntity.LocalViewName(heContext.AppInfo.Tenant.Id, BuiltInFunction.GetCurrentLocale()) + " " +
                        "WHERE [ID] = @inParamId";
                    Command sqlCmd = trans.CreateCommand(sql);
                    sqlCmd.CreateParameter("@inParamId", DbType.Int32, inParamId);
                    using (IDataReader reader = sqlCmd.ExecuteReader("Entity Action GetMenuItem", true, false, false)) {
                        if (reader.Read())
                        {
                            outParamRecord.ReadDB(reader);
                        }
                        else
                        {
                            throw new DataBaseException(ENMenuItemEntity.LocalViewName(heContext.AppInfo.Tenant.Id, BuiltInFunction.GetCurrentLocale()) + " with key " + inParamId + " was not found");
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        protected override string EntityToTablename(string entity, int tenantId)
        {
            string entityLC = entity.ToLowerInvariant();

            switch (entityLC)
            {
            case "recentitem":
                return(ENRecentItemEntity.LocalViewName(AppInfo.GetAppInfo().Tenant.Id, BuiltInFunction.GetCurrentLocale()));

            case "messagetype":
                return(ENMessageTypeEntity.LocalViewName(AppInfo.GetAppInfo().Tenant.Id, BuiltInFunction.GetCurrentLocale()));

            case "menuitem":
                return(ENMenuItemEntity.LocalViewName(AppInfo.GetAppInfo().Tenant.Id, BuiltInFunction.GetCurrentLocale()));

            case "contact":
                return(ENContactEntity.LocalViewName(AppInfo.GetAppInfo().Tenant.Id, BuiltInFunction.GetCurrentLocale()));

            case "application":
                return(ENApplicationEntity.LocalViewName(AppInfo.GetAppInfo().Tenant.Id, BuiltInFunction.GetCurrentLocale()));

            case "user":
                return(ENUserEntity.LocalViewName(AppInfo.GetAppInfo().Tenant.Id, BuiltInFunction.GetCurrentLocale()));
            }

            throw new DataBaseException("'" + entity + "' found in 'Expand Inline' parameter is an unknown Entity");
        }