Document number Retrieval

Source: Internet
Author: User

 

String djbh = "";

VaR DATA = dB. z_ygzz.orderbydescending (zz => ZZ. ygzzid). Take (1 );

Djbh = data. Select (D => D. djbh). firstordefault ();

Find the maximum ID number from the database, find the corresponding djbh, and call nextnumber to find the next document number.


Public static string nextnumber (string basenumber, string firstvalue)
{
String newnumber = ""; // New Value
Int innumber = 1; // carry
Int placevalue; // bit value
Char [] NO = basenumber. tochararray ();

For (INT I = basenumber. Length-1; I> = 0; I --)
{
If (no [I] = '9' & innumber = 1)
{
Innumber = 1;
Newnumber = "0" + newnumber;
}
Else if (innumber = 1 & No [I]> = '0' & No [I] <'9 ')
{
Placevalue = int32.parse (no [I]. tostring ());
Placevalue = (innumber + placevalue );
Innumber = 0;
Newnumber = placevalue. tostring () + newnumber;
}
Else
{
Innumber = 0;
Newnumber = No [I] + newnumber;
}
}
If (basenumber = newnumber)
Newnumber = firstvalue;
Return newnumber;

}

Document number Retrieval

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.