Ejemplo n.º 1
0
        public void EqualsReturnFalseWhenCallsWithOtherValueObject()
        {
            ParameterName otherValue = new ParameterName(Exp.Namespace + "OtherName");

            Assert.False(basicValue == otherValue);
            Assert.False(basicValue.Equals(otherValue));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public Boolean Equals(ActualParameterElement other)
 {
     return(EqualityHelper.IsNullOrReferenceEqual(other, this) ??
            ParameterName.Equals(other.ParameterName) &&
            Position.Equals(other.Position) &&
            Equals(Value, other.Value));
 }
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region Bolierplate
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory =
                executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService service =
                serviceFactory.CreateOrganizationService(context.UserId);

            var tracing = executionContext.GetExtension <ITracingService>();
            #endregion

            var parameterName = ParameterName.Get(executionContext);
            using (var ctx = new XrmServiceContext(service))
            {
                var parameter = (from p in ctx.CreateQuery <ultra_systemparameter>()
                                 where p.ultra_name == parameterName
                                 select p.ultra_parametervalue)
                                .FirstOrDefault();

                if (parameter != null)
                {
                    ParameterValue.Set(executionContext, parameter);
                }
            }
        }
Ejemplo n.º 4
0
        public void EqualsReturnTrueWhenCallsWithSameValueObject()
        {
            ParameterName sameValue = new ParameterName(Exp.Namespace + "SomeName");

            Assert.True(basicValue == sameValue);
            Assert.True(basicValue.Equals(sameValue));
        }
Ejemplo n.º 5
0
        public void Calculate_Formula_In_Excel()
        {
            using (var ms = new MemoryStream())
            {
                GetType().Assembly.GetManifestResourceStream("EngineX.ExcelBlockDefinitionTests_Formula.xlsx")
                .CopyTo(ms);

                var blockDefinition = new ExcelBlockDefinition("my excel");
                blockDefinition.ExcelWorkbook = ms.ToArray();

                blockDefinition.CellMappings["A1"] = ParameterName.For("input1");
                blockDefinition.CellMappings["A2"] = ParameterName.For("input2");
                blockDefinition.CellMappings["B3"] = ParameterName.For("output1");

                blockDefinition.Input.AddNumeric("input1");
                blockDefinition.Input.AddNumeric("input2");
                blockDefinition.Output.AddNumeric("output1");

                using (var calc = new Calculation(blockDefinition))
                {
                    calc.Set(new Parameter(ParameterName.For("input1"), 10));
                    calc.Set(new Parameter(ParameterName.For("input2"), 20));

                    var actual = calc.Get(ParameterName.For("output1"));
                    Assert.Equal(30, (int)actual.Value);
                }
            }
        }
        public ConventionBasedCodingStyle Merge(ConventionBasedCodingStyle other)
        {
            AddTypes(other.types);

            Type.Merge(other.Type);
            TypeIsValue.Merge(other.TypeIsValue);
            TypeIsView.Merge(other.TypeIsView);
            IdExtractor.Merge(other.IdExtractor);
            ValueExtractor.Merge(other.ValueExtractor);
            Locator.Merge(other.Locator);
            Converters.Merge(other.Converters);
            StaticInstances.Merge(other.StaticInstances);
            Initializers.Merge(other.Initializers);
            Datas.Merge(other.Datas);
            Operations.Merge(other.Operations);

            DataFetchedEagerly.Merge(other.DataFetchedEagerly);

            ParameterIsOptional.Merge(other.ParameterIsOptional);
            ParameterDefaultValue.Merge(other.ParameterDefaultValue);

            Module.Merge(other.Module);
            TypeName.Merge(other.TypeName);
            DataName.Merge(other.DataName);
            OperationName.Merge(other.OperationName);
            ParameterName.Merge(other.ParameterName);

            TypeMarks.Merge(other.TypeMarks);
            InitializerMarks.Merge(other.InitializerMarks);
            DataMarks.Merge(other.DataMarks);
            OperationMarks.Merge(other.OperationMarks);
            ParameterMarks.Merge(other.ParameterMarks);

            return(this);
        }
            private bool FindExistingOrCreateNewMember(
                ParameterName parameterName,
                ITypeSymbol parameterType,
                ImmutableDictionary <string, ISymbol> .Builder parameterToFieldMap,
                ImmutableDictionary <string, string> .Builder parameterToNewFieldMap)
            {
                // If the base types have an accessible field or property with the same name and
                // an acceptable type, then we should just defer to that.
                if (_state.BaseTypeOrInterfaceOpt != null)
                {
                    var expectedFieldName = parameterName.NameBasedOnArgument;
                    var members           = from t in _state.BaseTypeOrInterfaceOpt.GetBaseTypesAndThis()
                                            from m in t.GetMembers()
                                            where m.Name.Equals(expectedFieldName, StringComparison.OrdinalIgnoreCase)
                                            where IsSymbolAccessible(m)
                                            where IsViableFieldOrProperty(parameterType, m)
                                            select m;

                    var membersArray = members.ToImmutableArray();
                    var symbol       = membersArray.FirstOrDefault(m => m.Name.Equals(expectedFieldName, StringComparison.Ordinal)) ?? membersArray.FirstOrDefault();
                    if (symbol != null)
                    {
                        parameterToFieldMap[parameterName.BestNameForParameter] = symbol;
                        return(true);
                    }
                }

                parameterToNewFieldMap[parameterName.BestNameForParameter] = parameterName.NameBasedOnArgument;
                return(false);
            }
Ejemplo n.º 8
0
        public override string ParseParameter(
            string connectionString_in,
            ParameterName parameterName_in
            )
        {
            switch (parameterName_in)
            {
            case ParameterName.DBName:
                return(DBUtilities_connectionString.ParseParameter(connectionString_in, "database"));

            case ParameterName.Server:
                return(DBUtilities_connectionString.ParseParameter(connectionString_in, "server"));

            case ParameterName.User:
                return(DBUtilities_connectionString.ParseParameter(connectionString_in, "uid"));
            }
            throw new Exception(
                      string.Format(
                          System.Globalization.CultureInfo.CurrentCulture,
                          "{0}.{1}.ParseParameter(): - error parsing db connectionstring: 'SQLServer|{2}'",
                          typeof(DBUtilities_connectionString_SQLServer).Namespace,
                          typeof(DBUtilities_connectionString_SQLServer).Name,
#if DEBUG
                          connectionString_in
#else
                          "- not available -"
#endif
                          )
                      );
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns></returns>
 public int Add(ParameterName entity)
 {
     try
     {
         if (dr == null)
         {
             dr = new CallDatabase();
         }
         entity.Status = "1";
         dr.InitiCommand("insert into Sys_ParameterName([ConfigName],[No],[Memo])values(@ConfigName,@No,@Memo);select @@identity");
         dr.AddParameters("ConfigName", DbType.String, 50, entity.ConfigName);
         dr.AddParameters("No", DbType.Int32, entity.No);
         dr.AddParameters("Memo", DbType.String, 250, entity.Memo);
         int value = Convert.ToInt32(dr.ExecuteScalar());
         entity.Id = value;
         dr.Close();
         return(0);
     }
     catch (Exception ex)
     {
         using (ILog_Error log = new Log_Error_Generate())
         {
             log.Title   = ex.Message;
             log.Content = ex.StackTrace;
             log.Generatelog();
         }
         return(-1);
     }
 }
Ejemplo n.º 10
0
 public void AddParameter(string name, string value, bool isOutput)
 {
     ParameterName.Add(name);
     ParamaterValue.Add(value);
     ParamDirection.Add(isOutput);
     arraySize++;
 }
Ejemplo n.º 11
0
        public void EqualsReturnTrueWhenCallsWithSameReference()
        {
            ParameterName sameReference = basicValue;

            Assert.True(basicValue == sameReference);
            Assert.True(basicValue.Equals(sameReference));
        }
Ejemplo n.º 12
0
        public IHttpActionResult PutParameterName(int id, ParameterName parameterName)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != parameterName.parameterNameID)
            {
                return(BadRequest());
            }

            db.Entry(parameterName).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ParameterNameExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 13
0
 public bool Equals(TypedParameterModel?other)
 {
     return(other != null &&
            ParameterName.Equals(other.ParameterName) &&
            (PrimitiveType != null
         ? PrimitiveType.Equals(other.PrimitiveType) && DefaultValue == other.DefaultValue
         : ComplexType !.Equals(other.ComplexType)));
 }
Ejemplo n.º 14
0
        private void WriteParameter(MutableObject mutable)
        {
            var foundValue = Parameter.GetFirstValue(mutable);

            WrittenParameters[ParameterName.GetFirstValue(mutable)] = foundValue;

            GlobalVariableDataStore.Instance.WriteToDataStore(WriterKey, WrittenParameters);
        }
Ejemplo n.º 15
0
        public ActionResult DeleteConfirmed(int id)
        {
            ParameterName parameterName = db.ParameterNames.Find(id);

            db.ParameterNames.Remove(parameterName);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 16
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 37;
         hash = hash * 23 + ParameterName.GetHashCode();
         return(hash);
     }
 }
Ejemplo n.º 17
0
        public void FromParameterInfo_should_obtain_correct_parameter()
        {
            var pm = ParameterName.FromParameterInfo(
                typeof(string).GetMethod("Insert").GetParameters()[1]
                );

            Assert.Equal("value", pm.Name);
            Assert.Equal("Insert", pm.DeclaringMethod.Name);
        }
Ejemplo n.º 18
0
        public void EqualsReturnFalseWhenCallsWithNullReference()
        {
            ParameterName nullReference = null;

            Assert.False(basicValue == nullReference);
            Assert.False(basicValue.Equals(nullReference));

            Assert.True(nullReference == null);
        }
Ejemplo n.º 19
0
        internal static string GetParameterValue(ParameterName parameterName)
        {
            var db = new BP_ModelContainer();
            var name = parameterName.ToString();
            var parameter = (from p in db.Parameters where p.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) select p).FirstOrDefault();
            if (parameter == null)
                throw new Exception(string.Format("Cannot find parameter [{0}]", name));

            return parameter.Value;
        }
Ejemplo n.º 20
0
 public ActionResult Edit([Bind(Include = "parameterNameID,parameterNameName")] ParameterName parameterName)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parameterName).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parameterName));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override Int32 GetHashCode()
 {
     unchecked
     {
         var hashCode = ParameterName.GetHashCode();
         hashCode = (hashCode * 397) ^ Position.GetHashCode();
         hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0);
         return(hashCode);
     }
 }
        /// <summary>
        /// Reads the service API version value from a request.
        /// </summary>
        /// <param name="request">The <see cref="HttpRequestMessage">HTTP request</see> to read the API version from.</param>
        /// <returns>The raw, unparsed service API version value read from the request or <c>null</c> if request does not contain an API version.</returns>
        /// <exception cref="AmbiguousApiVersionException">Multiple, different API versions were requested.</exception>
        public virtual string Read(HttpRequestMessage request)
        {
            Arg.NotNull(request, nameof(request));

            var parameters = from pair in request.GetQueryNameValuePairs()
                             where ParameterName.Equals(pair.Key, OrdinalIgnoreCase) && pair.Value.Length > 0
                             select pair.Value;
            var versions = new HashSet <string>(parameters, StringComparer.OrdinalIgnoreCase);

            return(versions.EnsureZeroOrOneApiVersions());
        }
Ejemplo n.º 23
0
 public ParameterBuilder WithName(ParameterName name)
 {
     Name = Ensure.NotNull(name);
     return this;
 }
Ejemplo n.º 24
0
 public static string GetParameterSymbol(ParameterName parameterName)
 {
     return string.Format("$({0})", parameterName.ToString());
 }
Ejemplo n.º 25
0
 public void EqualsReturnFalseWhenCallsWithOtherValueObject()
 {
     ParameterName otherValue = new ParameterName(Exp.Namespace + "OtherName");
     Assert.False(basicValue == otherValue);
     Assert.False(basicValue.Equals(otherValue));
 }
Ejemplo n.º 26
0
 public void EqualsReturnTrueWhenCallsWithSameValueObject()
 {
     ParameterName sameValue = new ParameterName(Exp.Namespace + "SomeName");
     Assert.True(basicValue == sameValue);
     Assert.True(basicValue.Equals(sameValue));
 }
Ejemplo n.º 27
0
 public static extern void hdSetIntegerv(ParameterName paramName, [In] int[] value);
Ejemplo n.º 28
0
		public override string ParseParameter(
			string connectionString_in, 
			ParameterName parameterName_in
		) {
			switch (parameterName_in) {
				case ParameterName.DBName:
					return DBUtilities_connectionString.ParseParameter(connectionString_in, "database");

				case ParameterName.Server:
					return DBUtilities_connectionString.ParseParameter(connectionString_in, "server");

				case ParameterName.User:
					return DBUtilities_connectionString.ParseParameter(connectionString_in, "uid");
			}
			throw new Exception(
				string.Format(
					System.Globalization.CultureInfo.CurrentCulture,
					"{0}.{1}.ParseParameter(): - error parsing db connectionstring: 'SQLServer|{2}'",
					typeof(DBUtilities_connectionString_SQLServer).Namespace,
					typeof(DBUtilities_connectionString_SQLServer).Name,
#if DEBUG
					connectionString_in
#else
					"- not available -"
#endif
				)
			);
		}
Ejemplo n.º 29
0
 public PrintSchemaParameterRef(ParameterName name)
 {
     _parameterRef = new ParameterRef(name);
 }
Ejemplo n.º 30
0
 public static extern string hdGetString(ParameterName paramName);
Ejemplo n.º 31
0
 public static extern void hdSetBooleanv(ParameterName paramName, [In] bool[] value);
Ejemplo n.º 32
0
 public static extern void hdSetDoublev(ParameterName paramName, [In] double[] value);
Ejemplo n.º 33
0
 public static extern void hdSetFloatv(ParameterName paramName, [In]  float[] value);
Ejemplo n.º 34
0
 public PrintSchemaParameterDef(ParameterName name)
 {
     _name = name;
 }
Ejemplo n.º 35
0
 public static extern void hdGetLongv(ParameterName paramName, [Out] int[] value);
Ejemplo n.º 36
0
 public PrintSchemaParameterInit(ParameterName name)
 {
     _name = name;
 }
Ejemplo n.º 37
0
 public static extern void hdGetFloatv(ParameterName paramName, [Out]  float[] value);
Ejemplo n.º 38
0
 /// <summary>
 /// Gets the name of the parameter.
 /// </summary>
 /// <param name="dbName">Name of the db.</param>
 /// <param name="extraction">The extraction.</param>
 /// <param name="nameFormat">The name format.</param>
 /// <returns></returns>
 public ParameterName GetParameterName(string dbName, WordsExtraction extraction, NameFormat nameFormat)
 {
     var words = GetLanguageWords(nameFormat.Culture);
     var parameterName = new ParameterName { DbName = dbName };
     parameterName.NameWords = ExtractWords(words, dbName, extraction);
     parameterName.CallName = Format(words, parameterName.NameWords, Case.camelCase, Singularization.DontChange);
     return parameterName;
 }
Ejemplo n.º 39
0
 public static extern void hdGetDoublev(ParameterName paramName, [Out] double[] value);
Ejemplo n.º 40
0
		public abstract string ParseParameter(
			string connectionString_in, 
			ParameterName parameterName_in
		);
Ejemplo n.º 41
0
 public static extern void hdSetLongv(ParameterName paramName, [In] int[] value);