C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
serial number Posted by rahuly on 25 Mar 2012 at 5:38 AM
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
Report
Re: serial number Posted by jenifaraj on 30 May 2012 at 3:51 AM
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]




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.