public void EqualsReturnFalseWhenCallsWithOtherValueObject()
        {
            ParameterName otherValue = new ParameterName(Exp.Namespace + "OtherName");

            Assert.False(basicValue == otherValue);
            Assert.False(basicValue.Equals(otherValue));
        }
Exemple #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);
                }
            }
        }
        public void EqualsReturnTrueWhenCallsWithSameValueObject()
        {
            ParameterName sameValue = new ParameterName(Exp.Namespace + "SomeName");

            Assert.True(basicValue == sameValue);
            Assert.True(basicValue.Equals(sameValue));
        }
        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);
            }
Exemple #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
                          )
                      );
        }
Exemple #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);
     }
 }
Exemple #10
0
 public void AddParameter(string name, string value, bool isOutput)
 {
     ParameterName.Add(name);
     ParamaterValue.Add(value);
     ParamDirection.Add(isOutput);
     arraySize++;
 }
        public void EqualsReturnTrueWhenCallsWithSameReference()
        {
            ParameterName sameReference = basicValue;

            Assert.True(basicValue == sameReference);
            Assert.True(basicValue.Equals(sameReference));
        }
Exemple #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));
        }
 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)));
 }
        private void WriteParameter(MutableObject mutable)
        {
            var foundValue = Parameter.GetFirstValue(mutable);

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

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

            db.ParameterNames.Remove(parameterName);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #16
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 37;
         hash = hash * 23 + ParameterName.GetHashCode();
         return(hash);
     }
 }
Exemple #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);
        }
        public void EqualsReturnFalseWhenCallsWithNullReference()
        {
            ParameterName nullReference = null;

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

            Assert.True(nullReference == null);
        }
Exemple #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;
        }
Exemple #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));
 }
Exemple #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());
        }
Exemple #23
0
 public ParameterBuilder WithName(ParameterName name)
 {
     Name = Ensure.NotNull(name);
     return this;
 }
Exemple #24
0
 public static string GetParameterSymbol(ParameterName parameterName)
 {
     return string.Format("$({0})", parameterName.ToString());
 }
 public void EqualsReturnFalseWhenCallsWithOtherValueObject()
 {
     ParameterName otherValue = new ParameterName(Exp.Namespace + "OtherName");
     Assert.False(basicValue == otherValue);
     Assert.False(basicValue.Equals(otherValue));
 }
 public void EqualsReturnTrueWhenCallsWithSameValueObject()
 {
     ParameterName sameValue = new ParameterName(Exp.Namespace + "SomeName");
     Assert.True(basicValue == sameValue);
     Assert.True(basicValue.Equals(sameValue));
 }
Exemple #27
0
 public static extern void hdSetIntegerv(ParameterName paramName, [In] int[] value);
		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
				)
			);
		}
Exemple #29
0
 public PrintSchemaParameterRef(ParameterName name)
 {
     _parameterRef = new ParameterRef(name);
 }
Exemple #30
0
 public static extern string hdGetString(ParameterName paramName);
Exemple #31
0
 public static extern void hdSetBooleanv(ParameterName paramName, [In] bool[] value);
Exemple #32
0
 public static extern void hdSetDoublev(ParameterName paramName, [In] double[] value);
Exemple #33
0
 public static extern void hdSetFloatv(ParameterName paramName, [In]  float[] value);
Exemple #34
0
 public PrintSchemaParameterDef(ParameterName name)
 {
     _name = name;
 }
Exemple #35
0
 public static extern void hdGetLongv(ParameterName paramName, [Out] int[] value);
Exemple #36
0
 public PrintSchemaParameterInit(ParameterName name)
 {
     _name = name;
 }
Exemple #37
0
 public static extern void hdGetFloatv(ParameterName paramName, [Out]  float[] value);
 /// <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;
 }
Exemple #39
0
 public static extern void hdGetDoublev(ParameterName paramName, [Out] double[] value);
Exemple #40
0
		public abstract string ParseParameter(
			string connectionString_in, 
			ParameterName parameterName_in
		);
Exemple #41
0
 public static extern void hdSetLongv(ParameterName paramName, [In] int[] value);