예제 #1
0
        public void Delete(string value)
        {
            var dataDelete = new StrategyGroupDataModel();

            dataDelete.StrategyGroupId = int.Parse(value);
            StrategyGroupDataManager.Delete(dataDelete, SessionVariables.RequestProfile);
        }
예제 #2
0
        public static int Create(StrategyGroupDataModel data, RequestProfile requestProfile)
        {
            var sql   = Save(data, "Create", requestProfile);
            var newId = DBDML.RunScalarSQL("StrategyGroup.Insert", sql, DataStoreKey);

            return(Convert.ToInt32(newId));
        }
예제 #3
0
        public StrategyGroupDataModel GetById(string value)
        {
            var dataQuery = new StrategyGroupDataModel();

            dataQuery.StrategyGroupId = int.Parse(value);

            var result = StrategyGroupDataManager.GetEntityDetails(dataQuery, SessionVariables.RequestProfile, 1);

            return(result[0]);
        }
예제 #4
0
        public static bool DoesExist(StrategyGroupDataModel data, RequestProfile requestProfile)
        {
            var doesExistRequest = new StrategyGroupDataModel();

            doesExistRequest.ApplicationId = data.ApplicationId;
            doesExistRequest.FundId        = data.FundId;

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

            return(list.Count > 0);
        }
예제 #5
0
        public static void Delete(StrategyGroupDataModel data, RequestProfile requestProfile)
        {
            const string sql = @"dbo.StrategyGroupDelete ";

            var parameters =
                new
            {
                AuditId           = requestProfile.AuditId
                , StrategyGroupId = data.StrategyGroupId
            };

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

            var parameters =
                new
            {
                AuditId           = requestProfile.AuditId
                , ApplicationId   = requestProfile.ApplicationId
                , ReturnAuditInfo = returnAuditInfo
                , StrategyGroupId = dataQuery.StrategyGroupId
                , FundId          = dataQuery.FundId
            };

            List <StrategyGroupDataModel> result;

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

            return(result);
        }
예제 #7
0
        public static string Save(StrategyGroupDataModel data, string action, RequestProfile requestProfile)
        {
            var sql = "EXEC ";


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

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

            default:
                break;
            }
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.StrategyGroupId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.FundId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.ClassificationId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.PortfolioId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.ParentStrategyGroupId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.DefaultUSecurityId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.ActiveYN);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.OpenDateId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.CloseDateId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.ClosedYN);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.ThemeId);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.StrategyGroupCode);
            sql = sql + ", " + ToSQLParameter(data, StrategyGroupDataModel.DataColumns.StrategyGroupDesc);

            return(sql);
        }
예제 #8
0
        public static void Update(StrategyGroupDataModel data, RequestProfile requestProfile)
        {
            var sql = Save(data, "Update", requestProfile);

            DBDML.RunSQL("StrategyGroup.Update", sql, DataStoreKey);
        }
예제 #9
0
        public static DataTable Search(StrategyGroupDataModel data, RequestProfile requestProfile)
        {
            var list = GetEntityDetails(data, requestProfile, 0);

            return(list.ToDataTable());
        }
예제 #10
0
        public static string ToSQLParameter(StrategyGroupDataModel data, string dataColumnName)
        {
            var returnValue = "NULL";

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

            return(returnValue);
        }