예제 #1
0
        public static string GendelID(TextBox txtDeliveryNo)
        {
            int    iicount = 0;
            string ID      = "";

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

            foreach (sp_getcustdeliveryIDResult count in query)
            {
                iicount = count.count.Value;
                iicount = iicount++;
            }
            ++iicount;
            if (iicount.ToString().Length.Equals(1))
            {
                ID = "DeliveryID-" + iicount.ToString().PadLeft(4, '0').ToString();
            }
            else if (iicount.ToString().Length.Equals(2))
            {
                ID = "DeliveryID-" + iicount.ToString().PadLeft(3, '0').ToString();
            }
            else
            {
                ID = "DeliveryID-" + iicount.ToString().PadLeft(2, '0').ToString();
            }

            return(txtDeliveryNo.Text = ID);
        }