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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:26:12+00:00 2026-06-01T20:26:12+00:00

this is my createcustomer function which returns a customer object to the caller, getCustomerDetail

  • 0

this is my createcustomer function which returns a customer object to the caller,
getCustomerDetail returns a datatable which then populates the customer object properties with the values. Problem is whenever there’s a change in the object, i have to modify this again, how do I solve this problem so that I only need to change in the Customer object and it saves my work of modifying the entire codes?

  public Objects.Customer createCustomer()
    {
        DataTable dt = Database.Master.Customer.getCustomerDetail(objCustomer.Custcode);

        objCustomer.Billaddress1 = dt.Rows[0]["Billaddress1"].ToString();
        objCustomer.Billaddress2 = dt.Rows[0]["Billaddress2"].ToString();
        objCustomer.Billaddress3 = dt.Rows[0]["Billaddress3"].ToString();
        objCustomer.Billcontact = dt.Rows[0]["Billcontact"].ToString();
        objCustomer.Billfaxno = dt.Rows[0]["Billfaxno"].ToString();
        objCustomer.Billpostalcode = dt.Rows[0]["Billpostalcode"].ToString();
        objCustomer.Billremarks = dt.Rows[0]["Billremarks"].ToString();
        objCustomer.Billtelno = dt.Rows[0]["Billtelno"].ToString();
        objCustomer.Custcode = dt.Rows[0]["Custcode"].ToString();
        objCustomer.Custname = dt.Rows[0]["Custname"].ToString();
        objCustomer.Doout = dt.Rows[0]["Doout"].ToString();
        objCustomer.Douom = dt.Rows[0]["Douom"].ToString();
        objCustomer.Inuom = dt.Rows[0]["Inuom"].ToString();
        objCustomer.Location = dt.Rows[0]["Location"].ToString();
        objCustomer.Outremarks1 = dt.Rows[0]["Outremarks1"].ToString();
        objCustomer.Outremarks2 = dt.Rows[0]["Outremarks2"].ToString();
        objCustomer.Outremarks3 = dt.Rows[0]["Outremarks3"].ToString();
        objCustomer.Pacout = dt.Rows[0]["Pacout"].ToString();
        objCustomer.Pacuom = dt.Rows[0]["Pacuom"].ToString();
        objCustomer.Perout = dt.Rows[0]["Perout"].ToString();
        objCustomer.Peruom = dt.Rows[0]["Peruom"].ToString();
        objCustomer.Shipaddress1 = dt.Rows[0]["Shipaddress1"].ToString();
        objCustomer.Shipaddress2 = dt.Rows[0]["Shipaddress2"].ToString();
        objCustomer.Shipaddress3 = dt.Rows[0]["Shipaddress3"].ToString();
        objCustomer.Shipcontact = dt.Rows[0]["Shipcontact"].ToString();
        objCustomer.Shipfaxno = dt.Rows[0]["Shipfaxno"].ToString();
        objCustomer.Shippostalcode = dt.Rows[0]["Shippostalcode"].ToString();
        objCustomer.Shipremaks = dt.Rows[0]["Shipremaks"].ToString();
        objCustomer.Shiptelno = dt.Rows[0]["BilladdresShiptelnos1"].ToString();
        objCustomer.Shortname = dt.Rows[0]["Shortname"].ToString();


        return objCustomer;
    }
  • 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-01T20:26:13+00:00Added an answer on June 1, 2026 at 8:26 pm

    Some ideas:

    • Use an Object Relational Model (ORM) tool like Entity Framework or NHibernate
    • Use a tool like CodeSmith Generator to automatically generate this code for you
    • Use AutoMapper and Reflection to hydrate your object
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This link describes a function on a Money object for adding funds together of
Let's imagine I have a Service method which creates a customer: public Customer CreateCustomer(string
Please, help me with to understand this piece of code: protected Customer() { }
this.update = function() { if (state == game) { if (jaws.pressed(p) && !jaws.paused) {
This question is in context with the problem mentioned in this thread . I'm
I have method which have to add customer: [WebInvoke(UriTemplate = /, Method = POST,
I had a model customer, which I have generated using the following rails g
Can somebody help me with this problem, I dont know why there is an
This is my CreateCustomer method: CustomerData Database::createCustomer(std::string const& name) { CustomerData data(customersDb.size()+1, name); customersDb[data.number()]
I have a datacontract called Customer and have 2 OperationContract contracts like CreateCustomer() and

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.