title: Will My order number generator work correctly?
body: <p>I need order number,that is not order ID but is unique. I generate from time,member id,random.
  ...</p>
  
  <pre><code>bll.DataAccess.BeginTransaction();            
      try
      {
          T_ProductOrd order = new T_ProductOrd();
          DateTime tm = DateTime.Now;
          order.F_MemberID = user.F_MemberID;
          order.F_Status = (short)OrderStatus.waitpay;
          order.F_Price = items.Sum(i =&gt; i.num * i.price);
          do {                 
              order.F_OrderNum = tm.ToString("yyyyMMdd") + (user.F_MemberID % 1000).ToString("0000") + new Random((int)tm.Ticks).Next(0, 9999).ToString("0000");
              bll.Save(order);
          } while (bll.FindCount(p =&gt; p.F_OrderNum == order.F_OrderNum) &gt; 1);   
  </code></pre>
  
  <p>My question is :do...while query and regenerate in database transaction will work fine?or still possible throw unique conflict when commit?
  If is not work fine 100%.how can I fixed?          </p>