Esempio n. 1
0
        public void AttachCounterType(int key, DateTime curDate)
        {
            this.curDate = curDate;

            this.rRCounter = new RRCounter(false);
            if (!rRCounter.Find(curDate.Year, key))
            {
                MessageBox.Show(Properties.Resources.Msg_MissingCounter,
                                Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.PrefixVisible   = rRCounter.GetValue <bool>(AM_Counter.HasPrefix);
            this.PrefixReadOnly  = rRCounter.GetValue <bool>(AM_Counter.PrefixRO);
            this.PrefixMode      = (PrefixSuffixType)rRCounter.GetValue <int>(AM_Counter.PrefixType);
            this.PrefixSeparator = rRCounter.GetValue <string>(AM_Counter.PrefixSep);
            this.PrefixValue     = rRCounter.GetValue <string>(AM_Counter.PrefixValue);

            this.CounterLen          = rRCounter.GetValue <int>(AM_Counter.CodeLen);
            this.CounterNumericValue = 0;

            this.SuffixVisible   = rRCounter.GetValue <bool>(AM_Counter.HasSuffix);
            this.SuffixReadOnly  = rRCounter.GetValue <bool>(AM_Counter.SuffixRO);
            this.SuffixMode      = (PrefixSuffixType)rRCounter.GetValue <int>(AM_Counter.SuffixType);
            this.SuffixSeparator = rRCounter.GetValue <string>(AM_Counter.SuffixSep);
            this.SuffixValue     = rRCounter.GetValue <string>(AM_Counter.SuffixValue);
            this.SuffixValue     = GetSuffixValue();
        }
Esempio n. 2
0
 public CounterManager(int key, int Year, string description, IDocumentBase iDocumentBase)
 {
     counterKey       = key;
     this.description = description;
     trCounter        = new RRCounter(iDocumentBase);
     tuCounterValue   = new DUCounterValue(iDocumentBase);
     currentYear      = Year;
     trCounter.Find(Year, key);
     currentCode = MakeCode();
 }
Esempio n. 3
0
 public void AttachCounterType(int key, DateTime curDate, ERPFramework.Forms.IDocumentBase documentBase)
 {
     System.Diagnostics.Debug.Assert(counterUpdater == null);
     this.rRCounter = new RRCounter(null);
     if (!rRCounter.Find(curDate.Year, key))
     {
         MessageBox.Show(Properties.Resources.Msg_MissingCounter,
                         Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     counterUpdater = new ERPFramework.CounterManager.CounterManager(key, curDate.Year, rRCounter.GetValue <string>(EF_Counter.Description), documentBase);
 }
        /// <summary>
        /// Attach Counter
        /// </summary>
        /// <param name="key"></param>
        /// <param name="curDate"></param>
        /// <param name="transaction"></param>
        public virtual void AttachCounterType(int key, DateTime curDate, IDocumentBase documentBase)
        {
            year = curDate.Year;

            rRCounter = new RRCounter(null);
            if (!rRCounter.Find(curDate.Year, key))
            {
                MetroFramework.MetroMessageBox.Show(GlobalInfo.MainForm, Properties.Resources.Msg_MissingCounter,
                                                    Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            counterProperties = new CounterProperties();
            counterProperties.PrefixVisible   = rRCounter.GetValue <bool>(EF_Counter.HasPrefix);
            counterProperties.PrefixReadOnly  = rRCounter.GetValue <bool>(EF_Counter.PrefixRO);
            counterProperties.PrefixType      = rRCounter.GetValue <PrefixSuffixType>(EF_Counter.PrefixType);
            counterProperties.PrefixSeparator = rRCounter.GetValue <string>(EF_Counter.PrefixSep);
            counterProperties.PrefixDefault   = GetPrefixSuffixValue(counterProperties.PrefixType, year, rRCounter.GetValue <string>(EF_Counter.PrefixValue));
            counterProperties.PrefixValue     = "";
            counterProperties.PrefixLen       = counterProperties.PrefixDefault.Length;

            counterProperties.CounterLen = rRCounter.GetValue <int>(EF_Counter.CodeLen);

            counterProperties.SuffixVisible   = rRCounter.GetValue <bool>(EF_Counter.HasSuffix);
            counterProperties.SuffixReadOnly  = rRCounter.GetValue <bool>(EF_Counter.SuffixRO);
            counterProperties.SuffixType      = rRCounter.GetValue <PrefixSuffixType>(EF_Counter.SuffixType);
            counterProperties.SuffixSeparator = rRCounter.GetValue <string>(EF_Counter.SuffixSep);
            counterProperties.SuffixDefault   = GetPrefixSuffixValue(counterProperties.SuffixType, year, rRCounter.GetValue <string>(EF_Counter.SuffixValue));
            counterProperties.SuffixValue     = "";
            counterProperties.SuffixLen       = counterProperties.SuffixDefault.Length;

            counterText.SetProperties(counterProperties);

            counterUpdater = new CounterManager(key, curDate.Year, rRCounter.GetValue <string>(EF_Counter.Description), documentBase);

            ShowButton = true;
            ImageOn    = Properties.Resources.Automatic16;
            ImageOff   = Properties.Resources.Manual16;

            this.Refresh();
        }
Esempio n. 5
0
        public virtual void AttachCounterType(int key, DateTime curDate, SqlABTransaction transaction)
        {
            System.Diagnostics.Debug.Assert(counterUpdater == null);

            this.curDate = curDate;

            this.rRCounter = new RRCounter(false);
            if (!rRCounter.Find(curDate.Year, key))
            {
                MessageBox.Show(Properties.Resources.Msg_MissingCounter,
                                Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.PrefixVisible  = rRCounter.GetValue <bool>(AM_Counter.HasPrefix);
            this.PrefixReadOnly = rRCounter.GetValue <bool>(AM_Counter.PrefixRO);
            //this.PrefixLength = rRCounter.GetValue<int>(AM_Counter.PrefixLen);
            //this.PrefixMask = rRCounter.GetValue<string>(AM_Counter.PrefixMask);
            this.PrefixMode      = (PrefixSuffixType)rRCounter.GetValue <int>(AM_Counter.PrefixType);
            this.PrefixSeparator = rRCounter.GetValue <string>(AM_Counter.PrefixSep);
            this.defaultPrefix   = rRCounter.GetValue <string>(AM_Counter.PrefixValue);
            this.PrefixValue     = GetPrefixValue();

            //this.CounterType = (CounterTypes)rRCounter.GetValue<int>(AM_Counter.CodeType);
            this.CounterLen          = rRCounter.GetValue <int>(AM_Counter.CodeLen);
            this.CounterNumericValue = 0;

            this.SuffixVisible  = rRCounter.GetValue <bool>(AM_Counter.HasSuffix);
            this.SuffixReadOnly = rRCounter.GetValue <bool>(AM_Counter.SuffixRO);
            //this.SuffixLength = rRCounter.GetValue<int>(AM_Counter.SuffixLen);
            //this.SuffixMask = rRCounter.GetValue<string>(AM_Counter.SuffixMask);
            this.SuffixMode      = (PrefixSuffixType)rRCounter.GetValue <int>(AM_Counter.SuffixType);
            this.SuffixSeparator = rRCounter.GetValue <string>(AM_Counter.SuffixSep);
            this.defaultSuffix   = rRCounter.GetValue <string>(AM_Counter.SuffixValue);
            this.SuffixValue     = GetSuffixValue();

            //this.InvertedSuffixPrefix = rRCounter.GetValue<bool>(AM_Counter.InvertSufPref);

            counterUpdater             = new CounterManager(key, curDate.Year, rRCounter.GetValue <string>(AM_Counter.Description));
            counterUpdater.Transaction = transaction;
            this.Refresh();
        }