/// <summary>
        /// 取得編號 (代碼+數字)
        /// </summary>
        /// <param name="code">代碼</param>
        /// <param name="numLength">數字長度</param>
        /// <returns>編號</returns>
        public string CreateSer_Code_And_Num(string code, int numLength)
        {
            lock (this)
            {
                string result = "";
                string codeSearch = code;

                SerialVO serialVO = CommonDao.GetSerialById(codeSearch);

                int count = 1;
                if (serialVO != null)
                {
                    count += serialVO.Count;
                    serialVO.Count = count;
                    serialVO.Date = ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow);
                    CommonDao.UpdateSerial(serialVO);
                }
                else
                {
                    serialVO = new SerialVO();
                    serialVO.SerialId = codeSearch;
                    serialVO.Count = count;
                    serialVO.Date = ConvertUtil.UtcDateTimeToTaiwanDateTime(DateTime.UtcNow);
                    CommonDao.CreateSerial(serialVO);
                }

                result = string.Format("{0}{1}", code, count.ToString().PadLeft(numLength, '0'));
                return result;
            }
        }
예제 #2
0
        /// <summary>
        /// 更新序號紀錄
        /// </summary>
        /// <param name="serialVO">被更新的序號紀錄</param>
        /// <returns>更新後的序號紀錄</returns>
        public SerialVO UpdateSerial(SerialVO serialVO)
        {
            NHibernateDao.Update(serialVO);

            return serialVO;
        }
예제 #3
0
        /// <summary>
        /// 新增序號紀錄
        /// </summary>
        /// <param name="serialVO">被新增的序號紀錄</param>
        /// <returns>新增後的序號紀錄</returns>
        public SerialVO CreateSerial(SerialVO serialVO)
        {
            NHibernateDao.Insert(serialVO);

            return serialVO;
        }