/// <summary>
 /// To string override to visualize tag and vr of element
 /// </summary>
 /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
 public override string ToString()
 {
     if (DatType == typeof(byte) && Data_.Count > 10)
     {
         return(string.Format("{0} ({1}) -> {2}...", Tag, VR,
                              DataContainer != null ? string.Join(" | ", Data_.Take(10)) : "null"));
     }
     return(string.Format("{0} ({1}) -> {2}", Tag, VR,
                          DataContainer != null ? string.Join(" | ", Data_) : "null"));
 }
Beispiel #2
0
        /// <summary>
        ///     Method used to read out unknown VR types (not in the dictionary).
        /// </summary>
        /// <typeparam name="T">the type of value to try to read out</typeparam>
        /// <param name="outValue">the value read</param>
        /// <param name="tx">the transfer syntax to try (default is Implicit little endian)</param>
        /// <returns>whether or not the read was successfull</returns>
        public bool TryReadAs <T>(out T outValue) where T : IDICOMElement
        {
            VR vr = VRDictionary.GetVRFromType(typeof(T));

            try
            {
                IDICOMElement el = ElementFactory.GenerateElement(Tag, vr, Data_.ToArray(), TransferSyntax);
                outValue = (T)el;
                return(true);
            }
            catch (Exception e)
            {
                EvilLogger.Instance.Log("Couldn't cast unknown type as type {0} for {1}", LogPriority.ERROR, typeof(T),
                                        Tag);
                outValue = default(T);
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        ///     Method used to read out unknown VR types (not in the dictionary).
        /// </summary>
        /// <typeparam name="T">the type of value to try to read out</typeparam>
        /// <param name="outValue">the value read</param>
        /// <param name="tx">the transfer syntax to try (default is Implicit little endian)</param>
        /// <returns>whether or not the read was successfull</returns>
        public bool TryReadAs <T>(out T outValue) where T : IDICOMElement
        {
            var vr = VRDictionary.GetVRFromType(typeof(T));

            try
            {
                var el = ElementFactory.GenerateElement(Tag, vr, Data_.ToArray(), TransferSyntax, StringEncoding.ISO_IR_192);
                outValue = (T)el;
                return(true);
            }
            catch (Exception e)
            {
                _logger.LogInformation("Couldn't cast unknown type as type {0} for {1}", LogPriority.ERROR, typeof(T),
                                       Tag);
                outValue = default(T);
                return(false);
            }
        }
Beispiel #4
0
        public Model mGetTipoComision(ConfigWeb ConfigWeb_)
        {
            Model modeloRpta = new Model();

            try
            {
                string sCMD = "EXEC SAB_TipoComision_Listar ";
                modeloRpta = new Data_().mExceBD_SQL(ConfigWeb_, sCMD);
            }
            catch (Exception ex)
            {
                modeloRpta.bEstado = false;
                modeloRpta.iCodigo = sCodErrorLogicAPi;
                modeloRpta.sRpta   = String.Format("Class: {0} > StackTrace: {1} - Message: {2} ", "Logic_", ex.StackTrace, ex.Message);
                modeloRpta.obj     = null;
            }

            return(modeloRpta);
        }
Beispiel #5
0
        public Model mListaFiltroRentaFija(ConfigWeb ConfigWeb_, string sTipoRenta, string sNemonico)
        {
            Model modeloRpta = new Model();

            try
            {
                string sCMD = "EXEC [SAB_Nemonico_Listar] '" + sTipoRenta + "','" + sNemonico + "' ";
                modeloRpta = new Data_().mExceBD_SQL(ConfigWeb_, sCMD);
            }
            catch (Exception ex)
            {
                modeloRpta.bEstado = false;
                modeloRpta.iCodigo = sCodErrorLogicAPi;
                modeloRpta.sRpta   = String.Format("Class: {0} > StackTrace: {1} - Message: {2} ", "Logic_", ex.StackTrace, ex.Message);
                modeloRpta.obj     = null;
            }

            return(modeloRpta);
        }
Beispiel #6
0
        private string DealToNeibu(string result)
        {
            StringBuilder str = new StringBuilder();
            Data_         d   = new Data_().JsonTo(result);

            if (d.result != null)
            {
                str.Append(DateTime.Now.ToString("yyyy-M-d HH:mm") + " 新一波福利,手慢无!" + _ + "别说我没告诉你!" + _);
                foreach (Result_ r in d.result)
                {
                    str.Append("--------------------------------------" + _);
                    str.Append((r.IsTmall == "1" ? "【天猫】 " : "") + r.D_title + " 【券后价:" + r.Price + "】" + _);
                    str.Append(r.Quan_price + "元券:" + r.Quan_m_link + _);
                    str.Append("下单:" + r.ali_click + _);
                }
                str.Append("--------------------------------------" + _);
                str.Append("实时更新群:278973739 " + _);
            }
            return(str.ToString());
        }