Exemplo n.º 1
0
        public string GetDateString(System.DateTime date)
        {
            if (string.IsNullOrEmpty(Format) == false)
            {
                return date.ToString(Format);
            }

            if(stringType == DateTimeStringType.ToString)
            {
                return date.ToString();
            }
            else if(stringType == DateTimeStringType.ToLongDateString)
            {
                return date.ToLongDateString();
            }
            else if(stringType == DateTimeStringType.ToLongTimeString)
            {
                return date.ToLongTimeString();
            }
            else if( stringType == DateTimeStringType.ToShortDateString)
            {
                return date.ToShortDateString();
            }
            else if(stringType == DateTimeStringType.ToShortTimeString)
            {
                return date.ToShortTimeString();
            }
            return date.ToString();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses an object from stream <paramref name="s"/>
        /// </summary>
        public object Parse(System.Xml.XmlReader s, DatatypeR2FormatterParseResult result)
        {
            // Parse base (ANY) from the stream
            ANYFormatter baseFormatter = new ANYFormatter();

            // Parse BL
            BL retVal = baseFormatter.Parse<BL>(s);

            // Get the value
            if (s.GetAttribute("value") != null)
                try
                {
                    retVal.Value = Util.Convert<Boolean>(s.GetAttribute("value"));
                }
                catch (Exception e)
                {
                    result.Code = ResultCode.Error;
                    result.AddResultDetail(new ResultDetail(ResultDetailType.Error, e.Message, s.ToString(), e));
                }

            // Base formatter
            baseFormatter.Validate(retVal, s.ToString(), result);

            return retVal;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Grap the object to a stream
        /// </summary>
        public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {

            ENXP instance = o as ENXP;

            // Start with part type and code attributes
            base.Graph(s, o, result);

            if (instance.NullFlavor != null)
                return;
            
            // Now format our data
            if (instance.Type != null && result.CompatibilityMode != DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture)
                s.WriteAttributeString("partType", Util.ToWireFormat(instance.Type));
            if (instance.Qualifier != null && !instance.Qualifier.IsEmpty)
                s.WriteAttributeString("qualifier", Util.ToWireFormat(instance.Qualifier));
            if (instance.Code != null && result.CompatibilityMode != DatatypeFormatterCompatibilityMode.Canadian)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Code", "ENXP", s.ToString()));
            else if(instance.Code != null)
                s.WriteAttributeString("code", instance.Code);
            if (instance.Value != null)
                s.WriteValue(instance.Value);
            if (instance.CodeSystem != null) // Warn if there is no way to represent this in R1
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystem", "ENXP", s.ToString()));
            if(instance.CodeSystemVersion != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "CodeSystemVersion", "ENXP", s.ToString()));

        }
Exemplo n.º 4
0
        /// <summary>
        /// Graph the object <paramref name="o"/> to <paramref name="s"/>
        /// </summary>
        public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            
            // Cast the object to GTS
            GTS instance = o as GTS;

            // Hull instance corrections
            if (instance.Hull != null)
            {
                if (instance.Hull.NullFlavor != null)
                {
                    instance.NullFlavor = instance.NullFlavor ?? instance.Hull.NullFlavor;
                    instance.Hull.NullFlavor = null;
                    result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Hull.NullFlavor", "NullFlavor", instance.NullFlavor, s.ToString()));
                }
                if (instance.Hull.Flavor != null)
                {
                    instance.Flavor = instance.Flavor ?? instance.Hull.Flavor;
                    instance.Hull.Flavor = null;
                    result.AddResultDetail(new PropertyValuePropagatedResultDetail(ResultDetailType.Warning, "Hull.Flavor", "Flavor", instance.Flavor, s.ToString()));
                }
            }


            // Graph the base
            base.Graph(s, o as ANY, result);


            // Determine what type of hull we have
            if (instance.NullFlavor != null) // Null flavor specified, no hull will be graphed
            {
                return;
            }
            else if(instance.Hull == null)
            {
                result.AddResultDetail(new MandatoryElementMissingResultDetail(ResultDetailType.Error, "Cannot graph a GTS with a Null Hull", s.ToString()));
                return;
            }

            object instanceHull = instance.Hull;

            if (instanceHull.GetType().Name.StartsWith("QS"))
                instanceHull = instanceHull.GetType().GetMethod("TranslateToSXPR").Invoke(instanceHull, null);
            
            // Not for CDA:
            // FIX: We use GetType comparison because IS has side effects in that all IVL, PIVL, etc. are instances.
            if (result.CompatibilityMode == DatatypeFormatterCompatibilityMode.ClinicalDocumentArchitecture && (instanceHull.GetType().Equals(typeof(SXCM<TS>))))
                ;
            else
            {
                string xsiTypeName = Util.CreateXSITypeName(instanceHull.GetType());
                s.WriteAttributeString("xsi", "type", DatatypeFormatter.NS_XSI, xsiTypeName);
            }

            // Output the formatting
            var hostResult = this.Host.Graph(s, (IGraphable)instanceHull);
            result.Code = hostResult.Code;
            result.AddResultDetail(hostResult.Details);

        }
Exemplo n.º 5
0
        /// <summary>
        /// Graph <paramref name="o"/> onto <paramref name="s"/>
        /// </summary>
        /// <param name="s">The stream to graph to</param>
        /// <param name="o">The object to graph</param>
        public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
		// We don't use base.graph() here because we want to control the value property
            ANYFormatter baseFormatter = new ANYFormatter();

            baseFormatter.Graph(s, o, result);
            REAL instance = o as REAL;

            if (instance.NullFlavor != null) return; // Don't graph anymore

            // Precision
            if (instance.Value.HasValue && instance.Precision != 0)
                s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision), DatatypeFormatter.FormatterCulture.NumberFormat.NumberDecimalSeparator), DatatypeFormatter.FormatterCulture));
            else if (instance.Value.HasValue)
                s.WriteAttributeString("value", instance.Value.Value.ToString(DatatypeFormatter.FormatterCulture));

            // Unsupported properties
            if (instance.Expression != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "REAL", s.ToString()));
            if (instance.OriginalText != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "REAL", s.ToString()));
            if (instance.Uncertainty != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "REAL", s.ToString()));
            if (instance.UncertaintyType != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "REAL", s.ToString()));
            if (instance.UncertainRange != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "REAL", s.ToString()));

             
        }
Exemplo n.º 6
0
        public static void TestRegisterUser(System.Guid userId)
        {
            var context = new IPTV2_Model.IPTV2Entities();
            var service = new GomsTfcTv();
            // System.Guid userId = new System.Guid("D9720726-217C-4431-AEAB-468E818132A8");

            var user = context.Users.Find(userId);
            if (user == null)
            {
                var country = context.Countries.Find("US");
                user = new IPTV2_Model.User
                {
                    UserId = userId,
                    EMail = userId.ToString().Substring(10) + "@tfc.tv",
                    FirstName = userId.ToString().Substring(10),
                    LastName = userId.ToString().Substring(10),
                    Password = userId.ToString().Substring(10),
                    RegistrationDate = DateTime.Now,
                    LastUpdated = DateTime.Now,
                    Country = country,
                    State = user.State,
                    City = user.City

                };
                context.Users.Add(user);
                context.SaveChanges();
            }

            var resp = service.RegisterUser(context, userId);
            Assert.Equal(resp.IsSuccess, true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Graph object <paramref name="o"/> onto stream <paramref name="s"/>
        /// </summary>
        /// <param name="s">The XmlWriter to graph to</param>
        /// <param name="o">The object to graph</param>
        public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            // Get an instance ref
            ICodedValue instance_ics = (ICodedValue)o;

            // Do a base format
            base.Graph(s, o, result);

            // Format the coded simple
            if (instance_ics.CodeSystem != null) 
                s.WriteAttributeString("codeSystem", instance_ics.CodeSystem);
            if (instance_ics.CodeSystemName != null)
                s.WriteAttributeString("codeSystemName", instance_ics.CodeSystemName);
            if (instance_ics.CodeSystemVersion != null)
                s.WriteAttributeString("codeSystemVersion", instance_ics.CodeSystemVersion);
            if (instance_ics.DisplayName != null)
                s.WriteAttributeString("displayName", instance_ics.DisplayName);
            if (instance_ics.OriginalText != null) // Original Text
            {
                EDFormatter edFormatter = new EDFormatter();
                s.WriteStartElement("originalText", "urn:hl7-org:v3");
                edFormatter.Graph(s, instance_ics.OriginalText, result);
                s.WriteEndElement();
            }
            if (!String.IsNullOrEmpty(instance_ics.ValueSet))
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValueSet", "CV", s.ToString()));
            if (!String.IsNullOrEmpty(instance_ics.ValueSetVersion))
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "ValueSetVersion", "CV", s.ToString()));


        }
Exemplo n.º 8
0
        public override void Graph(System.Xml.XmlWriter s, object o, DatatypeFormatterGraphResult result)
        {
            // Want to control the output of value
            ANYFormatter baseFormatter = new ANYFormatter();

            baseFormatter.Graph(s, o, result);
            MO instance = o as MO;

            if (instance.NullFlavor != null) return; // Don't graph anymore

            if (instance.Expression != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Expression", "PQ", s.ToString()));
            if (instance.OriginalText != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "OriginalText", "PQ", s.ToString()));
            if (instance.Uncertainty != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "Uncertainty", "PQ", s.ToString()));
            if (instance.UncertaintyType != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertaintyType", "PQ", s.ToString()));
            if (instance.UncertainRange != null)
                result.AddResultDetail(new UnsupportedDatatypeR1PropertyResultDetail(ResultDetailType.Warning, "UncertainRange", "PQ", s.ToString()));
            if (instance.Currency != null)
                s.WriteAttributeString("currency", instance.Currency);

            // Precision
            if (instance.Precision != null && instance.Precision != 0 && instance.Value.HasValue)
                s.WriteAttributeString("value", instance.Value.Value.ToString(String.Format("0.{0}", new String('0', instance.Precision), DatatypeFormatter.FormatterCulture.NumberFormat.NumberDecimalSeparator), DatatypeFormatter.FormatterCulture));
            else if (instance.Value.HasValue)
                s.WriteAttributeString("value", instance.Value.Value.ToString(DatatypeFormatter.FormatterCulture));

            
        }
Exemplo n.º 9
0
		/// <summary> Read the specified integer property.
		/// <p>
		/// Throws an exception if the property value isn't an integer.
		/// *
		/// </summary>
		/// <param name="key">the name of the property
		/// </param>
		/// <returns> the integer value of the property
		/// 
		/// </returns>
		public static int getIntProperty(System.Configuration.AppSettingsReader properties, System.Object key)
		{
			System.String string_Renamed = (System.String) properties.GetValue(key.ToString(), Type.GetType("System.String"));
			
			if (string_Renamed == null)
				System.Console.Error.WriteLine("WARN: couldn't find integer value under '" + key + "'");
			
			return System.Int32.Parse((System.String) properties.GetValue(key.ToString(), Type.GetType("System.String")));
		}
Exemplo n.º 10
0
        public static string GetEnumDescription(System.Enum value)
        {
            // source http://blog.spontaneouspublicity.com/associating-strings-with-enums-in-c

            var fi = value.GetType().GetField(value.ToString());

            var attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);

            return attributes.Length > 0 ? attributes[0].Description : value.ToString();
        }
Exemplo n.º 11
0
 public virtual void AddAdministrator(System.Guid userId)
 {
     if (Administrators.Count(x => x.UserId == userId.ToString()) == 0)
     {
         Administrators.Add(new ApplicationAdministrator()
         {
             ApplicationId = this.Id,
             UserId = userId.ToString()
         });
     }
 }
        /// <summary>
        /// 引数で指定された内容をログに書き込む
        /// </summary>
        /// <param name="errBody"></param>
        public void callErrMsg(System.Exception e)
        {
            //ログ文の作成
            logStr = "[ERROR] " + DateTime.Now + " " + e.ToString() + "\r\n";

            //メッセージボックス
            MessageBox.Show(e.ToString(), "Liplis");

            //ログ書込
            try { System.IO.File.AppendAllText(logFilePath, logStr, enc); }
            catch { }
        }
Exemplo n.º 13
0
            public override string ToString(OutputFormat format)
            {
                switch (format)
                {
                default:
                case OutputFormat.Compact:
                case OutputFormat.Basic:
                    return(Companion.ToString(format));

                case OutputFormat.Extended:
                    return("[" + Companion.ToString(format) + "]");
                }
            }
Exemplo n.º 14
0
		/// <summary> Read the specified float property.
		/// <p>
		/// Throws an exception if the property value isn't a floating-point number.
		/// *
		/// </summary>
		/// <param name="key">the name of the property
		/// </param>
		/// <returns> the float value of the property
		/// 
		/// </returns>
		public static float getFloatProperty(System.Configuration.AppSettingsReader properties, System.Object key)
		{
			System.String string_Renamed=null;
			try
			{
				string_Renamed = (System.String) properties.GetValue(key.ToString(), Type.GetType("System.String"));
			}
			catch//was: if (string_Renamed == null)
			{
				System.Console.Error.WriteLine("WARN: couldn't find float value under '" + key + "'");
				return 0;
			}
			return System.Single.Parse((System.String) properties.GetValue(key.ToString(), Type.GetType("System.String")));
		}
        /// <summary>
        /// Returns the value of the DescriptionAttribute if the specified Enum value has one.
        /// If not, returns the ToString() representation of the Enum value.
        /// </summary>
        /// <param name="value">The Enum to get the description for</param>
        /// <returns></returns>
        public static string GetDescription(System.Enum value)
        {
            FieldInfo fi = value.GetType().GetField(value.ToString());

            if (fi == null)
            {
                return value.ToString();
            }
            DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
            if (attributes.Length > 0)
                return attributes[0].Description;
            else
                return value.ToString();
        }
Exemplo n.º 16
0
        public WebAPIConnection(AuthenticationType AuthType,string Hostname, string Username, System.Security.SecureString Password)
        {
            _Hostname = Hostname;
            _Username = Username;
            _AuthType = AuthType;
            _Client = new RestSharp.RestClient(Hostname);

            if (AuthType == AuthenticationType.Basic)
                _Client.Authenticator = new RestSharp.Authenticators.HttpBasicAuthenticator(Username, Password.ToString());
            else if (AuthType == AuthenticationType.Kerberos)
            {
                System.Net.NetworkCredential netCred = new System.Net.NetworkCredential(Username, Password.ToString());
                _Client.Authenticator = new RestSharp.Authenticators.NtlmAuthenticator(netCred);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 返回枚举类型的描述信息
        /// </summary>
        /// <param name="myEnum"></param>
        /// <returns></returns>
        private string GetDiscription(System.Enum myEnum)
        {

            System.Reflection.FieldInfo fieldInfo = myEnum.GetType().GetField(myEnum.ToString());
            object[] attrs = fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), true);
            if (attrs != null && attrs.Length > 0)
            {
                DescriptionAttribute desc = attrs[0] as DescriptionAttribute;
                if (desc != null)
                {
                    return desc.Description.ToLower();
                }
            }
            return myEnum.ToString();
        }
Exemplo n.º 18
0
		public virtual XLRTargetNode loadNode(System.Globalization.CultureInfo fileLocale, System.String fileId, System.Globalization.CultureInfo locale, System.String id)
		{
			System.String key = getKey(fileLocale, fileId);
			XLRFile f = (XLRFile) filedict[key];
			
			if (f == null)
			{
				System.String resource = key.replaceAll("\\.", "/") + ".xlr";
				//UPGRADE_ISSUE: Method 'java.lang.ClassLoader.getResource' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassLoader'"
				//UPGRADE_ISSUE: Method 'java.lang.Class.getClassLoader' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetClassLoader'"
				System.Uri url = GetType().getClassLoader().getResource(resource);
				
				if (url != null)
				{
					f = new XLRFile(this, fileId, url);
					filedict[key] = f;
				}
			}
			if (f != null)
			{
				f.load();
				XLRMessageNode messageNode = (XLRMessageNode) nodedict[id];
				if (messageNode != null)
				{
					XLRTargetNode targetNode = messageNode.getTarget(locale.ToString());
					return targetNode;
				}
			}
			
			return null;
		}
Exemplo n.º 19
0
 public static void WriteStackTrace(System.Exception throwable, System.IO.TextWriter stream)
 {
     //	        stream.WriteLine(throwable.Message);
     //		stream.WriteLine(throwable.StackTrace);
         stream.WriteLine(throwable.ToString());
     stream.Flush();
 }
Exemplo n.º 20
0
        /// <summary>
        /// コントローラのインスタンス生成を制御
        /// </summary>
        /// <param name="requestContext"></param>
        /// <param name="controllerName"></param>
        /// <returns></returns>
        public override IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("Create controller instance name is " + controllerName);
                if (log.IsDebugEnabled)
                {
                    log.Debug("RequestContext: " + requestContext.ToString());
                }
            }

            var controllerType = base.GetControllerType(requestContext, controllerName);
            if (log.IsDebugEnabled)
            {
                if (controllerType != null)
                {
                    log.Debug("ControllerType: " + controllerType.ToString());
                }
                else
                {
                    log.Debug("ControllerType is null.");
                }
            }
            var controllerInstance = base.GetControllerInstance(requestContext, controllerType);

            // Implement属性を参照してServiceのインジェクション
            this.InjectService(controllerInstance);

            return controllerInstance;
        }
Exemplo n.º 21
0
        public static object Invoke(System.Windows.Forms.Control obj, string methodName, params object[] paramValues)
        {
            Delegate del = null;
            DateTime now  = DateTime.Now;
            TimeSpan ts = now - lastCleanTime;
            if(ts.TotalHours>5)
            {
                delLookup.Clear();
                lastCleanTime = now;
            }
            string delKey = obj.GetType().Name+"."+methodName+obj.GetHashCode().ToString() + obj.ToString();
            if(delLookup.ContainsKey(delKey))
            {
                del =(Delegate) delLookup[delKey];
            }
            else
            {
                string key = obj.GetType().Name + "." + methodName;
                Type tp;
                if (methodLookup.Contains(key))
                {
                    tp = (Type)methodLookup[key];
                }
                else
                {
                    Type objType = obj.GetType();
                    object[] signatures = new object[paramValues.Length + 1];
                    signatures[0] = methodName;
                    Array.Copy(paramValues, 0, signatures, 1, paramValues.Length);
                    MemberInfo[] mInfo = objType.FindMembers(MemberTypes.Method, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public, methodFilter, signatures);
                    if (mInfo.Length != 1) return null;
                    MethodInfo methInfo = (MethodInfo)mInfo[0];
                    Type[] paramList = new Type[methInfo.GetParameters().Length];
                    ParameterInfo[] paramInfos = methInfo.GetParameters();
                    int n = 0;
                    foreach (ParameterInfo pi in paramInfos)
                    {
                        paramList[n++] = pi.ParameterType;
                    }
                    TypeBuilder typeB = builder.DefineType("Del_" +
                        obj.GetType().Name + "_" + methodName,
                        TypeAttributes.Class | TypeAttributes.AutoLayout | TypeAttributes.Public | TypeAttributes.Sealed,
                        typeof(MulticastDelegate), PackingSize.Unspecified);
                    ConstructorBuilder conB = typeB.DefineConstructor(MethodAttributes.HideBySig | MethodAttributes.SpecialName
                        | MethodAttributes.RTSpecialName, CallingConventions.Standard,
                        new Type[] { typeof(object), typeof(IntPtr) });
                    conB.SetImplementationFlags(MethodImplAttributes.Runtime);
                    MethodBuilder mb = typeB.DefineMethod("Invoke",
                        MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig,
                        methInfo.ReturnType, paramList);
                    mb.SetImplementationFlags(MethodImplAttributes.Runtime);
                    tp = typeB.CreateType();
                    methodLookup.Add(key, tp);
                }
                del = MulticastDelegate.CreateDelegate(tp, obj, methodName);
                delLookup.Add(delKey, del);
            }

            return obj.Invoke(del, paramValues);
        }
 public CustomPropertyCells(System.DateTime value)
 {
     var current_culture = System.Globalization.CultureInfo.CurrentCulture;
     string formatted_dt = value.ToString(current_culture);
     this.Value = $"DATETIME(\"{formatted_dt}\")";
     this.Type = 5;
 }
Exemplo n.º 23
0
		private static object RunMethod(System.Type t, string methodName, object objInstance, BindingFlags eFlags, System.Type[] parameterDefinitions, object[] parameterValues)
		{
			foreach (MethodInfo m in t.GetMethods(eFlags))
			{
				if (m.Name == methodName && MethodMatchesParameterDefinitions(m, parameterDefinitions))
				{
					if (parameterDefinitions.Length == parameterValues.Length + 1)
					{
						throw new NotImplementedException("The case in which no args are passed to params parameter.");
					}
						// if only parameter is params arg, compiler collapses it. this re-expands it: 
					else if (parameterDefinitions[parameterDefinitions.Length - 1] != parameterValues[parameterValues.Length - 1].GetType())
					{
						Array unknownTypeArray = Array.CreateInstance(parameterValues[0].GetType(), parameterValues.Length);
						parameterValues.CopyTo(unknownTypeArray, 0);

						return m.Invoke(objInstance, new object[] { unknownTypeArray });
					}
					else
					{
						return m.Invoke(objInstance, parameterValues);
					}
					
				}
			}
			throw new ArgumentException("There is no method '" + methodName + "' for type '" + t.ToString() + "' which matched the parameter type list.");
		}
Exemplo n.º 24
0
 /// <summary>
 /// Writes the action data.
 /// </summary>
 /// <param name="keyEvents">The key events.</param>
 /// <param name="myKey">My key.</param>
 /// <param name="delayTime">The delay time.</param>
 public void WriteData(string keyEvents, System.Windows.Forms.Keys myKey, int delayTime)
 {
     XElement newAction = new XElement("Action", new XAttribute("Type", "KeyboardAct"), new XAttribute("DelayTime", delayTime.ToString()),
       new XElement("KeyData", ((int)myKey).ToString(), new XAttribute("FriendlyName", myKey.ToString())),
       new XElement("KeyEvent", keyEvents));
     xRoot.Add(newAction);
 }
Exemplo n.º 25
0
 public Dias(System.DayOfWeek day)
 {
     switch (day.ToString())
     {
         case "Sunday":
             Id = 1;
             Detalle = "Domingo";
             break;
         case "Monday":
             Id = 2;
             Detalle = "Lunes";
             break;
         case "Tuesday":
             Id = 3;
             Detalle = "Martes";
             break;
         case "Wednesday":
             Id = 4;
             Detalle = "Miercoles";
             break;
         case "Thursday":
             Id = 5;
             Detalle = "Jueves";
             break;
         case "Friday":
             Id = 6;
             Detalle = "Viernes";
             break;
         case "Saturday":
             Id = 7;
             Detalle = "Sábado";
             break;
     }
 }
Exemplo n.º 26
0
 public static void Convert(
     System.Type conversionClass,
     Bam.Core.Settings toolSettings,
     Bam.Core.Module module,
     XcodeBuilder.Configuration configuration)
 {
     var moduleType = typeof(Bam.Core.Module);
     var xcodeConfigurationType = typeof(XcodeBuilder.Configuration);
     foreach (var i in toolSettings.Interfaces())
     {
         var method = conversionClass.GetMethod("Convert", new[] { i, moduleType, xcodeConfigurationType });
         if (null == method)
         {
             throw new Bam.Core.Exception("Unable to locate method {0}.Convert({1}, {2}, {3})",
                 conversionClass.ToString(),
                 i.ToString(),
                 moduleType,
                 xcodeConfigurationType);
         }
         try
         {
             method.Invoke(null, new object[] { toolSettings, module, configuration });
         }
         catch (System.Reflection.TargetInvocationException exception)
         {
             throw new Bam.Core.Exception(exception.InnerException, "Xcode conversion error:");
         }
     }
 }
Exemplo n.º 27
0
        //Method that gets all Comments of specific user
        public IList<UserCommentDTO> GetAllUserComments(System.Guid userID)
        {
            IList<UserCommentDTO> ListOfComments = new List<UserCommentDTO>();

            using (var context = new CinemaEntities())
            {
                var results = (from com in context.Comments.Include("Movie")
                               where com.UserID == userID
                               select com);

                if (results!=null)
                {
                    foreach (var item in results)
                    {
                        UserCommentDTO row = new UserCommentDTO();
                        row.userID = userID.ToString();
                        row.commentID = item.CommentID;
                        row.movieID = item.MovieID;
                        row.Content = item.Content;
                        row.MovieTitle = item.Movie.Title;
                        ListOfComments.Add(row);
                    }
                }
            }

            return ListOfComments;
        }
Exemplo n.º 28
0
        private void ServerAction(StreamReader sr, StreamWriter sw,System.Net.EndPoint endPoint)
        {
            sw.WriteLine("OK");
            string requestType = sr.ReadLine();
            switch (requestType.ToLower())
            {
                case "fetchserverinfo":

                    string serverInfo = ServerInfo.GetDecryptedInfo();
                    if (string.IsNullOrEmpty(serverInfo))
                    {
                        GlobalVariables.Logger.Error("配置信息为空,请检查");
                    }
                    sw.WriteLine(serverInfo);

                    break;
                case "uploadmsg":
                    string msg = sr.ReadLine();
                    msgHandler.Invoke(endPoint.ToString()+ msg);
                    break;
                case "validclient":
                   //验证客户端有效性
                    string validResult;
                    string deviceNo = sr.ReadLine();
                    string targetUrl = GlobalVariables.ClientValidationUrl.Replace("%d",deviceNo);
                    bool isValid = FuLib.WebRequestUnit.CheckWebServer(GlobalVariables.ClientValidationUrl, out validResult);

                    sw.Write(validResult);

                    msgHandler("客户端验证状态:"+validResult);
                    break;

                default: break;
            }
        }
Exemplo n.º 29
0
 public void setProperty(string field, System.Object value)
 {
     if (!list.ContainsKey(field))
         list.Add(field, value.ToString());
     else
         list[field] = value.ToString();
 }
Exemplo n.º 30
0
		static internal string ToString(string path, FileMode mode, FileAccess access, FileShare share)
		{
			// http://ee.php.net/fopen

			//'r'  	 Open for reading only; place the file pointer at the beginning of the file.
			//'r+' 	Open for reading and writing; place the file pointer at the beginning of the file.
			//'w' 	Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
			//'w+' 	Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
			//'a' 	Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
			//'a+' 	Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
			//'x' 	Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call.
			//'x+' 	Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. 

			if (mode == FileMode.OpenOrCreate)
			{
				if (access == FileAccess.Write)
				{
					if (File.Exists(path))
						return "r+b";
					else
						return "x+b";
				}

				if (access == FileAccess.Read)
				{
					if (File.Exists(path))
						return "rb";
					else
						return "xb";
				}
			}

			var e = new { mode, access, share };
			throw new NotImplementedException(e.ToString());
		}
Exemplo n.º 31
0
    	// TODO: Fix lifecycle - https://developer.xamarin.com/guides/android/application_fundamentals/services/part_1_-_started_services/#Implementing_IntentService.OnHandleIntent
        public Task OpenDefaultBrowser(System.Uri uri)
	{
            var intent = new Intent (Intent.ActionView, Android.Net.Uri.Parse(uri.ToString()));
    	    StartActivity(intent);

            return Task.FromResult(true);
	}
Exemplo n.º 32
0
 /// <summary>
 /// Returns data in string
 /// </summary>
 /// <returns>Satellite data in string</returns>
 public override string ToString()
 {
     return($@"System: {(System == SystemType.Unknown ? "Unknown" : System.ToString())}
             <br />
             PRN number: {PRN}
             <br />
             Launch date: {(Launch.HasValue ? Launch.Value.ToString("yyyy.MM.dd HH:mm") : "Unknown")}");
 }
Exemplo n.º 33
0
 public LogRecord(System system, Level level, string username, string message, string exception)
 {
     this.LogTime   = DateTime.Now;
     this.System    = system.ToString();
     this.Level     = level.ToString();
     this.Username  = username;
     this.Message   = message;
     this.Exception = exception;
 }
Exemplo n.º 34
0
 public List <Claim> ToClaims()
 {
     return(new List <Claim>()
     {
         new Claim(nameof(System), System.ToString()),
         new Claim(nameof(Social), Social.ToString()),
         new Claim(nameof(UserId), UserId),
         new Claim(nameof(DomainId), DomainId),
         new Claim(nameof(ProjectId), ProjectId ?? ""),
         new Claim(nameof(UserProjectAssignmentId), UserProjectAssignmentId ?? ""),
         new Claim(nameof(Role), Role.ToString()),
     });
 }
Exemplo n.º 35
0
        public static void Error(string message, System system = System.Generic)
        {
#if INCLUDE_ALL_LOGS
            if (!CheckLevel(system))
            {
                return;
            }

            var    colorPair = GetColorPair(system);
            string label     = system == System.Generic ? "Info" : system.ToString();
            UnityEngine.Debug.LogError(colorPair.first + label + ": " + message + colorPair.second);
#endif
        }
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("TDDISystemUnion(");
            bool          __first = true;

            if (System != null && __isset.System)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("System: ");
                __sb.Append(System == null ? "<null>" : System.ToString());
            }
            if (PhysicalComponent != null && __isset.PhysicalComponent)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PhysicalComponent: ");
                __sb.Append(PhysicalComponent == null ? "<null>" : PhysicalComponent.ToString());
            }
            if (LogicalComponent != null && __isset.LogicalComponent)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("LogicalComponent: ");
                __sb.Append(LogicalComponent == null ? "<null>" : LogicalComponent.ToString());
            }
            if (SafetyRelatedSystem != null && __isset.SafetyRelatedSystem)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("SafetyRelatedSystem: ");
                __sb.Append(SafetyRelatedSystem == null ? "<null>" : SafetyRelatedSystem.ToString());
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
Exemplo n.º 37
0
        public override string ToString()
        {
            StringBuilder __sb    = new StringBuilder("TDDIDesignArtifactUnion(");
            bool          __first = true;

            if (System != null && __isset.System)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("System: ");
                __sb.Append(System == null ? "<null>" : System.ToString());
            }
            if (Function != null && __isset.Function)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Function: ");
                __sb.Append(Function == null ? "<null>" : Function.ToString());
            }
            if (Configuration != null && __isset.Configuration)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Configuration: ");
                __sb.Append(Configuration == null ? "<null>" : Configuration.ToString());
            }
            if (Signal != null && __isset.Signal)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Signal: ");
                __sb.Append(Signal == null ? "<null>" : Signal.ToString());
            }
            if (SystemBoundary != null && __isset.SystemBoundary)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("SystemBoundary: ");
                __sb.Append(SystemBoundary == null ? "<null>" : SystemBoundary.ToString());
            }
            if (Context != null && __isset.Context)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Context: ");
                __sb.Append(Context == null ? "<null>" : Context.ToString());
            }
            if (LifecycleCondition != null && __isset.LifecycleCondition)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("LifecycleCondition: ");
                __sb.Append(LifecycleCondition == null ? "<null>" : LifecycleCondition.ToString());
            }
            if (Port != null && __isset.Port)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("Port: ");
                __sb.Append(Port == null ? "<null>" : Port.ToString());
            }
            if (PerfChars != null && __isset.PerfChars)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("PerfChars: ");
                __sb.Append(PerfChars == null ? "<null>" : PerfChars.ToString());
            }
            if (ArchitecturePackage != null && __isset.ArchitecturePackage)
            {
                if (!__first)
                {
                    __sb.Append(", ");
                }
                __first = false;
                __sb.Append("ArchitecturePackage: ");
                __sb.Append(ArchitecturePackage == null ? "<null>" : ArchitecturePackage.ToString());
            }
            __sb.Append(")");
            return(__sb.ToString());
        }
Exemplo n.º 38
0
 public override string ToString()
 {
     return(System.ToString());
 }
Exemplo n.º 39
0
 public override string ToString()
 {
     return(string.Concat(System.ToString(), "/", Browser.ToString()));
 }
Exemplo n.º 40
0
 public string ToShortCode() => $"{System.ToString()}|{Unit.ToString()}";