Ejemplo n.º 1
0
        protected override void Execute(CodeActivityContext context)
        {
            try
            {
                string             _SDate    = SDate.Get(context);
                DateTime           _dateTime = new DateTime();
                DateTimeFormatInfo dtFormat  = new System.Globalization.DateTimeFormatInfo();
                switch (convertType)
                {
                case ConvertType.日期时间:
                    dtFormat.ShortDatePattern = "yyyy/MM/dd HH:mm:ss";
                    break;

                case ConvertType.日期:
                    dtFormat.ShortDatePattern = "yyyy/MM/dd";
                    break;

                case ConvertType.时间:
                    dtFormat.ShortTimePattern = "HH:mm:ss";
                    break;

                default:
                    break;
                }
                _dateTime = Convert.ToDateTime(_SDate, dtFormat);
                Date.Set(context, _dateTime);
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "有一个错误产生", e.Message);
                throw;
            }
        }