Ejemplo n.º 1
0
        public static ListItem[] GetList(SerialType t, bool addAll)
        {
            if (t == SerialType.Day)
            {
                var _end = new List <ListItem>();
                if (addAll)
                {
                    _end.Add(new ListItem("All", string.Empty));
                }

                for (int i = 1; i < 32; i++)
                {
                    _end.Add(new ListItem(i.ToString("d2")));
                }
                return(_end.ToArray());
            }
            var nodes = from node in Current.XmlRoot.Descendants(t.ToString()).Single().Descendants("item")
                        select new ListItem(node.Value, node.Attribute("value").Value);

            if (addAll)
            {
                var q = nodes.ToList();
                q.Insert(0, new ListItem("All", string.Empty));
                return(q.ToArray());
            }
            else
            {
                return(nodes.ToArray());
            }
        }
Ejemplo n.º 2
0
        public static void AddModule(string application, bool enable, string module, SerialType sType, DateTime expiration, string serial)
        {
            SerialModule sd = new SerialModule();

            sd.Application = application;
            sd.Module      = module;
            sd.Enable      = enable.ToString();
            sd.SerialType  = sType.ToString();
            sd.Expiration  = expiration.ToShortDateString();
            sd.SerialNo    = serial;

            SerialData.Modules.Add(sd);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据业务类型枚举,获取实际的业务类型和相应前缀
        /// </summary>
        /// <param name="type">业务枚举</param>
        /// <returns></returns>
        public static TypePrefix GetSerialTypeAndPrefix(SerialType type)
        {
            var tp = new TypePrefix {
                Type = type.ToString().ToLower()
            };

            switch (type)
            {
            case SerialType.Normal:
                tp.IsRandom = true;
                return(tp);

            default:
                tp.IsRandom = true;
                return(tp);
            }
        }