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 8359383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:07:41+00:00 2026-06-09T11:07:41+00:00

I am using MVP pattern programming . In the Task class I am calling

  • 0

I am using MVP pattern programming .
In the Task class I am calling the function.

   private List<ValuePair > DisplayUserRole(string sName)
            {
                MySqlConnection connection = DbAccess.OpenConnection(ConnectionStringName.LabTrack);
                _mapper1 = new UserAuthorizationMapper(connection);

                int ixCustomer=1;
                int ixProgram=1;
                int ixWorkPackage=1;
                int ixActivity=1;
                string ixUsercode="626e28e8-e67a-4d11-8d2c-129d0ab79e96";

                bool isUserAuthorized = _mapper1.IsUserAuthorised(sName, ixCustomer, ixProgram, ixWorkPackage, ixActivity, ixUsercode);

                List<ValuePair> listUserRoleValuePair = new List<ValuePair>();
                var ixUserList= _mapper1.FindUserRoleLike(sName,ixCustomer,ixProgram,ixWorkPackage,ixActivity);
                User user = null;

                foreach (var ixUser in ixUserList)
                {
                    user = new UserMapper(connection).FindById(ixUser);
                    if (user != null)
                    {
                        var name = user.SFirstName + " " + user.SLastName;
                        listUserRoleValuePair.Add(new ValuePair(ixUser, name));
                    }

                }
                return listUserRoleValuePair;    
}     

IN the Mapper Class I am getting ArgumentoutofRangeException in the select query saying “Index and length must refer to a location with in the string” .

public bool IsUserAuthorised(string userRole, int ixCustomer, int ixProgram, int ixWorkPackage, int ixActivity, string ixUser)
            {
                bool result = false;
                SelectAll(Cmd(@"SELECT CASE WHEN Count(*)>=1 THEN 'True' "+
                            " ELSE 'False' END AS IsUserAuthorised " + 
                            " FROM (SELECT  ua.ixUserAuthorization FROM tblechecklistuserroleassignmentxref ra "+ 
                            " INNER JOIN tblechecklistuserrole ur ON ur.ixUserRole=ra.ixUserRole AND ur.sname='?0' "+ 
                            " INNER JOIN tblechecklistuserauthorization ua ON au.ixUserAuthorization=ra.ixUserAuthorization "+ 
                            " AND ua.ixcustomer='?1'AND ua.ixprogram='?2'AND ua.ixworkpackage='?3'AND ua.ixactivity='?4' "+ 
                            " AND ua.ixUser='?5') a ",
                            userRole,
                            ixCustomer,
                            ixProgram,
                            ixWorkPackage,
                            ixActivity,
                            ixUser ),                                                                              
                            delegate(MySqlDataReader reader)
                            {
 result=Convert.ToBoolean(GetDbValue<string>(reader,"isUserAuthorised"));

                                                       });
                 return result;

            }

How to modify my query to get the code to be executed .

  • 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-06-09T11:07:42+00:00Added an answer on June 9, 2026 at 11:07 am

    There is No single quote after question mark.

    public bool IsUserAuthorised(string userRole, int ixCustomer, int ixProgram, int ixWorkPackage, int ixActivity, string ixUser)         
        {              
       bool result = false;     
       SelectAll(Cmd(@"SELECT CASE WHEN Count(*)>=1 THEN 'True'  ELSE 'False' END AS IsUserAuthorised " +                             
     " FROM (SELECT  ua.ixUserAuthorization FROM tblechecklistuserroleassignmentxref ra "+                           
       " INNER JOIN tblechecklistuserrole ur ON ur.ixUserRole=ra.ixUserRole AND ur.sname=?0 "+                          
        " INNER JOIN tblechecklistuserauthorization ua ON au.ixUserAuthorization=ra.ixUserAuthorization "+        
                          " AND ua.ixcustomer=?1 AND ua.ixprogram=?2 AND ua.ixworkpackage=?3AND ua.ixactivity=?4 "+      
                            " AND ua.ixUser=?5) a ",                             userRole,                      
           ixCustomer,
           ixProgram,
           ixWorkPackage, 
           ixActivity,                             ixUser ),                                                                                                           delegate(MySqlDataReader reader)       
    
     { 
    

    result=Convert.ToBoolean(GetDbValue(reader,”isUserAuthorised”));

                                      });               
    

    return result;
    }

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

Sidebar

Related Questions

I'm using MVP pattern and the EF in my C# application. In my database
So i am writing my first Java application using MVP pattern. One of MVPs
I am working on an ASP.NET WebForm application using MVP pattern. For every Web
We've been using the MVP pattern and Winforms with a fair amount of success.
We're using the MVP design pattern here, and we've gone with the presenter-per-UserControl style.
I am using the MVP design pattern and I have registered my presenter as
I have been playing around with the MVP pattern using winforms for the last
When applying the MVP pattern to ASP.NET applications, where does using AJAX to post
I'm working on an ASP.NET webapp using the MVP pattern, and as I'm organizing
I am thinking about implementing a user interface according to the MVP pattern using

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.