示例#1
0
        private static string CreateOrUpdate(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile, string action)
        {
            var sql = "EXEC ";

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

                break;

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

            default:
                break;
            }

            sql = sql + ", " + ToSQLParameter(data, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteParameterId) +
                  ", " + ToSQLParameter(data, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteId) +
                  ", " + ToSQLParameter(data, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterName) +
                  ", " + ToSQLParameter(data, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterValue);


            return(sql);
        }
示例#2
0
        public static DataTable Search(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            var table = list.ToDataTable();

            return(table);
        }
示例#3
0
        public static DataTable DoesExist(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new ApplicationRouteParameterDataModel();

            doesExistRequest.ParameterName = data.ParameterName;

            return(Search(doesExistRequest, requestProfile));
        }
示例#4
0
        private static DataSet GetChildren(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile)
        {
            var sql = "EXEC dbo.ApplicationRouteParameterChildrenGet " +
                      " " + ToSQLParameter(BaseDataModel.BaseDataColumns.AuditId, requestProfile.AuditId) +
                      ", " + ToSQLParameter(data, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteParameterId);

            var oDT = new Framework.Components.DataAccess.DBDataSet("Get Children", sql, DataStoreKey);

            return(oDT.DBDataset);
        }
示例#5
0
        public static bool DoesExist(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new ApplicationRouteParameterDataModel();

            doesExistRequest.ParameterName = data.ParameterName;

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

            return(list.Count > 0);
        }
示例#6
0
        public static void Delete(DataModel.Framework.Core.ApplicationRouteParameterDataModel dataQuery, RequestProfile requestProfile)
        {
            const string sql = @"dbo.ApplicationRouteParameterDelete ";

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

            using (var dataAccess = new DataAccessBase(DataStoreKey))
            {
                dataAccess.Connection.Execute(sql, parameters, commandType: CommandType.StoredProcedure);
            }
        }
示例#7
0
        public static bool IsDeletable(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile)
        {
            var isDeletable = true;
            var ds          = GetChildren(data, requestProfile);

            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataTable dt in ds.Tables)
                {
                    if (dt.Rows.Count > 0)
                    {
                        isDeletable = false;
                        break;
                    }
                }
            }
            return(isDeletable);
        }
示例#8
0
        public static string ToSQLParameter(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

            switch (dataColumnName)
            {
            case DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteParameterId:
                if (data.ApplicationRouteParameterId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteParameterId, data.ApplicationRouteParameterId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteParameterId);
                }
                break;

            case DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteId:
                if (data.ApplicationRouteId != null)
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NUMBER, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteId, data.ApplicationRouteId);
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRouteId);
                }
                break;

            case DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRoute:
                if (!string.IsNullOrEmpty(data.ApplicationRoute))
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRoute, data.ApplicationRoute.Trim());
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ApplicationRoute);
                }
                break;

            case DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterName:
                if (!string.IsNullOrEmpty(data.ParameterName))
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterName, data.ParameterName.Trim());
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterName);
                }
                break;

            case DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterValue:
                if (!string.IsNullOrEmpty(data.ParameterValue))
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_STRING_OR_DATE, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterValue, data.ParameterValue.Trim());
                }
                else
                {
                    returnValue = string.Format(SQL_TEMPLATE_PARAMETER_NULL, DataModel.Framework.Core.ApplicationRouteParameterDataModel.DataColumns.ParameterValue);
                }
                break;

            default:
                returnValue = BaseDataManager.ToSQLParameter(data, dataColumnName);
                break;
            }
            return(returnValue);
        }
示例#9
0
        public static void Update(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile)
        {
            var sql = CreateOrUpdate(data, requestProfile, "Update");

            Framework.Components.DataAccess.DBDML.RunSQL("ApplicationRouteParameter.Update", sql, DataStoreKey);
        }
示例#10
0
        public static List <DataModel.Framework.Core.ApplicationRouteParameterDataModel> GetEntityDetails(DataModel.Framework.Core.ApplicationRouteParameterDataModel dataQuery, RequestProfile requestProfile, int returnAuditInfo = BaseDataManager.ReturnAuditInfoOnDetails)
        {
            const string sql = @"dbo.ApplicationRouteParameterSearch ";

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

            List <ApplicationRouteParameterDataModel> result;

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

            return(result);
        }
示例#11
0
        public static ApplicationRouteParameterDataModel GetDetails(DataModel.Framework.Core.ApplicationRouteParameterDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 1);

            return(list.FirstOrDefault());
        }