示例#1
0
        public static string ToSQLParameter(ApplicationAttributeDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

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

            default:
                returnValue = StandardDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }

            return(returnValue);
        }
示例#2
0
        public static DataTable Search(ApplicationAttributeDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            var table = list.ToDataTable();

            return(table);
        }
示例#3
0
        public static bool DoesExist(ApplicationAttributeDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new ApplicationAttributeDataModel();

            doesExistRequest.ApplicationId = data.ApplicationId;

            var list = GetEntityDetails(doesExistRequest, requestProfile, 0);

            return(list.Count > 0);
        }
示例#4
0
        public static void Delete(ApplicationAttributeDataModel dataQuery, RequestProfile requestProfile)
        {
            const string sql = @"dbo.ApplicationAttributeDelete ";

            var parameters =
                new
            {
                AuditId         = requestProfile.AuditId
                , ApplicationId = dataQuery.ApplicationId
            };

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
示例#5
0
        public static List <ApplicationAttributeDataModel> GetEntityDetails(ApplicationAttributeDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.ApplicationAttributeSearch ";

            var parameters =
                new
            {
                AuditId           = requestProfile.AuditId
                , ApplicationId   = dataQuery.ApplicationId
                , ApplicationMode = requestProfile.ApplicationModeId
                , ReturnAuditInfo = returnAuditInfo
            };

            List <ApplicationAttributeDataModel> result;

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


            return(result);
        }
示例#6
0
        private static string CreateOrUpdate(ApplicationAttributeDataModel data, RequestProfile requestProfile, string action)
        {
            var sql = "EXEC ";

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

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

            default:
                break;
            }

            sql = sql + ", " + ToSQLParameter(data, ApplicationAttributeDataModel.DataColumns.ApplicationId) +
                  ", " + ToSQLParameter(data, ApplicationAttributeDataModel.DataColumns.RenderApplicationFilter);
            return(sql);
        }
示例#7
0
        public static void Update(ApplicationAttributeDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Update");

            DataAccess.DBDML.RunSQL("ApplicationAttribute.Update", sql, DataStoreKey);
        }
示例#8
0
        public static ApplicationAttributeDataModel GetDetails(ApplicationAttributeDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }
示例#9
0
        public static List <ApplicationAttributeDataModel> GetList(RequestProfile requestProfile)
        {
            var obj = new ApplicationAttributeDataModel();

            return(GetEntityDetails(obj, requestProfile));
        }