Auto Increase Bill Number in Asp.Net
public string AutoIncreaseBillno()
{
int BillCount=0;
var idKey = (from c in DB.tblCallBookings
orderby c.CallNumber descending
select c).First();
string nextID = "";
BillCount = Convert.ToInt32(idKey.CallNumber.Substring(3));
BillCount++;
if (BillCount<=9)
nextID= "CNO000" + BillCount;
else if (BillCount<=99)
nextID= "CNO00" + BillCount;
else if (BillCount<=999)
nextID= "CNO0" + BillCount;
else if (BillCount <= 9999)
nextID= "CNO" + BillCount;
return nextID;
}
No comments:
Post a Comment