订单生成序列号代码

strOrderFlag = "未审核";

        string dt = DateTime.Now.ToString();

        stryundanhao = "暂无快递号";

        CW.BLL.Orders bllOrders = new CW.BLL.Orders();

        CW.Model.Orders model = new CW.Model.Orders();

        model.MemberID = Convert.ToInt32(Session["UserLoginID"].ToString());

        model.ProductID = Convert.ToInt32(Session["orderproid"].ToString());

        model.OrderFlag = strOrderFlag;

        model.OrderNum = Convert.ToString(TextBox1.Text.Trim());

        model.OrderTime = Convert.ToString(dt.ToString());

        model.yundanhao = stryundanhao;

        model.beizhu = Convert.ToString(TextBox2.Text.Trim());

        //生成订单序列号

        Random random = new Random();



        string strRandom = (random.Next(1, int.MaxValue).ToString() + "000").Substring(0, 4);



        string orderId = Session["UserLoginID"] + DateTime.Now.ToString("yyyyMMddHHmmssffff") + strRandom;

        //以上结束

        model.OrderStringID = orderId;

        bllOrders.Add(model);

        CW.Common.ShowInfo.AlertAndRedirect("提交订单成功!", "index.aspx", this.Page);

  

你可能感兴趣的:(代码)