Adding a Recepy Management System

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
Hi

I'm currently trying to add a recepy management system to nop_commerce 1.70.
I started by copying the news system but i'm having some problems..

Like the news system i have the following files:

/Nop.BusinessLogic/Content/Recepy

Recepy.cs
RecepyComment.cs
RecepyManager.cs

Just did a find and replace to replace news for Recepy.

In the database i copied the tables and necessary stored procedures:

Nop_Recepy
Nop_RecepyComment
Nop_RecepyLoadAll

Once again find and replace to replace news with recepy
After that i updated the  Entity framework model in NopModel, added the function import to return the recepies "Sp_RecepyLoadAll" and added the following to NopObjectContext


  public ObjectSet<Recepy> Recepies
        {
            get
            {
                if ((_recepies == null))
                {
                    _recepies = CreateObjectSet<Recepy>();
                }
                return _recepies;
            }
        }

        private ObjectSet<Recepy> _recepies;

        public ObjectSet<RecepyComment> RecepyComments
        {
            get
            {
                if ((_recepyComments == null))
                {
                    _recepyComments = CreateObjectSet<RecepyComment>();
                }
                return _recepyComments;
            }
        }
        private ObjectSet<RecepyComment> _recepyComments;



  public List<Recepy> Sp_RecepyLoadAll(int languageId, bool showHidden,
             int pageSize, int pageIndex, out int totalRecords)
        {
            totalRecords = 0;

            ObjectParameter languageIdParameter = new ObjectParameter("LanguageID", languageId);
            ObjectParameter showHiddenParameter = new ObjectParameter("ShowHidden", showHidden);
            ObjectParameter pageSizeParameter = new ObjectParameter("PageSize", pageSize);
            ObjectParameter pageIndexParameter = new ObjectParameter("PageIndex", pageIndex);
            ObjectParameter totalRecordsParameter = new ObjectParameter("TotalRecords", typeof(int));

            var result = base.ExecuteFunction<Recepy>("Sp_RecepyLoadAll",
                languageIdParameter, showHiddenParameter, pageSizeParameter,
                pageIndexParameter, totalRecordsParameter).ToList();
            totalRecords = Convert.ToInt32(totalRecordsParameter.Value);
            return result;
        }

Here's the problem, when i try to list all recepies using Recepy.aspx with a copy of the control News.ascx in the administration i get the following error on the NopObjectContext in  this area of code:

  var result = base.ExecuteFunction<Recepy>("Sp_RecepyLoadAll",
                languageIdParameter, showHiddenParameter, pageSizeParameter,
                pageIndexParameter, totalRecordsParameter).ToList();
            totalRecords = Convert.ToInt32(totalRecordsParameter.Value);
            return result;

The type parameter 'NopSolutions.NopCommerce.BusinessLogic.Content.RecepyManagement.Recepy' in ExecuteFunction is incompatible with the type 'NopSolutions.NopCommerce.BusinessLogic.Data.Recepy' returned by the function.

I've been bashing my head against the wall for hours with this one but i can't seem the find the problem, any ideas?Thans very much.
13 лет назад
probably you forgot to change the type of  'NopSolutions.NopCommerce.BusinessLogic.Data.Recepy' from news to recepy
13 лет назад
I don't mean to seem like a troll, but it's spelled "recipe". You may wish to consider correcting this.
13 лет назад
lol
13 лет назад
lakario wrote:
I don't mean to seem like a troll, but it's spelled "recipe". You may wish to consider correcting this.


Well my natural language isn't english but i'm always learning lol, thanks.

In the file NopObjectContext  i imported the correct namespace

using NopSolutions.NopCommerce.BusinessLogic.Content.RecipeManagement;

        public ObjectSet<Recipe> Recipe
        {
            get
            {
                if ((_recipe == null))
                {
                    _recipe = CreateObjectSet<Recipe>();
                }
                return _recipe;
            }
        }

        private ObjectSet<Recipe> _recipe;

        public ObjectSet<RecipeComment> RecipeComments
        {
            get
            {
                if ((_recipeComments == null))
                {
                    _recipeComments = CreateObjectSet<RecipeComment>();
                }
                return _recipeComments;
            }
        }
        private ObjectSet<RecipeComment> _recipeComments;

in this namespace i have Recipe,RecipeComment and RecipeManager as it's suposed to be :s
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.