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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:09:42+00:00 2026-06-16T00:09:42+00:00

I have this data access method that return the availability of a lot in

  • 0

I have this data access method that return the availability of a lot in our ERP:

public JDEItemLotAvailability GetLotAvailabilityF41021(string _lot)
        {
            JDEItemLotAvailability _retValue = new JDEItemLotAvailability();
            _retValue.Lot = _lot;
            using (OleDbConnection con = new OleDbConnection(_ERPConfig.ConnectionString))
            {
                OleDbCommand cmd = new OleDbCommand();
                cmd.CommandText =
                    "select max(lilotn) lilotn,max(trim(limcu)) limcu,max(lilocn) lilocn," +
                    "max(lipqoh/100) lipqoh,max(liitm) liitm,max(imlitm) imlitm," +
                    "max(concat(imdsc1,imdsc2)) as imdsc,max(imuom1 ) imuom1 " +
                    "from "+ _ERPConfig .AS400Library +".f41021" + " left outer join proddta.f4101 on liitm=imitm " +
                    "where lilotn = ?";
                cmd.Parameters.AddWithValue("@lilotn", _lot);
                cmd.Connection = con;
                con.Open();
                OleDbDataReader rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    rdr.Read();
                    if (rdr["lilotn"] != DBNull.Value)
                    {
                        _retValue.Code = rdr.GetString(rdr.GetOrdinal("imlitm"));
                        _retValue.ShortCode = (int)rdr.GetDecimal(rdr.GetOrdinal("liitm"));
                        _retValue.Description = rdr.GetString(rdr.GetOrdinal("imdsc"));
                        _retValue.PrimaryUnitCode = rdr.GetString(rdr.GetOrdinal("imuom1"));
                        _retValue.AvailableQuantity = (int)rdr.GetDecimal(rdr.GetOrdinal("lipqoh"));
                        _retValue.BranchPlant = rdr.GetString(rdr.GetOrdinal("limcu"));
                        _retValue.Location = rdr.GetString(rdr.GetOrdinal("lilocn"));
                    }
                }
            }
            return _retValue;
        }

In case the method doesnt have rows the lot that will be returned has only one data field filled. Thats the way i am checking on above bussiness layer if it was successfull or not.

I dont like it. Someone mentioned tuple as a solution.

I guess i will have my method return a tuple<MyObject, bool> for example ?

Added info: I would like to be able to return also an answer to “why the object is null?”. I am thinking of returning a tuple of object and an ENUM specifying the reason.

UPDATE:

I think i am gonna go this route:

Return a NULL object reference from data access method and have the BLL method return a tuple<Myobject,ENUMreason>

  • 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-16T00:09:42+00:00Added an answer on June 16, 2026 at 12:09 am

    How about just returning null and checking if there is any data in the datalayer so that from any place you use it the behavior will be the same.

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

Sidebar

Related Questions

We have a Data Access service in our SOA WCF system. This service is
I have this class: public MyClass { public void initialize(Collection<String> data) { this.data =
My data access classes often have a method called loadDataToEntity or something similar. This
I have a data access layer namespace that has a lot of repeated code
I have application with needs to have access to some sensitive data(in this case
I have a method which have this signature public static IList<T> GetBy<T>(System.Linq.Expressions.Expression<Func<T, bool>> expression)
I have a Data Access Layer library that I would like to make portable.
I am using WCF DataService I have a method: [OperationContract] public List<string> GetAges() {
I have a method that looks like this: try { doStuff(); } catch (Exception
I have a data access class that loads reference data. Each type of entity

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.