Exemplo n.º 1
0
        public DataTable AddTransaction(AddMFTransactionRequest request)
        {
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "PortfolioId", Value = request.PortfolioId
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "houseId", Value = request.FundHouseId
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "typeId", Value = request.FundTypeId
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "categoryId", Value = request.FundCategoryId
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "optionsId", Value = request.FundOptionsId
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "schemaCode", Value = request.SchemaCode
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "growthschemaCode", Value = request.GrowthSchemaCode
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.String, ParameterName = "fundName", Value = request.FundName
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Date, ParameterName = "PurchaseDate", Value = request.PurchaseDate.Date
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Int32, ParameterName = "FolioId", Value = request.FolioId
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Decimal, ParameterName = "Amount", Value = request.Amount
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Decimal, ParameterName = "PurchaseNAV", Value = request.PurchaseNAV
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.Decimal, ParameterName = "Units", Value = request.Units
            });
            parameters.Add(new SqlParameter()
            {
                DbType = DbType.String, ParameterName = "SIP", Value = (request.IsSIP == true ? "Y" : "N")
            });

            DataSet ds = SQLHelper.ExecuteProcedure("PersonalFinance", "AddMFPurchase", CommandType.StoredProcedure, parameters);

            if (ds != null)
            {
                return(ds.Tables[0]);
            }
            return(null);
        }