/// <summary>
 /// 生成自动编号
 /// </summary>
 /// <param name="prefix">自动生成编号的前缀</param>
 /// <param name="numberFormat">自动生成的编号中自增序列号的长度</param>
 /// <param name="type">自动编号的类型</param>
 /// <returns></returns>
 public string CreateID(string prefix, int serialLen, string type)
 {
     try
     {
         DataContext dc = AttendanceDataContextFactory.Createattendance(ConnectStr);
         StringID num = dc.GetTable<StringID>().SingleOrDefault(item => item.Prefix == prefix && item.Entity == type);
         if (num == null)
         {
             num = new StringID()
             {
                 Prefix = prefix,
                 Serial = 1,
                 Entity = type
             };
             dc.GetTable<StringID>().InsertOnSubmit(num);
         }
         else
         {
             num.Serial += 1;
         }
         dc.SubmitChanges();
         return num.Prefix + num.Serial.ToString("D" + serialLen);
     }
     catch (Exception ex)
     {
         LJH.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex);
     }
     return null;
 }