public static string GetGuaranteeCode() { BuyGuaranteeDT guaranteeDT = new BuyGuaranteeDT(); string mmyy = getMMyy(); DataTable invoiceTable = guaranteeDT.GetByCond("Code like 'BH" + mmyy + "%'", " Code DESC"); string prefix = "BH" + mmyy; string suffix = "0001"; if (invoiceTable != null && invoiceTable.Rows.Count > 0) { suffix = getSuffix(invoiceTable.Rows[0]["Code"].ToString()); } return(prefix + suffix); }