?
Solved

Method in type does not have an implementation

Posted on 2012-08-14
9
Medium Priority
?
766 Views
Last Modified: 2012-08-23
I created the method, added the Interface, and called it in other class.

but I am getting the following error. What am I doing wrong?

TypeLoadException occured:
Method 'GetBatteryChargerForOperationCheckEnabling' in type 'LgvManager.Core.Model' from assembly 'LgvManager.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

IModel.cs
 public abstract IDictionary<int, IBatteryCharger> GetBatteryChargerForOperationCheckEnabling(IStation Station);

Open in new window


Model.cs
 public IDictionary<int, IBatteryCharger> GetBatteryChargerForOperationCheckEnabling(int st)
        {
            var ret = (from bc in _batteryChargers.Values
                       where (bc.Disabled == false && bc.Fault == false && bc.LogicalPresence == false && bc.Ftc == false &&
                               bc.Station != null && bc.Station.LgvStations.Count() > 0 && !bc.Station.Disabled
                               && bc.Charged == false
                               && bc.StationId == st
                              )
                       orderby bc.ChargerId
                       select bc).ToDictionary(x => x.ChargerId);

            return ret;
        }

Open in new window


BatteryMission.cs    
IBatteryCharger currentBatteryChargerfull = Model.GetBattetyChargerFromStation(CurrentJob.Station.StationId);

Open in new window


Thank you
0
Comment
Question by:iscivanomar
  • 5
  • 4
9 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38294782
This:

... Model.GetBattetyChargerFromStation(CurrentJob.Station.StationId);

Open in new window


...seems to imply that you are trying to call an instance method as if it were a static method. Did you actually name your variable the same name as the class?

i.e.

Model Model = new Model();

Open in new window


If not, then you need to create an instance of your class and call the method against the instance:

Model m = new Model();

IBatteryCharger currentBatteryChargerfull = m.GetBattetyChargerFromStation(CurrentJob.Station.StationId);

Open in new window

0
 

Author Comment

by:iscivanomar
ID: 38294805
sorry, this is the method that I am using
IDictionary<int, IBatteryCharger> fullBatteryChargerListE = Model.GetBatteryChargerForOperationCheckEnabling(CurrentJob.Station.StationId);

Open in new window


Not this:
Model.GetBattetyChargerFromStation(CurrentJob.Station.StationId);

Open in new window


The difference is only the name.
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38294817
My response is the same. Can you provide the first line of the function definition (i.e. the one that has the name and parameters)?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:iscivanomar
ID: 38294823
This is the IStation interface:

using System;
using System.Collections.Generic;

namespace LgvManager.Core.Interfaces
{
    public interface IStation
    {
        #region Methods
        bool Save();
        void CheckStatus();
        IList<ITrackingInfo> GetLoadUnits();
        IList<ITrackingInfo> GetLoadUnitsByRow(int row);
        IList<ITrackingInfo> GetLoadUnitsByRow(int row, int level);
        IList<ITrackingInfo> GetLoadUnitsByPosition(int pos);
        IList<ITrackingInfo> GetLoadUnitsByPosition(int pos, int level);
        #endregion

        #region Properties
        bool Active { get; set; }
        bool Full { get; set; }
        int Priority { get; set; }
        int? ActiveCallTypeId { get; set; }
        DateTime? CallTime { get; set; }
        int Depth { get; set; }
        string Description { get; set; }
        bool Disabled { get; set; }
        int LgvType { get; set; }
        int MaxLevels { get; set; }
        int MinRecallTime { get; set; }
        string Name { get; set; }
        Int16 CheckpointId { get; set; }
        Int16 StationId { get; set; }
        int StationTypeId { get; set; }
        int PalletType { get; set; }
        string ToString();
        int Width { get; set; }

        int PalletCount { get; }
        int MissionCount { get; }
        int LoadMissionCount { get; }
        int UnloadMissionCount { get; }

        int FreePositions { get; }
        int LastOccupiedPosition { get; }
        int LastOccupiedLevel { get; }
        bool IsStackable { get; }

        int FirstFreePosition { get; }
        int FirstLevelWithFreePosition { get; }


        IStationProperty this[string propertyName] { get; }
        bool LoadEnabled { get; }
        bool UnloadEnabled { get; }
        bool IsSelectable { get; }
        #endregion

        #region Navigation Properties
        IStationType StationType { get; set; }
        ICallType ActiveCallType { get; set; }
        ILgv BatteryStationForLgv { get; set; }
        ILgv MaintenanceStationForLgv { get; set; }
        ILgv LgvAssigned { get; set; }
        IList<ILgvStation> LgvStations { get; set; }
        IPlcStation PlcStation { get; set; }
        Matrix3D<IStationPosition> Positions { get; set; }
        IDictionary<string, IStationProperty> Properties { get; set; }
        IList<Pair<IStation, ISearchRule>> Destinations { get; set; }
        IList<Pair<IStation, ISearchRule>> Sources { get; set; }
        IList<ILgvEncumbrance> Encumbrances { get; set; }
        IList<IZone> Zones { get; set; }
        IDictionary<int, double> Distances { get; set; }
        #endregion               
    }
}

Open in new window


IModel.cs

using System;
using System.Collections.Generic;
using System.Text;
using Elettric80.CarrierManager;
using Elettric80.Data;

namespace LgvManager.Core.Interfaces
{
    public abstract class IModel
    {
        #region Events
        public abstract event EventHandler<MessageNotificationEventArgs> OnMessageNotification;
        public abstract event EventHandler<ChangeNotificationEventArgs> OnChangeNotification;
        public abstract event EventHandler<MissionPluginNotifyEventArgs> OnMissionPluginNotify;
        public abstract event EventHandler<TrackingRemovedPluginNotifyEventArgs> OnTrackingRemovedNotifyPlugin;
        public abstract event EventHandler<KeyEventArgs<int, IMission>> OnMissionAdded;
        public abstract event EventHandler<KeyEventArgs<int, IMission>> OnMissionRemoved;
        #endregion

        #region Singleton pattern
        protected static IModel singleton;
        public static IModel GetInstance()
        {
            return singleton;
        }
        #endregion

        #region Methods
        public abstract int CleanInactiveMissions();
        public abstract int CleanInactiveOrders();
        public abstract int GetAvailableLgvs(ILgvType lgvType);
        public abstract int GetRunningMissions(ILgvType lgvType);
        public abstract int GetRunningBatteryMissions();      //   IODSS  05-23-2012
        public abstract IList<IMission> GetRelatedMissions(int index, int ik, int lgv);
        public abstract IList<IStation> GetCallingStations(ILgvType lgvType, EDirection direction, IList<IZone> zones, int? requestedUnits, int? requesterdPalletType);
        public abstract IList<IStation> GetBusyStations(bool excludeJobDone);
        public abstract IList<ILgvType> GetBusyLgvTypes();
        public abstract IList<ILgv> GetBusyLgvs();
        public abstract IList<ISemaphore> GetIOCrossingOccupiedRequests(Int16[] outputs, EClusterType clusterType);     //  IODSS  05-23-2012
        public abstract IList<ISemaphore> GetIOCrossingRequests(Int16[] outputs, EClusterType clusterType);             //  IODSS  05-23-2012
        public abstract IList<ISemaphore> GetIOOccupied(Int16[] outputs, EClusterType clusterType);                     //  IODSS  05-23-2012
        public abstract IList<ISemaphore> GetCrossingRequests(Int16[] outputs);
        public abstract IList<ISemaphore> GetOccupiedSemaphores(Int16[] outputs);
        public abstract IList<ILgv> GetLgvsWaitingSemaphore();
        public abstract IList<IStation> GetDestinations(IStation source);
        public abstract IList<IStation> GetDestinations(IStation source, bool onRecalculate);
        public abstract IList<IStation> GetSources(IStation destination);
        public abstract bool GetBatteryChargerEncumbranceStatus();                                                            //  IODSS 05-23-2012
        public abstract IDictionary<int, IBatteryCharger> GetBatteryChargerForOperation(ILgvType lgvType, EJobType jobType);  //  IODSS 05-23-2012        
        public abstract IBatteryCharger GetBattetyChargerFromStation(int stationId);                                          //  IODSS 05-23-2012
        public abstract IDictionary<int, IBatteryCharger> GetBatteryChargerForOperationCheckEnabling(IStation StationId);
        
                
        //public abstract IOrder GetPrioritaryActiveStationOrder(ILgvType lgvType);
        //public abstract IOrder GetPrioritaryActiveStationOrder(ILgvType lgvType, EDirection direction, IList<IZone> zones, int? requestedUnits, int? requesterdPalletType);
        public abstract bool ValidateModelByLgv(CarrierSystemStatusLgv data);
        public abstract IMission CreateMissionByMessage(CarrierMissionStatusMessage message);
        public abstract void NotifyMessage(EMessageType messageType, string message);
        public abstract void NotifyPlugin(int code, IMission mission);
        public abstract void NotifyPlugin(int code, ITrackingInfo trackingInfo, IStation station);
        public abstract void UpdateLgvCountByZone();
        public abstract void UpdateLgvCountByZone(IList<IZone> zones);
        public abstract bool IsZoneLimitReached(IList<IZone> zones);
        public abstract bool IsZoneLimitReached(IStation sourceStation, IStation destinationStation);
        #endregion

        #region Properties
        public abstract IDictionary<int, IStationType> StationTypes { get; }
        public abstract IDictionary<Int16, IStation> Stations { get; }
        public abstract IDictionary<string, IPlc> Plcs { get; }
        public abstract IDictionary<int, IBatteryCharger> BatteryChargers { get; }  //  IODSS  05-23-2012
        public abstract IList<IDoor> BatteryDoors { get; }                          //  IODSS  05-23-2012
        public abstract IDictionary<Int16, ISemaphore> Semaphores { get; }          //  IODSS  05-23-2012
        public abstract IDictionary<int, IZone> Zones { get; }
        public abstract IDictionary<int, ILgv> Lgvs { get; }
        public abstract IDictionary<int, ILgvType> LgvTypes { get; }
        public abstract IDictionary<int, IOrder> Orders { get; }
        public abstract IDictionary<int, IMission> Missions { get; }
        public abstract IList<IMission> CurrentMissions { get; }
        public abstract IList<IOrder> CurrentOrders { get; }
        public abstract IDictionary<int, ILgvStation> LgvStations { get; }
        public abstract bool IsValid { get; set; }
        public abstract bool DatabaseStatus { get; set; }
        public abstract bool OpcStatus { get; set; }
        public abstract bool CarrierStatus { get; set; }
        #endregion
    }
}

Open in new window

0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38295935
And what is the first line of the Model class (i.e. the one that has the word "class" in it)?
0
 

Author Comment

by:iscivanomar
ID: 38296149
 public partial class Model : IModel, IOrderManager
    {

Open in new window

0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 1500 total points
ID: 38296395
Then see my first comment. You are trying to call the method incorrectly.
0
 

Accepted Solution

by:
iscivanomar earned 0 total points
ID: 38308236
Hello Kaufmed,
          I found the problem with this code. I have 12 projects in the solution. IMode is in one of the projects and where I was trying to used is in other project.
I found out that the reference was wrong. It was pointing to the same project when it suppose to point to the source project.    
         
  thank you
0
 

Author Closing Comment

by:iscivanomar
ID: 38324052
We try to find the problem where we think  it was but at the end was only a problem of bad reference.

Thank you
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question