Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

serial number

rahulyrahuly Posts: 1Member
can i get code for generating serial number through the combination of data and product id.if date is current date and product is produce eg.p1 on the same date then serial number start from 0001,same product i.e. p1 produce on same date then its serial no is 0002,but if date or product change then serial number start from 0001.if product id is same as earlier product id then its serial number start from max of that product serial number which we get earlier.

for eg. date prodid serial number
25/03/2012 p1 0001
25/03/2012 p1 0002
26/03/2012 p1 0001
26/03/2012 p2 0001
26/03/2012 p2 0002

the serial number generation should be in this manner.
regards

Comments

  • jenifarajjenifaraj Posts: 1Member
    Try Something like this.


    public int GenerateSerial()

    { int serial = 0;

    for (int a = 0;
    a < Listofdata.Count;
    a++)
    if (serial == Listofdata[a].Serial)
    {
    serial++;
    a = -1;
    }
    return serial;
    }

    Of course this is a really simple way to go about it. More complex ways would be to use like an MD5 hash out of serialized data in combination with a timestamp to make sure it's always unique (though you'd want to put a check in anyways to make sure.


    [url=http://vijayinfo.in/marketing.html] web development company india [/url]

Sign In or Register to comment.