Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Nuts!

Nuts!

Scheduled Pinned Locked Moved LINQ
questionlearningcsharplinqtesting
29 Posts 5 Posters 16 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mustafa Ismail Mustafa

    OK, this is driving me nuts. It was working perfectly fine yesterday and NOTHING has changed since then but it has stopped working. What is going on?

    List<RCH.EL.EMR.Allergies> AllAllergies
    { get; set; }

    List<RCH.EL.EMR.Allergies> RemainingAllergies
    { get; set; }

    List<RCH.EL.EMR.Allergies> PatientAllergies
    { get; set; }

    protected override void LoadForm()
    {
    //lots of code
    //retrieve the data
    AllAllergies = AllergiesBL.GetAllFromDB();
    PatientAllergies = PatientAllergiesBL.GetFromDB(CurrentPatient.PatientID);
    RemainingAllergies = new List<EL.EMR.Allergies>();

    ResolveAllergies();

    //Bind
    Bind();

    }

    private void ResolveAllergies()
    {
    RemainingAllergies = AllAllergies.Except(PatientAllergies).ToList();
    }

    Yesterday, method Resolveallergies() worked properly, not now. Why? What am I doing wrong? I've wasted so much time on what should be a pathetically simple issue.

    If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

    S Offline
    S Offline
    Super Lloyd
    wrote on last edited by
    #3

    Is it about nut allergy?!? ;P

    A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

    M 1 Reply Last reply
    0
    • M Mustafa Ismail Mustafa

      OK, this is driving me nuts. It was working perfectly fine yesterday and NOTHING has changed since then but it has stopped working. What is going on?

      List<RCH.EL.EMR.Allergies> AllAllergies
      { get; set; }

      List<RCH.EL.EMR.Allergies> RemainingAllergies
      { get; set; }

      List<RCH.EL.EMR.Allergies> PatientAllergies
      { get; set; }

      protected override void LoadForm()
      {
      //lots of code
      //retrieve the data
      AllAllergies = AllergiesBL.GetAllFromDB();
      PatientAllergies = PatientAllergiesBL.GetFromDB(CurrentPatient.PatientID);
      RemainingAllergies = new List<EL.EMR.Allergies>();

      ResolveAllergies();

      //Bind
      Bind();

      }

      private void ResolveAllergies()
      {
      RemainingAllergies = AllAllergies.Except(PatientAllergies).ToList();
      }

      Yesterday, method Resolveallergies() worked properly, not now. Why? What am I doing wrong? I've wasted so much time on what should be a pathetically simple issue.

      If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #4

      First of all, what data are you getting back? Have you checked what's in AllAllergies and PatientAllergies? You know the drill; set your breakpoint and trace the values.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      M 1 Reply Last reply
      0
      • S Super Lloyd

        The namespace names are... very terse! Hey is it a commercial project? I'm very interested in allergies myself, I'd like to know more! Anyway, AllergiesBL and PatientAllergiesBL seems like different data source, returning different data, maybe someone update the id or something in one db and not the other? Juts an idea...

        A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

        M Offline
        M Offline
        Mustafa Ismail Mustafa
        wrote on last edited by
        #5

        Terse?! How did you come to that conclusion? :laugh:

        Super Lloyd wrote:

        Hey is it a commercial project? I'm very interested in allergies myself, I'd like to know more!

        Yep. Ask away, I'm dealing heavily in this right now. If I don't have the answer, I can get you free responses from the Doctors I work with :)

        Super Lloyd wrote:

        Anyway, AllergiesBL and PatientAllergiesBL seems like different data source, returning different data, maybe someone update the id or something in one db and not the other?

        Nope, I'm the only one working on this. Yes, they write and (on the whole) read from different views/tables, but retrieving the data for this particular form, PatientAllergies returns the exact same data (format wise, not actual content obviously) as AllAllergies.

        If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

        S 1 Reply Last reply
        0
        • P Pete OHanlon

          First of all, what data are you getting back? Have you checked what's in AllAllergies and PatientAllergies? You know the drill; set your breakpoint and trace the values.

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys | Onyx

          M Offline
          M Offline
          Mustafa Ismail Mustafa
          wrote on last edited by
          #6

          The data is 100% right, I checked it till my eyes bled. AllAllergies and PatientAllergies are correct. The only point of failure (and insanity) is the failure of the ResolveAllergies() method and in particular this line of code:

          RemainingAllergies = AllAllergies.Except(PatientAllergies).ToList();

          point of clarification: PatientAllergies is the list that contains the allergies that are "registered" to the user, meaning he suffers from them. AllAllergies on the other hand, contains a non-exhaustive list of all the allergies that a patient might have. RemainingAllergies is (set wise) AllAllergies - PatientAllergies. (sorta obvious because of the Except method)

          If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

          P 1 Reply Last reply
          0
          • M Mustafa Ismail Mustafa

            The data is 100% right, I checked it till my eyes bled. AllAllergies and PatientAllergies are correct. The only point of failure (and insanity) is the failure of the ResolveAllergies() method and in particular this line of code:

            RemainingAllergies = AllAllergies.Except(PatientAllergies).ToList();

            point of clarification: PatientAllergies is the list that contains the allergies that are "registered" to the user, meaning he suffers from them. AllAllergies on the other hand, contains a non-exhaustive list of all the allergies that a patient might have. RemainingAllergies is (set wise) AllAllergies - PatientAllergies. (sorta obvious because of the Except method)

            If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #7

            So what's wrong with RemainingAllergies? Are you not getting any data back? Are you getting too much data? Is the data wrong? You haven't given us a lot to go on here mate. What about setting a local variable here, and see what you get with that?

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            M 1 Reply Last reply
            0
            • S Super Lloyd

              Is it about nut allergy?!? ;P

              A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

              M Offline
              M Offline
              Mustafa Ismail Mustafa
              wrote on last edited by
              #8

              Y'know, I keep on hearing about different people who have some sort of allergy to peanuts or almonds or pistachios, but thankfully I don't have such an allergy (and none at all in fact) and neither have I met them. Must be a conspiracy :suss:

              If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

              1 Reply Last reply
              0
              • M Mustafa Ismail Mustafa

                OK, this is driving me nuts. It was working perfectly fine yesterday and NOTHING has changed since then but it has stopped working. What is going on?

                List<RCH.EL.EMR.Allergies> AllAllergies
                { get; set; }

                List<RCH.EL.EMR.Allergies> RemainingAllergies
                { get; set; }

                List<RCH.EL.EMR.Allergies> PatientAllergies
                { get; set; }

                protected override void LoadForm()
                {
                //lots of code
                //retrieve the data
                AllAllergies = AllergiesBL.GetAllFromDB();
                PatientAllergies = PatientAllergiesBL.GetFromDB(CurrentPatient.PatientID);
                RemainingAllergies = new List<EL.EMR.Allergies>();

                ResolveAllergies();

                //Bind
                Bind();

                }

                private void ResolveAllergies()
                {
                RemainingAllergies = AllAllergies.Except(PatientAllergies).ToList();
                }

                Yesterday, method Resolveallergies() worked properly, not now. Why? What am I doing wrong? I've wasted so much time on what should be a pathetically simple issue.

                If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                S Offline
                S Offline
                Super Lloyd
                wrote on last edited by
                #9

                Maybe you have modified the Equals() method? I mean public override bool Allergy.Equals()

                A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                M 1 Reply Last reply
                0
                • P Pete OHanlon

                  So what's wrong with RemainingAllergies? Are you not getting any data back? Are you getting too much data? Is the data wrong? You haven't given us a lot to go on here mate. What about setting a local variable here, and see what you get with that?

                  "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                  As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                  My blog | My articles | MoXAML PowerToys | Onyx

                  M Offline
                  M Offline
                  Mustafa Ismail Mustafa
                  wrote on last edited by
                  #10

                  Ah, my apologies on that one! :humbled: Its returning the exact contents of AllAllergies (too much data) and its not removing the list items that are shared in both AllAllergies and PatientAllergies.

                  If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                  1 Reply Last reply
                  0
                  • M Mustafa Ismail Mustafa

                    Terse?! How did you come to that conclusion? :laugh:

                    Super Lloyd wrote:

                    Hey is it a commercial project? I'm very interested in allergies myself, I'd like to know more!

                    Yep. Ask away, I'm dealing heavily in this right now. If I don't have the answer, I can get you free responses from the Doctors I work with :)

                    Super Lloyd wrote:

                    Anyway, AllergiesBL and PatientAllergiesBL seems like different data source, returning different data, maybe someone update the id or something in one db and not the other?

                    Nope, I'm the only one working on this. Yes, they write and (on the whole) read from different views/tables, but retrieving the data for this particular form, PatientAllergies returns the exact same data (format wise, not actual content obviously) as AllAllergies.

                    If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                    S Offline
                    S Offline
                    Super Lloyd
                    wrote on last edited by
                    #11

                    I would like to know about Gluten intolerance and Caseine intolerance. I don't know if it's an allergy because it's not killing me. But it does spoil my life (slowly but surely). Except since I discovered about it recently I made some progress! :-D And also it seems to affect the brain (I read), not as an allergen but as something else...

                    A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                    M P L 3 Replies Last reply
                    0
                    • S Super Lloyd

                      Maybe you have modified the Equals() method? I mean public override bool Allergy.Equals()

                      A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                      M Offline
                      M Offline
                      Mustafa Ismail Mustafa
                      wrote on last edited by
                      #12

                      Haven't touched it. Like I said, I did not touch the code since yesterday, heck I didn't even turn off the computer!

                      If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                      S 1 Reply Last reply
                      0
                      • S Super Lloyd

                        I would like to know about Gluten intolerance and Caseine intolerance. I don't know if it's an allergy because it's not killing me. But it does spoil my life (slowly but surely). Except since I discovered about it recently I made some progress! :-D And also it seems to affect the brain (I read), not as an allergen but as something else...

                        A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                        M Offline
                        M Offline
                        Mustafa Ismail Mustafa
                        wrote on last edited by
                        #13

                        Will do, but what exactly would you like to know? I'll be seeing them next Monday or Tuesday (I'll be getting a confirmation in an hour) so would it be alright then? They're clear across town.

                        If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                        S 2 Replies Last reply
                        0
                        • M Mustafa Ismail Mustafa

                          Will do, but what exactly would you like to know? I'll be seeing them next Monday or Tuesday (I'll be getting a confirmation in an hour) so would it be alright then? They're clear across town.

                          If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                          S Offline
                          S Offline
                          Super Lloyd
                          wrote on last edited by
                          #14

                          What would I like to know exactly? Mmhh... good question. I'd like to know everything! :-) But that might be too much to ask... How about: I heard they were doing a world first gluten intolerance / celiac disease curative shot in Australia recently. Do they know about that and have any idea about the time to market?

                          A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                          1 Reply Last reply
                          0
                          • M Mustafa Ismail Mustafa

                            Haven't touched it. Like I said, I did not touch the code since yesterday, heck I didn't even turn off the computer!

                            If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                            S Offline
                            S Offline
                            Super Lloyd
                            wrote on last edited by
                            #15

                            I believe you but you know... something has to change for the code to behave differently! Check out the SVN history for any changes between yesterday and today? Maybe something in the database, do you have anyway to know what changed?

                            A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                            M 1 Reply Last reply
                            0
                            • S Super Lloyd

                              I would like to know about Gluten intolerance and Caseine intolerance. I don't know if it's an allergy because it's not killing me. But it does spoil my life (slowly but surely). Except since I discovered about it recently I made some progress! :-D And also it seems to affect the brain (I read), not as an allergen but as something else...

                              A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                              P Offline
                              P Offline
                              Pete OHanlon
                              wrote on last edited by
                              #16

                              Super Lloyd wrote:

                              I would like to know about Gluten intolerance

                              Talk to me buddy - my wife is gluten intolerant. We've learned more about it than we ever wanted to know (especially how hard it is to find decent gluten free bread).

                              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                              As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                              My blog | My articles | MoXAML PowerToys | Onyx

                              S D 2 Replies Last reply
                              0
                              • P Pete OHanlon

                                Super Lloyd wrote:

                                I would like to know about Gluten intolerance

                                Talk to me buddy - my wife is gluten intolerant. We've learned more about it than we ever wanted to know (especially how hard it is to find decent gluten free bread).

                                "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                My blog | My articles | MoXAML PowerToys | Onyx

                                S Offline
                                S Offline
                                Super Lloyd
                                wrote on last edited by
                                #17

                                I wonder, have you heard they are testing some Gluten intolerance curative shot in Australia? Also Gluten intolerance cause heaps of nasty and mysterious symptoms. Do they go away for good? How long does it takes?

                                A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                                P 1 Reply Last reply
                                0
                                • M Mustafa Ismail Mustafa

                                  Will do, but what exactly would you like to know? I'll be seeing them next Monday or Tuesday (I'll be getting a confirmation in an hour) so would it be alright then? They're clear across town.

                                  If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                                  S Offline
                                  S Offline
                                  Super Lloyd
                                  wrote on last edited by
                                  #18

                                  Also Gluten intolerance cause heaps of nasty and mysterious symptoms. Do they go away for good? (when one has a gluten free diet) How long does it takes?

                                  A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                                  1 Reply Last reply
                                  0
                                  • S Super Lloyd

                                    I wonder, have you heard they are testing some Gluten intolerance curative shot in Australia? Also Gluten intolerance cause heaps of nasty and mysterious symptoms. Do they go away for good? How long does it takes?

                                    A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                                    P Offline
                                    P Offline
                                    Pete OHanlon
                                    wrote on last edited by
                                    #19

                                    Super Lloyd wrote:

                                    I wonder, have you heard they are testing some Gluten intolerance curative shot in Australia?

                                    I haven't heard that, but it would be good if they could cure it.

                                    Super Lloyd wrote:

                                    Also Gluten intolerance cause heaps of nasty and mysterious symptoms. Do they go away for good?

                                    No. Not eating gluten keeps the symptoms at bay, but they haven't disappeared. With my wife, gluten triggers chronic stomach pains, and her iron count plummets because the villi just cannot process the gluten in the food.

                                    Super Lloyd wrote:

                                    How long does it takes?

                                    It depends on how long you've been Coeliac, and how severe your symptoms have been. If you've just got a mild case, or haven't had it too long, then it shouldn't take too long for your symptoms to abate.

                                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                    My blog | My articles | MoXAML PowerToys | Onyx

                                    S 1 Reply Last reply
                                    0
                                    • P Pete OHanlon

                                      Super Lloyd wrote:

                                      I wonder, have you heard they are testing some Gluten intolerance curative shot in Australia?

                                      I haven't heard that, but it would be good if they could cure it.

                                      Super Lloyd wrote:

                                      Also Gluten intolerance cause heaps of nasty and mysterious symptoms. Do they go away for good?

                                      No. Not eating gluten keeps the symptoms at bay, but they haven't disappeared. With my wife, gluten triggers chronic stomach pains, and her iron count plummets because the villi just cannot process the gluten in the food.

                                      Super Lloyd wrote:

                                      How long does it takes?

                                      It depends on how long you've been Coeliac, and how severe your symptoms have been. If you've just got a mild case, or haven't had it too long, then it shouldn't take too long for your symptoms to abate.

                                      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                      My blog | My articles | MoXAML PowerToys | Onyx

                                      S Offline
                                      S Offline
                                      Super Lloyd
                                      wrote on last edited by
                                      #20

                                      thanks! in my case it has been very mild and very long! but, over many years, it has very slowly grow from mild to severe (and mysterious). only recently I realized it was this! I hope it won't take as long to get better...

                                      A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                                      1 Reply Last reply
                                      0
                                      • S Super Lloyd

                                        I believe you but you know... something has to change for the code to behave differently! Check out the SVN history for any changes between yesterday and today? Maybe something in the database, do you have anyway to know what changed?

                                        A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                                        M Offline
                                        M Offline
                                        Mustafa Ismail Mustafa
                                        wrote on last edited by
                                        #21

                                        SVN Logs, my memory, and my sister's memory. Can't think of anything else.

                                        If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                                        1 Reply Last reply
                                        0
                                        • M Mustafa Ismail Mustafa

                                          OK, this is driving me nuts. It was working perfectly fine yesterday and NOTHING has changed since then but it has stopped working. What is going on?

                                          List<RCH.EL.EMR.Allergies> AllAllergies
                                          { get; set; }

                                          List<RCH.EL.EMR.Allergies> RemainingAllergies
                                          { get; set; }

                                          List<RCH.EL.EMR.Allergies> PatientAllergies
                                          { get; set; }

                                          protected override void LoadForm()
                                          {
                                          //lots of code
                                          //retrieve the data
                                          AllAllergies = AllergiesBL.GetAllFromDB();
                                          PatientAllergies = PatientAllergiesBL.GetFromDB(CurrentPatient.PatientID);
                                          RemainingAllergies = new List<EL.EMR.Allergies>();

                                          ResolveAllergies();

                                          //Bind
                                          Bind();

                                          }

                                          private void ResolveAllergies()
                                          {
                                          RemainingAllergies = AllAllergies.Except(PatientAllergies).ToList();
                                          }

                                          Yesterday, method Resolveallergies() worked properly, not now. Why? What am I doing wrong? I've wasted so much time on what should be a pathetically simple issue.

                                          If the post was helpful, please vote, eh! Current activities: Book: Devils by Fyodor Dostoyevsky Project: Hospital Automation, final stage Learning: Image analysis, LINQ Now and forever, defiant to the end. What is Multiple Sclerosis[^]?

                                          P Offline
                                          P Offline
                                          Pete OHanlon
                                          wrote on last edited by
                                          #22

                                          Basically this is doing object comparison. What you might want to do is roll your own comparer, like this:

                                          public class AllergyComparer : IEqualityComparer<RCH.EL.EMR.Allergies>
                                          {
                                          public bool Equals(RCH.EL.EMR.Allergies a, RCH.EL.EMR.Allergies b)
                                          {
                                          return a.ID = b.ID;
                                          }

                                          public int GetHashCode(RCH.EL.EMR.Allergies allergies)
                                          {
                                          return allergies.ID.GetHashCode();
                                          }
                                          }

                                          Then, your call to ResolveAllergies uses the following code:

                                          RemainingAllergies = AllAllergies.Except(PatientAllergies, new AllergyComparer()).ToList();

                                          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                          My blog | My articles | MoXAML PowerToys | Onyx

                                          M 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups