/// <summary>
        /// 生成商品條碼
        /// </summary>
        /// <returns></returns>
        public string RandomBarCode()
        {
            Model.ProductBarCodeSet m = this.SelectFirst();
            if (m == null)
            {
                m = new Book.Model.ProductBarCodeSet();
                m.ProductBarCodeSetId = Guid.NewGuid().ToString();
                m.NationalCode        = "471";
                m.CompanyCode         = "00000";
                m.ValueKey            = 0;

                this.Insert(m);
            }
            int    a = m.ValueKey.HasValue ? m.ValueKey.Value : 0;
            string s = string.Empty;

            if (a < 100000)
            {
                s = a.ToString("00000");
                return(m.NationalCode + m.CompanyCode + s);
            }
            else
            {
                //throw new Helper.MessageValueException("條碼編號超出使用範圍,請聯繫管理員!");
                return("");
            }
        }
 /// <summary>
 /// Update a ProductBarCodeSet.
 /// </summary>
 public void Update(Model.ProductBarCodeSet productBarCodeSet)
 {
     //
     // todo: add other logic here.
     //
     try
     {
         BL.V.BeginTransaction();
         accessor.Update(productBarCodeSet);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
Esempio n. 3
0
        public BarForm()
        {
            InitializeComponent();

            if (productBarCodeSetManager.HasRows())
            {
                this._productBarCodeSet = productBarCodeSetManager.SelectFirst();
            }
            else
            {
                this._productBarCodeSet = new Book.Model.ProductBarCodeSet();
                this._productBarCodeSet.ProductBarCodeSetId = Guid.NewGuid().ToString();
                this._productBarCodeSet.NationalCode        = "471";
                this._productBarCodeSet.CompanyCode         = "00000";
                this.tag = 1;
            }
            this.textEdit1.Text = this._productBarCodeSet.NationalCode;
            this.textEdit2.Text = this._productBarCodeSet.CompanyCode;
        }
Esempio n. 4
0
 public void Update(Model.ProductBarCodeSet e)
 {
     this.Update <Model.ProductBarCodeSet>(e);
 }
Esempio n. 5
0
 public void Insert(Model.ProductBarCodeSet e)
 {
     this.Insert <Model.ProductBarCodeSet>(e);
 }