示例#1
0
        /// <summary>
        /// Queuings the tx number.
        /// </summary>
        /// <param name="txType">Type of the transactions.</param>
        /// <returns></returns>
        public static string QueuingTxNumber(RT2020.DAL.Common.Enums.TxType txType)
        {
            string queuingNumber  = DateTime.Today.Year.ToString() + txType.ToString("d").PadLeft(2, '0');
            long   queuedTxNumber = long.Parse(queuingNumber.PadRight(12, '0'));

            string    lblLastNumber = "LastTxNumber_" + txType.ToString();
            Workplace oWp           = Workplace.Load(Common.Utility.CurrentWorkplaceId);

            if (oWp != null)
            {
                WorkplaceZone oZone = WorkplaceZone.Load(oWp.ZoneId);
                if (oZone != null)
                {
                    string lastNumber = oZone.GetMetadata(lblLastNumber);
                    if (lastNumber != null)
                    {
                        if (lastNumber.Length < 12 && lastNumber.Length > 6)
                        {
                            lastNumber = lastNumber.Insert(6, "00");
                        }

                        queuedTxNumber = long.Parse(lastNumber);
                    }

                    oZone.SetMetadata(lblLastNumber, (queuedTxNumber + 1).ToString());
                    oZone.Save();
                }
            }

            return(queuedTxNumber.ToString());
        }
示例#2
0
        /// <summary>
        /// Queuings the tx number.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="typeName">Name of the type. Enums: Common.Enums.TxType, Common.Enums.POType</param>
        /// <returns>TxNumber</returns>
        public static string QueuingTxNumber <T>(T typeName)
        {
            string queuingNumber = DateTime.Today.Year.ToString();
            string lblLastNumber = "LastTxNumber_";

            switch (typeName.GetType().Name)
            {
            case "TxType":
                RT2020.DAL.Common.Enums.TxType txType = (RT2020.DAL.Common.Enums.TxType)Convert.ChangeType(typeName, typeof(RT2020.DAL.Common.Enums.TxType));
                queuingNumber += txType.ToString("d").PadLeft(2, '0');
                lblLastNumber += txType.ToString();
                break;

            case "POType":
                RT2020.DAL.Common.Enums.POType poType = (RT2020.DAL.Common.Enums.POType)Convert.ChangeType(typeName, typeof(RT2020.DAL.Common.Enums.POType));
                queuingNumber += poType.ToString("d").PadLeft(2, '0');
                lblLastNumber += poType.ToString();
                break;
            }
            long queuedTxNumber = long.Parse(queuingNumber.PadRight(12, '0'));

            WorkplaceZone oZone = WorkplaceZone.Load(Common.Utility.CurrentWorkplaceId);

            if (oZone != null)
            {
                string lastNumber = oZone.GetMetadata(lblLastNumber);
                if (lastNumber != null)
                {
                    if (lastNumber.Length < 12 && lastNumber.Length > 6)
                    {
                        lastNumber = lastNumber.Insert(6, "00");
                    }

                    queuedTxNumber = long.Parse(lastNumber);
                }

                oZone.SetMetadata(lblLastNumber, (queuedTxNumber + 1).ToString());
                oZone.Save();
            }

            return(queuedTxNumber.ToString());
        }