Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:34:46+00:00 2026-05-31T13:34:46+00:00

partial void PrintDocLetter1_CanExecute(ref bool result) { if (this.PatientsMasterItem.DoctorsMasterItem != null) { var Doctor =

  • 0
partial void PrintDocLetter1_CanExecute(ref bool result)
    {
        if (this.PatientsMasterItem.DoctorsMasterItem != null)
        {

            var Doctor = PatientsMasterItem.DoctorsMasterItem;

            var PatientList = Doctor.PatientsMasterItem;

            var Letters = PatientsMasterItem.LettersSentItem;

            if ((PatientList.Count() > 1) && (Letters.Any(i => i.LetterType == "DoctorLetter1")))
            {
                result = false;
            }
            else
            {
                result = true;
            }
        }


    }

I think something is wrong with my second condition. I’m trying to find two things.
1) Doctors with more than 1 patient.
2) Among those patients whether a lettertype called “DoctorLetter1” has been sent or not.

The above code is working good for that particular record but not working other patients with same doctors where patient1 has already been sent with DoctorLetter1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:34:47+00:00Added an answer on May 31, 2026 at 1:34 pm

    in this condition

    (Letters.Any(i => i.LetterType == "DoctorLetter1")
    

    updated (as per your ER diagram)

    you didn’t check all Patients ‘s Letter. try..

    if(Doctor.PatientsMasterItem.Count > 1 
    && Doctor.PatientsMasterItem.Any(patient => 
      patient.LettersSentItem.Any(letter => letter.LetterType == "DoctorLetter1")))
    {
      result = false;
    }
    

    *logic

    Doctor has many patients and each patient has many letters.

    if any patient (only one of them) has at least one “DoctorLetter1” sent then condition is true and result = false

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: partial void OnisApprovedChanging(bool value) { this.dateApproved = DateTime.Now; } 'dateApproved'
How can I calculate year in a nullable date? partial void AgeAtDiagnosis_Compute(ref int result)
Consider the following code: partial class OurBusinessObject { partial void OnOurPropertyChanged() { if(ValidateOurProperty(this.OurProperty) ==
I want to implement this partial method in my Linq table class. partial void
partial class Form1 { //hidden private void InitializeComponent() { this.picture = new System.Windows.Forms.PictureBox(); //hidden
I have this code: public partial class App : Application { protected override void
This is my interface public partial interface IPaymentMethod { void ProcessPayment(PaymentInfo paymentInfo, Customer customer,
In the following master.cs code: public partial class Default : System.Web.UI.MasterPage { protected void
Currently, I have something like: public partial class Form1 : Form { delegate void
I have this partial code: if ($getRecords = $con->prepare(SELECT * FROM AUCTIONS WHERE ARTICLE_NO

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.