Exemplo n.º 1
0
        private static string CreateOrUpdate(SystemEntityXSystemEntityCategoryDataModel data, RequestProfile requestProfile, string action)
        {
            var sql = "EXEC ";

            switch (action)
            {
            case "Create":
                sql += "dbo.SystemEntityXSystemEntityCategoryInsert  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                       ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId);
                break;

            case "Update":
                sql += "dbo.SystemEntityXSystemEntityCategoryUpdate  " +
                       " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId);
                break;

            default:
                break;
            }

            sql = sql + ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityXSystemEntityCategoryId) +
                  ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategoryId) +
                  ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityId);
            return(sql);
        }
Exemplo n.º 2
0
        public static void Delete(SystemEntityXSystemEntityCategoryDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.SystemEntityXSystemEntityCategoryDelete " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityXSystemEntityCategoryId);

            DBDML.RunSQL("SystemEntityXSystemEntityCategory.Delete", sql, DataStoreKey);
        }
Exemplo n.º 3
0
        public static DataTable GetDetails(SystemEntityXSystemEntityCategoryDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.SystemEntityXSystemEntityCategorySearch " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ReturnAuditInfo, ReturnAuditInfoOnDetails) +
                      ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityXSystemEntityCategoryId);

            var oDT = new DBDataTable("SystemEntityXSystemEntityCategory.Details", sql, DataStoreKey);

            return(oDT.DBTable);
        }
Exemplo n.º 4
0
        public static DataTable Search(SystemEntityXSystemEntityCategoryDataModel data, RequestProfile requestProfile)
        {
            // formulate SQL
            var sql = "EXEC dbo.SystemEntityXSystemEntityCategorySearch " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationMode, requestProfile.ApplicationModeId) +
                      ", " + ToSQLParameter(BaseDataModel.BaseDataColumns.ApplicationId, requestProfile.ApplicationId) +
                      ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityXSystemEntityCategoryId) +
                      ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityId) +
                      ", " + ToSQLParameter(data, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategoryId);

            var oDT = new DBDataTable("SystemEntityXSystemEntityCategory.Search", sql, DataStoreKey);

            return(oDT.DBTable);
        }
Exemplo n.º 5
0
        public static void Update(SystemEntityXSystemEntityCategoryDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Update");

            DBDML.RunSQL("SystemEntityXSystemEntityCategory.Update", sql, DataStoreKey);
        }
Exemplo n.º 6
0
        public static string ToSQLParameter(SystemEntityXSystemEntityCategoryDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

            switch (dataColumnName)
            {
            case SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityXSystemEntityCategoryId:
                if (data.SystemEntityXSystemEntityCategoryId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityXSystemEntityCategoryId, data.SystemEntityXSystemEntityCategoryId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityXSystemEntityCategoryId);
                }
                break;

            case SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityId:
                if (data.SystemEntityId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityId, data.SystemEntityId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityId);
                }
                break;

            case SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategoryId:
                if (data.SystemEntityCategoryId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategoryId, data.SystemEntityCategoryId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategoryId);
                }
                break;

            case SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntity:
                if (!string.IsNullOrEmpty(data.SystemEntity))
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntity, data.SystemEntity);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntity);
                }
                break;

            case SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategory:
                if (!string.IsNullOrEmpty(data.SystemEntityCategory))
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategory, data.SystemEntityCategory);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, SystemEntityXSystemEntityCategoryDataModel.DataColumns.SystemEntityCategory);
                }
                break;

            default:
                returnValue = BaseDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }
            return(returnValue);
        }
Exemplo n.º 7
0
        public static List <SystemEntityXSystemEntityCategoryDataModel> GetEntityDetails(SystemEntityXSystemEntityCategoryDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.SystemEntityXSystemEntityCategorySearch ";

            var parameters =
                new
            {
                AuditId           = requestProfile.AuditId
                , ApplicationId   = requestProfile.ApplicationId
                , ReturnAuditInfo = returnAuditInfo
                , SystemEntityXSystemEntityCategoryId = dataQuery.SystemEntityXSystemEntityCategoryId
                , SystemEntityCategoryId = dataQuery.SystemEntityCategoryId
                , SystemEntityId         = dataQuery.SystemEntityId
            };

            List <SystemEntityXSystemEntityCategoryDataModel> result;

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                result = dataAccess.Connection.Query <SystemEntityXSystemEntityCategoryDataModel>(sql, parameters, commandType: CommandType.StoredProcedure).ToList();
            }

            return(result);
        }
Exemplo n.º 8
0
        public static SystemEntityXSystemEntityCategoryDataModel GetDetails(SystemEntityXSystemEntityCategoryDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }