public static string GencusID(TextBox txtcustomerid)
        {
            int    iicount = 0;
            string ID      = "";

            db = new db_MiletecDataContext();
            var query = db.sp_genCustomerID();

            foreach (sp_genCustomerIDResult count in query)
            {
                //count customer registered in the database
                iicount = count.count.Value;
                //increment
                iicount = iicount++;
            }

            ++iicount;
            //substring from lengths 1-2, padleft 4-2
            if (iicount.ToString().Length.Equals(1))
            {
                ID = "CustomerID-" + iicount.ToString().PadLeft(4, '0').ToString();
            }
            else if (iicount.ToString().Length.Equals(2))
            {
                ID = "CustomerID-" + iicount.ToString().PadLeft(3, '0').ToString();
            }
            else
            {
                ID = "CustomerID-" + iicount.ToString().PadLeft(2, '0').ToString();
            }

            return(txtcustomerid.Text = ID);
        }