Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
 public void SetProperties(CounterProperties properties)
 {
     Properties = properties;
 }
Ejemplo n.º 3
0
 public void SetProperties(CounterProperties properties)
 {
     Properties = properties;
     counterHelper.SetProperties(properties);
 }