C#生成日期流水账号

生成类似 LS14120002       
private String GenNewOrder()
{
String newOrder;
var orders = LYOrder.Items;
String lastOrder = ((Order)orders[orders.Count - ]).OrderNum;
//int len = lastOrder.Length;
String dateOld = lastOrder.Substring(, );
int indexOld = Convert.ToInt32(lastOrder.Substring(, ));
String indexNew = (indexOld + ).ToString(); String dateNow = System.DateTime.Now.ToString("yyMM");//获取年月
if (dateOld.Equals(dateNow))//同一个月的单
{ switch (indexNew.Length)
{
case :
indexNew = "" + indexNew;
break;
case :
indexNew = "" + indexNew;
break;
case :
indexNew = "" + indexNew;
break;
}
newOrder = " LS" + dateNow + indexNew; }
else
{
newOrder = " LS" + dateNow + "";
} return newOrder; }
上一篇:k8s使用glusterfs做存储


下一篇:Emit学习(2) - IL - 常用指令介绍