public ParameterCollection CheckParameters(string[] parameters) { ParameterCollection parameterCollection = new ParameterCollection(); switch (parameters.Length) { case 0: parameterCollection.Add("create"); return parameterCollection; case 1: if (parameters[0] == "show") { parameterCollection.Add("show"); return parameterCollection; } break; case 2: if (parameters[0] == "restore" && parameters[1].Length == 15) { parameterCollection.Add("restore"); parameterCollection.Add(parameters[1]); return parameterCollection; } break; } return null; }
/// <summary> /// Parse a query string /// </summary> /// <param name="reader">string to parse</param> /// <returns>A collection</returns> /// <exception cref="ArgumentNullException"><c>reader</c> is <c>null</c>.</exception> public static ParameterCollection Parse(ITextReader reader) { if (reader == null) throw new ArgumentNullException("reader"); var parameters = new ParameterCollection(); while (!reader.EOF) { string name = HttpUtility.UrlDecode(reader.ReadToEnd("&=")); char current = reader.Current; reader.Consume(); switch (current) { case '&': parameters.Add(name, string.Empty); break; case '=': { string value = reader.ReadToEnd("&"); reader.Consume(); parameters.Add(name, HttpUtility.UrlDecode(value)); } break; default: parameters.Add(name, string.Empty); break; } } return parameters; }
void BaseValues() { // this.UseStandardPrinter = true; // this.GraphicsUnit = GraphicsUnit.Pixel; // this.Padding = new Padding(5); // this.DefaultFont = GlobalValues.DefaultFont; this.ReportType = ReportType.FormSheet; // this.DataModel = PushPullModel.FormSheet; // // this.CommandType = System.Data.CommandType.Text; // this.ConnectionString = String.Empty; // this.CommandText = String.Empty; // this.TopMargin = GlobalValues.DefaultPageMargin.Left; this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom; this.LeftMargin = GlobalValues.DefaultPageMargin.Left; this.RightMargin = GlobalValues.DefaultPageMargin.Right; // // this.availableFields = new AvailableFieldsCollection(); // this.groupingsCollection = new GroupColumnCollection(); this.SortColumnsCollection = new SortColumnCollection(); this.GroupColumnsCollection = new GroupColumnCollection(); // this.sqlParameters = new SqlParameterCollection(); ParameterCollection = new ParameterCollection(); // this.NoDataMessage = "No Data for this Report"; }
public ParameterCollection CheckParameters(string[] parameters) { ParameterCollection parameterCollection = new ParameterCollection(); switch (parameters.Length) { case 0: parameterCollection.Add("prompt"); return parameterCollection; case 2: int difficultyInt; if (parameters[0].StartsWith("\"") && parameters[0].EndsWith("\"") && int.TryParse(parameters[1], out difficultyInt) && Enum.IsDefined(typeof(EntryDifficulty), difficultyInt)) { parameterCollection.Add("immediate"); parameterCollection.Add(parameters[0].Substring(1, parameters[0].Length - 2)); parameterCollection.Add(parameters[1]); return parameterCollection; } break; } return null; }
public void CanAccessNonFilteredParameters() { var collection = new ParameterCollection( new object[] { 10, 20, 30, 40, 50 }, StaticReflection.GetMethodInfo(() => TestMethod(null, null, null, null, null)).GetParameters(), pi => true); Assert.AreEqual(5, collection.Count); CollectionAssert.AreEqual( new[] { 10, 20, 30, 40, 50 }, collection); CollectionAssert.AreEqual( new[] { 50, 20, 40, 30, 10 }, new[] { 4, 1, 3, 2, 0 }.Select(i => collection[i]).ToArray()); CollectionAssert.AreEqual( new[] { 50, 20, 40, 30, 10 }, new[] { "param5", "param2", "param4", "param3", "param1" }.Select(i => collection[i]).ToArray()); CollectionAssert.AreEqual( new[] { "param1", "param2", "param3", "param4", "param5" }, Enumerable.Range(0, 5).Select(i => collection.ParameterName(i)).ToArray()); CollectionAssert.AreEqual( new[] { "param1", "param2", "param3", "param4", "param5" }, Enumerable.Range(0, 5).Select(i => collection.GetParameterInfo(i).Name).ToArray()); }
protected override async Task LoadContent() { await base.LoadContent(); wireframeState = RasterizerState.New(GraphicsDevice, new RasterizerStateDescription(CullMode.Back) { FillMode = FillMode.Wireframe }); simpleEffect = new Effect(GraphicsDevice, SpriteEffect.Bytecode); parameterCollection = new ParameterCollection(); parameterCollectionGroup = new EffectParameterCollectionGroup(GraphicsDevice, simpleEffect, new [] { parameterCollection }); parameterCollection.Set(TexturingKeys.Texture0, UVTexture); primitives = new List<GeometricPrimitive>(); // Creates all primitives primitives = new List<GeometricPrimitive> { GeometricPrimitive.Plane.New(GraphicsDevice), GeometricPrimitive.Cube.New(GraphicsDevice), GeometricPrimitive.Sphere.New(GraphicsDevice), GeometricPrimitive.GeoSphere.New(GraphicsDevice), GeometricPrimitive.Cylinder.New(GraphicsDevice), GeometricPrimitive.Torus.New(GraphicsDevice), GeometricPrimitive.Teapot.New(GraphicsDevice), GeometricPrimitive.Capsule.New(GraphicsDevice, 0.5f, 0.3f), GeometricPrimitive.Cone.New(GraphicsDevice) }; view = Matrix.LookAtRH(new Vector3(0, 0, 5), new Vector3(0, 0, 0), Vector3.UnitY); Window.AllowUserResizing = true; }
protected override async Task LoadContent() { await base.LoadContent(); var view = Matrix.LookAtRH(new Vector3(2,2,2), new Vector3(0, 0, 0), Vector3.UnitY); var projection = Matrix.PerspectiveFovRH((float)Math.PI / 4.0f, (float)GraphicsDevice.BackBuffer.ViewWidth / GraphicsDevice.BackBuffer.ViewHeight, 0.1f, 100.0f); worldViewProjection = Matrix.Multiply(view, projection); geometry = GeometricPrimitive.Cube.New(GraphicsDevice); simpleEffect = new Effect(GraphicsDevice, SpriteEffect.Bytecode); parameterCollection = new ParameterCollection(); parameterCollectionGroup = new EffectParameterCollectionGroup(GraphicsDevice, simpleEffect, new[] { parameterCollection }); parameterCollection.Set(TexturingKeys.Texture0, UVTexture); // TODO DisposeBy is not working with device reset offlineTarget0 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this); offlineTarget1 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this); offlineTarget2 = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget).DisposeBy(this); depthBuffer = Texture.New2D(GraphicsDevice, 512, 512, PixelFormat.D16_UNorm, TextureFlags.DepthStencil).DisposeBy(this); width = GraphicsDevice.BackBuffer.ViewWidth; height = GraphicsDevice.BackBuffer.ViewHeight; }
/// <summary> /// Initializes a new instance of the <see cref="CuteContext"/> class. /// </summary> public CuteContext() { InputParameters = new ParameterCollection(); OutputParameters = new ParameterCollection(); PreEntityImages = new EntityImageCollection(); PostEntityImages = new EntityImageCollection(); }
/// <summary> /// Initializes a new instance of the <see cref="Mesh" /> class. /// </summary> /// <param name="meshDraw">The mesh draw.</param> /// <param name="parameters">The parameters.</param> /// <exception cref="System.ArgumentNullException">parameters</exception> public Mesh(MeshDraw meshDraw, ParameterCollection parameters) { if (meshDraw == null) throw new ArgumentNullException("meshDraw"); if (parameters == null) throw new ArgumentNullException("parameters"); Draw = meshDraw; Parameters = parameters; }
protected Employee GetItem(GetItemType SelectType, int TKID, string FirstName, string LastName) { string strStoredProcName = "Elite_GetEmployee"; try { //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); //notes: ListValue options switch (SelectType) { case GetItemType.BY_TKID: // 10 = GET_ITEM_BY_ID objParamCollection.Add((10).GetParameterListValue()); objParamCollection.Add(TKID.GetParameterInt("@TKID")); break; } //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); //notes: call local method to get object item return this.GetLocalItem(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new Employee { StatusResult = new ResponseStatus("Get Item by ID Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
/// <summary> /// Initializes a new instance of the <see cref="ModelComponent"/> class. /// </summary> /// <param name="model">The model.</param> public ModelComponent(Model model) { Parameters = new ParameterCollection(); Model = model; IsShadowCaster = true; IsShadowReceiver = true; }
protected EmployeeCollection GetCollection() { //notes: return collection of groups string strStoredProcName = "Elite_GetEmployee"; try { //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); //notes: ListValue options // 20 = GET_COLLECTION objParamCollection.Add((20).GetParameterListValue()); //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); //notes: call local method to get list return this.GetLocalCollection(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new EmployeeCollection { StatusResult = new ResponseStatus("Get Employee Collection Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
protected EmployeeCollection GetCollection(GetItemType SelectType, string SearchString, int ReturnCount) { //notes: return collection of groups string strStoredProcName = "Elite_GetEmployee"; try { //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); objProperties.Add("label", SqlDbType.VarChar); objProperties.Add("value", SqlDbType.VarChar); //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); objParamCollection.Add(ReturnCount.GetParameterInt("@ReturnCount")); switch (SelectType) { case GetItemType.BY_SEARCH: // 21 = GET_COLLECTION_BY_SEARCH objParamCollection.Add((21).GetParameterListValue()); objParamCollection.Add(SearchString.GetParameterVarchar("@SearchString", 300)); break; } //notes: call local method to get list return this.GetLocalCollection(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new EmployeeCollection { StatusResult = new ResponseStatus("Get Employee Search Collection Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
public override void Initialize(IDatabaseEngine engine) { IDbCommand innerCommand = engine.CreateStoredProcedureCommand(_commandText); var parameters = new ParameterCollection(innerCommand.Parameters); initializeMembers(parameters, innerCommand); }
public static WikiPage Load(Wiki wiki, string title, string directory) { ParameterCollection parameters = new ParameterCollection(); parameters.Add("prop", "info|revisions"); parameters.Add("intoken", "edit"); parameters.Add("rvprop", "timestamp"); XmlDocument xml = wiki.Query(QueryBy.Titles, parameters, new string[] { title }); XmlNode node = xml.SelectSingleNode("//rev"); string baseTimeStamp = null; if (node != null && node.Attributes["timestamp"] != null) { baseTimeStamp = node.Attributes["timestamp"].Value; } node = xml.SelectSingleNode("//page"); string editToken = node.Attributes["edittoken"].Value; string pageFileName = directory + EscapePath(title); string text = LoadPageFromCache(pageFileName, node.Attributes["lastrevid"].Value, title); if (string.IsNullOrEmpty(text)) { Console.Out.WriteLine("Downloading " + title + "..."); text = wiki.LoadText(title); CachePage(pageFileName, node.Attributes["lastrevid"].Value, text); } WikiPage page = WikiPage.Parse(title, text); page.BaseTimestamp = baseTimeStamp; page.Token = editToken; return page; }
public static IObservable<ApiResponse<Status>> StatusesMentionsTimeline( this AccessToken info, int? count = null, long? sinceId = null, long? maxId = null, bool? trimUser = null, bool? excludeReplies = null, bool? contributorDetails = null, bool? includeEntities = null) { var param = new ParameterCollection() { {"count", count}, {"since_id", sinceId}, {"max_id", maxId}, {"trim_user", trimUser}, {"exclude_replies", excludeReplies}, {"contributor_details", contributorDetails}, {"include_entities", includeEntities} }; return info .GetClient() .SetEndpoint(Endpoints.StatusesMentionsTimeline) .SetParameters(param) .GetResponse() .ReadArrayResponse<Status>(); }
protected VendorItem GetItem(GetItemType SelectType, int VendorID) { string strStoredProcName = "jsp_Subscription_GetVendorItems"; try { //notes: set the parameters to use for this query ParameterCollection objParamCollection = new ParameterCollection(); switch (SelectType) { case GetItemType.BY_ID: objParamCollection.Add((10).GetParameterListValue()); objParamCollection.Add(VendorID.GetParameterInt("@VendorID")); break; } //notes: get base object properties you want hydrated and add any additional if necessary ObjectPropertyDictionary objProperties = this.GetBaseProperties(); //notes: call local method to get object item return this.GetLocalItem(objParamCollection, objProperties, strStoredProcName); } catch (Exception ex) { return new VendorItem { StatusResult = new ResponseStatus("Get Vendor Item Error: " + ex.Message, ex.StackTrace, ResponseStatusResult.Fail) }; } }
public static IObservable<ApiResponse<OEmbed>> StatusesOembed( this AccessToken info, long? id = null, string url = null, int? maxwidth = null, bool? hideMedia = null, bool? hideThread = null, bool? omitScript = null, string align = null, string related = null, string lang = null) { var param = new ParameterCollection() { {"id", id}, {"url", url}, {"maxwidth", maxwidth}, {"hide_media", hideMedia}, {"hide_thread", hideThread}, {"omit_script", omitScript}, {"align", align}, {"related", related}, {"lang", lang} }; return info .GetClient() .SetEndpoint(Endpoints.StatusesOembed) .SetParameters(param) .GetResponse() .ReadResponse<OEmbed>(); }
public void GetItemFromCollectionTest() { var parameters = new ParameterCollection(); parameters.Add(new Parameter("x", 2.3)); Assert.AreEqual(2.3, parameters["x"]); }
public void CalculateLessTrueTest() { var parameters = new ParameterCollection() { new Parameter("x", 0) }; var lessThen = new LessThan(new Variable("x"), new Number(10)); Assert.AreEqual(true, lessThen.Calculate(parameters)); }
/// <summary> /// Retorna o adaptador correto, dependendo do método pedido, e se tem ou não arquivos a serem enviados /// </summary> /// <owner>Mnix-Victor</owner> internal static HttpMethodAdapter GetAdapter(HttpMethod method, ParameterCollection parameters, Encoding encoding) { switch (method) { case HttpMethod.GET: if (parameters.HasFileParameter()) { throw new InvalidParameterForHttpMethodException(method); } return new GETHttpMethodAdapter(parameters, encoding); case HttpMethod.POST: if (parameters.HasFileParameter()) { return new MultipartPOSTHttpMethodAdapter(parameters, encoding); } else { return new FormDataPOSTHttpMethodAdapter(parameters, encoding); } default: throw new UnknownMethodAdapterException(method); } }
private void Initialize(Effect effect, ParameterCollection usedParameters) { if (effect == null) throw new ArgumentNullException("effect"); // TODO: Should we ignore various compiler keys such as CompilerParameters.GraphicsPlatformKey, CompilerParameters.GraphicsProfileKey and CompilerParameters.DebugKey? // That was done previously in Effect.CompilerParameters // TODO: Should we clone usedParameters? Or somehow make sure it is immutable? (for now it uses the one straight from EffectCompiler, which might not be a good idea...) Parameters = usedParameters; var parameters = usedParameters; var internalValues = parameters.InternalValues; SortedKeys = new ParameterKey[internalValues.Count]; SortedKeyHashes = new ulong[internalValues.Count]; SortedCompilationValues = new object[internalValues.Count]; SortedCounters = new int[internalValues.Count]; for (int i = 0; i < internalValues.Count; ++i) { var internalValue = internalValues[i]; SortedKeys[i] = internalValue.Key; SortedKeyHashes[i] = internalValue.Key.HashCode; SortedCompilationValues[i] = internalValue.Value.Object; SortedCounters[i] = internalValue.Value.Counter; } var keyMapping = new Dictionary<ParameterKey, int>(); for (int i = 0; i < SortedKeys.Length; i++) keyMapping.Add(SortedKeys[i], i); Parameters.SetKeyMapping(keyMapping); }
public void CalculateLessFalseTest() { var parameters = new ParameterCollection() { new Parameter("x", 666) }; var lessThen = new LessOrEqual(new Variable("x"), new Number(10)); Assert.AreEqual(false, lessThen.Calculate(parameters)); }
protected override IEnumerable<Parameter> GetParameters() { // XXX: Here be magic numbers const int MpBaseParamKey = 8; var parameters = new ParameterCollection(); var bpSheet = Sheet.Collection.GetSheet<BaseParam>(); if (Maximum > 0) parameters.AddParameterValue(bpSheet[MpBaseParamKey], new ParameterValueRelativeLimited(ParameterType.Base, Amount / 100.0, Maximum)); else parameters.AddParameterValue(bpSheet[MpBaseParamKey], new ParameterValueFixed(ParameterType.Base, Amount)); // ReSharper disable once InvertIf if (MaximumHq != Maximum && AmountHq != Amount) { if (MaximumHq > 0) parameters.AddParameterValue(bpSheet[MpBaseParamKey], new ParameterValueRelativeLimited(ParameterType.Hq, AmountHq / 100.0, MaximumHq)); else parameters.AddParameterValue(bpSheet[MpBaseParamKey], new ParameterValueFixed(ParameterType.Hq, AmountHq)); } return parameters; }
public void BoolAddNumberTest() { var parameters = new ParameterCollection() { new Parameter("x", true) }; var add = new AddAssign(new Variable("x"), new Number(2)); Assert.Throws<NotSupportedException>(() => add.Execute(parameters)); }
protected ParameterizedNamedItem() : base() { name = ItemName; description = ItemDescription; parameters = new ParameterCollection(); readOnlyParameters = null; }
public void CalculateGreaterTrueTest() { var parameters = new ParameterCollection() { new Parameter("x", 463) }; var greaterThen = new GreaterThan(new Variable("x"), new Number(10)); Assert.AreEqual(true, greaterThen.Calculate(parameters)); }
//------------------------------------------------------ // // Constructors // //----------------------------------------------------- #region Constructors /// <summary> /// Instantiates a new instance of a ObjectDataProvider /// </summary> public ObjectDataProvider() { _constructorParameters = new ParameterCollection(new ParameterCollectionChanged(OnParametersChanged)); _methodParameters = new ParameterCollection(new ParameterCollectionChanged(OnParametersChanged)); _sourceDataChangedHandler = new EventHandler(OnSourceDataChanged); }
protected override void BuildEntity(EntityWorld entityWorld, Entity entity, ParameterCollection parameters) { entity.Transform.Position = parameters.Get<Vector2>(0); entity.AddFromPool<CDrop>().Initialize(DropType.BlackBox); entity.AddFromPool<CLifeTime>().Initialize(100f); entity.Tag = EntityTags.Drop; }
public void UpdatedUsedParameters(Effect effect, ParameterCollection parameters) { // Try to update counters only if possible var internalValues = parameters.InternalValues; bool parameterKeyMatches = SortedCounters.Length == internalValues.Count; if (parameterKeyMatches) { for (int i = 0; i < internalValues.Count; ++i) { if (SortedKeys[i] != internalValues[i].Key) { parameterKeyMatches = false; break; } SortedCounters[i] = internalValues[i].Value.Counter; } } // Somehow, the used parameters changed, we need a full reset if (!parameterKeyMatches) { Initialize(effect, parameters); } }
public void CreateCollectionWithOneSqlParameter() { ParameterCollection p = this.CollectionWithSQLParameters(); Assert.AreEqual(3, p.Count); }
/// <summary> /// 根据条件获取实体集合 /// </summary> /// <param name="pc">pc</param> /// <returns>实体</returns> public List <DepartmentInfoModel> RetrieveMultiple(ParameterCollection pc) { return(RetrieveMultiple(pc, null)); }
public Task SetParametersAsync(ParameterCollection parameters) => throw new NotImplementedException();
static CascadingValue <T> CreateCascadingValueComponent <T>(T value, string name = null) { var supplier = new CascadingValue <T>(); var renderer = new TestRenderer(); supplier.Configure(new RenderHandle(renderer, 0)); var supplierParams = new Dictionary <string, object> { { "Value", value } }; if (name != null) { supplierParams.Add("Name", name); } renderer.Dispatcher.InvokeAsync((Action)(() => supplier.SetParametersAsync(ParameterCollection.FromDictionary(supplierParams)))); return(supplier); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { _editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (_editorService != null && context.Instance != null) { // CR modifying to accomodate PropertyBag Type instanceType = null; object objinfo = null; TypeHelper.GetChildPropertyContextInstanceObject(context, ref objinfo, ref instanceType); var propInfo = instanceType.GetProperty("LoadParameters"); var paramColl = (ParameterCollection)propInfo.GetValue(objinfo, null); if (instanceType == typeof(ChildProperty)) { _instance = GeneratorController.Current.MainForm.ProjectPanel.ListObjects.SelectedItem; } else { //_instance = context.Instance; _instance = objinfo; } var criteriaInfo = typeof(CslaObjectInfo).GetProperty("CriteriaObjects"); var criteriaObjects = criteriaInfo.GetValue(_instance, null); _lstProperties.Items.Clear(); _lstProperties.Items.Add(new DictionaryEntry("(None)", new Parameter())); foreach (Criteria crit in (CriteriaCollection)criteriaObjects) { if (crit.GetOptions.Factory || crit.GetOptions.AddRemove || crit.GetOptions.DataPortal) { foreach (var prop in crit.Properties) { _lstProperties.Items.Add(new DictionaryEntry(crit.Name + "." + prop.Name, new Parameter(crit, prop))); } } } // _lstProperties.Sorted = true; foreach (var param in paramColl) { var key = param.Criteria.Name + "." + param.Property.Name; for (var entry = 0; entry < _lstProperties.Items.Count; entry++) { if (key == ((DictionaryEntry)_lstProperties.Items[entry]).Key.ToString()) { var val = (Parameter)((DictionaryEntry)_lstProperties.Items[entry]).Value; _lstProperties.SelectedItems.Add(new DictionaryEntry(key, val)); } } } _lstProperties.SelectedIndexChanged += LstPropertiesSelectedIndexChanged; _editorService.DropDownControl(_lstProperties); _lstProperties.SelectedIndexChanged -= LstPropertiesSelectedIndexChanged; if (_lstProperties.SelectedItems.Count > 0) { var param = new ParameterCollection(); foreach (var item in _lstProperties.SelectedItems) { param.Add((Parameter)((DictionaryEntry)item).Value); } return(param); } return(new ParameterCollection()); } return(value); }
public AllProviders() { this._constructorArgs = new object [] {}; _pc = new ParameterCollection(); }
public void NotesFromSRToWorkOrderTestMethod() { using (ShimsContext.Create()) { NotesFromSRToWorkOrder notesFromSRToWorkOrder = new StubNotesFromSRToWorkOrder(); var serviceProvider = new StubIServiceProvider(); var pluginContext = new StubIPluginExecutionContext(); var organizationService = new StubIOrganizationService(); pluginContext.PrimaryEntityNameGet = () => "msdyn_workorder"; pluginContext.PrimaryEntityIdGet = () => new Guid("54D94FC2-52AD-E511-8158-1458D04DB4D1"); ParameterCollection paramCollection = new ParameterCollection(); Entity workOrder = new Entity("msdyn_workorder"); workOrder.Attributes["msdyn_servicerequest"] = new EntityReference("incident", new Guid("884A078B-0467-E711-80F5-3863BB3C0660")); paramCollection.Add("Target", workOrder); pluginContext.InputParametersGet = () => paramCollection; PluginVariables(serviceProvider, pluginContext, organizationService, 40, "Create"); organizationService.RetrieveMultipleQueryBase = (query) => { EntityCollection collection = new EntityCollection(); string entityName = string.Empty; if (query.GetType().Name.Equals("FetchExpression")) { if (((Microsoft.Xrm.Sdk.Query.FetchExpression)query).Query.Contains("<entity name='ava_keyvaluepair'>")) { entityName = "ava_keyvaluepair"; } } else if (query.GetType().Name.Equals("QueryExpression")) { entityName = ((QueryExpression)query).EntityName; } else { entityName = ((QueryByAttribute)query).EntityName; } if (entityName == "annotation") { Entity annotation = new Entity("annotation"); annotation.Id = new Guid("884A078B-0466-E711-80F5-3863BB3C0560"); annotation.Attributes["filename"] = "filename"; annotation.Attributes["documentbody"] = "documentbody"; annotation.Attributes["notetext"] = "notetext"; annotation.Attributes["objecttypecode"] = "objecttypecode"; annotation.Attributes["mimetype"] = "mimetype"; annotation.Attributes["subject"] = "subject"; annotation.Attributes["objectid"] = new Guid("884A078B-0466-E711-80F5-3863BB3C0561"); collection.Entities.Add(annotation); Entity annotation2 = new Entity("annotation"); annotation2.Id = new Guid("884A078B-0466-E712-80F5-3863BB3C0560"); annotation2.Attributes["filename"] = "filename2"; annotation2.Attributes["documentbody"] = "documentbody2"; annotation2.Attributes["objecttypecode"] = "objecttypecode2"; annotation2.Attributes["mimetype"] = "mimetype2"; annotation2.Attributes["subject"] = "subject2"; annotation2.Attributes["objectid"] = new Guid("884A078B-0466-E711-80F5-3863BB3C0561"); collection.Entities.Add(annotation2); } return(collection); }; notesFromSRToWorkOrder.Execute(serviceProvider); } }
public void Add2Elements() { ParameterCollection p = this.CollectionWith2Parameters(); Assert.AreEqual(2, p.Count, "Count should be '2'"); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { _editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (_editorService != null && context.Instance != null) { // CR modifying to accomodate PropertyBag Type instanceType = null; object objinfo = null; ContextHelper.GetAssociativeEntityContextInstanceObject(context, ref objinfo, ref instanceType); PropertyInfo propInfo; var associativeEntity = (AssociativeEntity)objinfo; string cslaObject; if (context.PropertyDescriptor.DisplayName == "Primary Load Parameters" && associativeEntity.MainObject != null) { propInfo = instanceType.GetProperty("MainLoadParameters"); // if (associativeEntity.MainLoadingScheme == LoadingScheme.SelfLoad) // cslaObject = associativeEntity.MainCollectionTypeName; // else cslaObject = associativeEntity.MainObject; } else { propInfo = instanceType.GetProperty("SecondaryLoadParameters"); // if (associativeEntity.SecondaryLoadingScheme == LoadingScheme.SelfLoad) // cslaObject = associativeEntity.SecondaryCollectionTypeName; // else cslaObject = associativeEntity.SecondaryObject; } var paramColl = (ParameterCollection)propInfo.GetValue(objinfo, null); //var objectColl = GeneratorController.Current.MainForm.ProjectPanel.Objects; _instance = GeneratorController.Current.CurrentUnit.CslaObjects.FindByGenericName(cslaObject); var criteriaInfo = typeof(CslaObjectInfo).GetProperty("CriteriaObjects"); var criteriaObjects = criteriaInfo.GetValue(_instance, null); _lstProperties.Items.Clear(); _lstProperties.Items.Add(new DictionaryEntry("(None)", new Parameter())); foreach (var crit in (CriteriaCollection)criteriaObjects) { if (crit.GetOptions.Factory || crit.GetOptions.AddRemove || crit.GetOptions.DataPortal) { foreach (var prop in crit.Properties) { _lstProperties.Items.Add(new DictionaryEntry(crit.Name + "." + prop.Name, new Parameter(crit.Name, prop.Name))); } } } _lstProperties.Sorted = true; foreach (var param in paramColl) { var key = param.CriteriaName + "." + param.PropertyName; for (var entry = 0; entry < _lstProperties.Items.Count; entry++) { if (key == ((DictionaryEntry)_lstProperties.Items[entry]).Key.ToString()) { var val = (Parameter)((DictionaryEntry)_lstProperties.Items[entry]).Value; _lstProperties.SelectedItems.Add(new DictionaryEntry(key, val)); } } } _lstProperties.SelectedIndexChanged += LstPropertiesSelectedIndexChanged; _editorService.DropDownControl(_lstProperties); _lstProperties.SelectedIndexChanged -= LstPropertiesSelectedIndexChanged; if (_lstProperties.SelectedItems.Count > 0) { var param = new ParameterCollection(); foreach (var item in _lstProperties.SelectedItems) { param.Add((Parameter)((DictionaryEntry)item).Value); } return(param); } return(new ParameterCollection()); } return(value); }
public void FindWithNameIsNull() { ParameterCollection p = this.CollectionWith3Parameters(); BasicParameter bp = p.Find(null); }
/// <summary> /// Retrieve geocode address using Google Api /// </summary> public void ExecuteGeocodeAddressGoogle(IPluginExecutionContext pluginExecutionContext, IOrganizationService organizationService, ITracingService tracingService = null) { ParameterCollection InputParameters = pluginExecutionContext.InputParameters; // 5 fields (string) for individual parts of an address ParameterCollection OutputParameters = pluginExecutionContext.OutputParameters; // 2 fields (double) for resultant geolocation ParameterCollection SharedVariables = pluginExecutionContext.SharedVariables; // 1 field (int) for status of previous and this plugin tracingService.Trace("ExecuteGeocodeAddress started. InputParameters = {0}, OutputParameters = {1}", InputParameters.Count().ToString(), OutputParameters.Count().ToString()); try { // If a plugin earlier in the pipeline has already geocoded successfully, quit if ((double)OutputParameters[LatitudeKey] != 0d || (double)OutputParameters[LongitudeKey] != 0d) { return; } // Get user Lcid if request did not include it int Lcid = (int)InputParameters[LcidKey]; string _address = string.Empty; if (Lcid == 0) { var userSettingsQuery = new QueryExpression("usersettings"); userSettingsQuery.ColumnSet.AddColumns("uilanguageid", "systemuserid"); userSettingsQuery.Criteria.AddCondition("systemuserid", ConditionOperator.Equal, pluginExecutionContext.InitiatingUserId); var userSettings = organizationService.RetrieveMultiple(userSettingsQuery); if (userSettings.Entities.Count > 0) { Lcid = (int)userSettings.Entities[0]["uilanguageid"]; } } // Arrange the address components in a single comma-separated string, according to LCID _address = GisUtility.FormatInternationalAddress(Lcid, (string)InputParameters[Address1Key], (string)InputParameters[PostalCodeKey], (string)InputParameters[CityKey], (string)InputParameters[StateKey], (string)InputParameters[CountryKey]); WebClient client = new WebClient(); var url = $"https://{googleMaps.ApiServer}{googleMaps.GeocodePath}/json?address={_address}&key={googleMaps.ApiKey}"; tracingService.Trace($"Calling {url}\n"); string response = client.DownloadString(url); tracingService.Trace("Parsing response ...\n"); DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(GoogleMapsGeocodeResponse)); object objResponse = jsonSerializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(response))); GoogleMapsGeocodeResponse geocodeResponse = objResponse as GoogleMapsGeocodeResponse; tracingService.Trace("Response Status = " + geocodeResponse.Status + "\n"); if (geocodeResponse.Status != "OK") { throw new ApplicationException($"Server {googleMaps.ApiServer} application error (Status {geocodeResponse.Status})."); } tracingService.Trace("Checking geocodeResponse.Result...\n"); if (geocodeResponse.Results != null) { if (geocodeResponse.Results.Count() == 1) { tracingService.Trace("Checking geocodeResponse.Result.Geometry.Location...\n"); if (geocodeResponse.Results.First()?.Geometry?.Location != null) { tracingService.Trace("Setting Latitude, Longitude in OutputParameters...\n"); // update output parameters OutputParameters[LatitudeKey] = geocodeResponse.Results.First().Geometry.Location.Lat; OutputParameters[LongitudeKey] = geocodeResponse.Results.First().Geometry.Location.Lng; } else { throw new ApplicationException($"Server {googleMaps.ApiServer} application error (missing Results[0].Geometry.Location)"); } } else { throw new ApplicationException($"Server {googleMaps.ApiServer} application error (more than 1 result returned)"); } } else { throw new ApplicationException($"Server {googleMaps.ApiServer} application error (missing Results)"); } } catch (Exception ex) { // Signal to subsequent plugins in this message pipeline that geocoding failed here. OutputParameters[LatitudeKey] = 0d; OutputParameters[LongitudeKey] = 0d; //TODO: You may need to decide which caught exceptions will rethrow and which ones will simply signal geocoding did not complete. throw new InvalidPluginExecutionException(string.Format("Geocoding failed at {0} with exception -- {1}: {2}" , googleMaps.ApiServer, ex.GetType().ToString(), ex.Message), ex); } }
/// <summary> /// 表达式输出成符合指定数据库的Sql脚本 /// </summary> /// <param name="builder"></param> /// <param name="output"></param> /// <returns></returns> public abstract string OutputSqlString(ISqlBuilder builder, ParameterCollection output);
public abstract void SetupDefaultValue(ParameterCollection parameterCollection, ParameterKey parameterKey, bool addDependencies);
public static unsafe bool UpdateMaterial(RenderSystem renderSystem, RenderDrawContext context, MaterialInfoBase materialInfo, int materialSlotIndex, RenderEffect renderEffect, ParameterCollection materialParameters) { // Check if encountered first time this frame if (materialInfo.LastFrameUsed == renderSystem.FrameCounter) { return(true); } // TODO: spinlock? lock (materialInfo) { if (materialInfo.LastFrameUsed == renderSystem.FrameCounter) { return(true); } // First time we use the material with a valid effect, let's update layouts if (materialInfo.PerMaterialLayout == null || materialInfo.PerMaterialLayout.Hash != renderEffect.Reflection.ResourceGroupDescriptions[materialSlotIndex].Hash) { var resourceGroupDescription = renderEffect.Reflection.ResourceGroupDescriptions[materialSlotIndex]; if (resourceGroupDescription.DescriptorSetLayout == null) { return(false); } materialInfo.PerMaterialLayout = ResourceGroupLayout.New(renderSystem.GraphicsDevice, resourceGroupDescription, renderEffect.Effect.Bytecode); var parameterCollectionLayout = materialInfo.ParameterCollectionLayout = new ParameterCollectionLayout(); parameterCollectionLayout.ProcessResources(resourceGroupDescription.DescriptorSetLayout); materialInfo.ResourceCount = parameterCollectionLayout.ResourceCount; // Process material cbuffer (if any) if (resourceGroupDescription.ConstantBufferReflection != null) { materialInfo.ConstantBufferReflection = resourceGroupDescription.ConstantBufferReflection; parameterCollectionLayout.ProcessConstantBuffer(resourceGroupDescription.ConstantBufferReflection); } materialInfo.ParametersChanged = true; } // If the parameters collection instance changed, we need to update it if (materialInfo.ParametersChanged) { materialInfo.ParameterCollection.UpdateLayout(materialInfo.ParameterCollectionLayout); materialInfo.ParameterCollectionCopier = new ParameterCollection.Copier(materialInfo.ParameterCollection, materialParameters); materialInfo.ParametersChanged = false; } // Mark this material as used during this frame materialInfo.LastFrameUsed = renderSystem.FrameCounter; } // Copy back to ParameterCollection // TODO GRAPHICS REFACTOR directly copy to resource group? materialInfo.ParameterCollectionCopier.Copy(); // Allocate resource groups context.ResourceGroupAllocator.PrepareResourceGroup(materialInfo.PerMaterialLayout, BufferPoolAllocationType.UsedMultipleTime, materialInfo.Resources); // Set resource bindings in PerMaterial resource set for (int resourceSlot = 0; resourceSlot < materialInfo.ResourceCount; ++resourceSlot) { materialInfo.Resources.DescriptorSet.SetValue(resourceSlot, materialInfo.ParameterCollection.ObjectValues[resourceSlot]); } // Process PerMaterial cbuffer if (materialInfo.ConstantBufferReflection != null) { var mappedCB = materialInfo.Resources.ConstantBuffer.Data; fixed(byte *dataValues = materialInfo.ParameterCollection.DataValues) Utilities.CopyMemory(mappedCB, (IntPtr)dataValues, materialInfo.Resources.ConstantBuffer.Size); } return(true); }
protected override IEnumerable <Column> GetColumns(IDatabase database, string[] restrictionValues) { var parameters = new ParameterCollection(); SqlCommand sql = @" SELECT T.OWNER, T.TABLE_NAME, T.COLUMN_NAME, T.DATA_TYPE AS DATATYPE, T.DATA_LENGTH AS LENGTH, T.DATA_PRECISION AS PRECISION, T.DATA_SCALE AS SCALE, T.NULLABLE AS NULLABLE, (CASE WHEN P.OWNER IS NULL THEN 'N' ELSE 'Y' END) PK, D.DATA_DEFAULT, C.COMMENTS FROM ALL_TAB_COLUMNS T LEFT JOIN ALL_COL_COMMENTS C ON T.OWNER = C.OWNER AND T.TABLE_NAME = C.TABLE_NAME AND T.COLUMN_NAME = C.COLUMN_NAME LEFT JOIN ALL_TAB_COLUMNS D ON T.OWNER = D.OWNER AND T.TABLE_NAME = D.TABLE_NAME AND T.COLUMN_NAME = D.COLUMN_NAME LEFT JOIN (SELECT AU.OWNER, AU.TABLE_NAME, CU.COLUMN_NAME FROM ALL_CONS_COLUMNS CU, ALL_CONSTRAINTS AU WHERE CU.OWNER = AU.OWNER AND CU.CONSTRAINT_NAME = AU.CONSTRAINT_NAME AND AU.CONSTRAINT_TYPE = 'P') P ON T.OWNER = P.OWNER AND T.TABLE_NAME =P.TABLE_NAME AND T.COLUMN_NAME = P.COLUMN_NAME WHERE (T.OWNER = :OWNER OR :OWNER IS NULL) AND (T.TABLE_NAME = :TABLENAME OR :TABLENAME IS NULL) AND (T.COLUMN_NAME = :COLUMNNAME OR :COLUMNNAME IS NULL) ORDER BY T.OWNER, T.TABLE_NAME, T.COLUMN_ID"; ParameteRestrition(parameters, "OWNER", 0, restrictionValues); ParameteRestrition(parameters, "TABLENAME", 1, restrictionValues); ParameteRestrition(parameters, "COLUMNNAME", 2, restrictionValues); return(ParseMetadata(database, sql, parameters, (wrapper, reader) => new Column { Schema = wrapper.GetString(reader, 0), TableName = wrapper.GetString(reader, 1), Name = wrapper.GetString(reader, 2), DataType = wrapper.GetString(reader, 3), Length = wrapper.GetInt32(reader, 4), NumericPrecision = wrapper.GetInt32(reader, 5), NumericScale = wrapper.GetInt32(reader, 6), IsNullable = wrapper.GetString(reader, 7) == "Y", IsPrimaryKey = wrapper.GetString(reader, 8) == "Y", Default = wrapper.GetString(reader, 9), Description = wrapper.GetString(reader, 10), })); }
public void ExecuteGeocodeAddress(IPluginExecutionContext pluginExecutionContext, IOrganizationService organizationService, ITracingService tracingService = null) { ParameterCollection InputParameters = pluginExecutionContext.InputParameters; // 5 fields (string) for individual parts of an address ParameterCollection OutputParameters = pluginExecutionContext.OutputParameters; // 2 fields (double) for resultant geolocation tracingService.Trace("ExecuteGeocodeAddress started. InputParameters = {0}, OutputParameters = {1}", InputParameters.Count().ToString(), OutputParameters.Count().ToString()); try { // If a plugin earlier in the pipeline has already geocoded successfully, quit if ((double)OutputParameters[LatitudeKey] != 0d || (double)OutputParameters[LongitudeKey] != 0d) { return; } int Lcid = (int)InputParameters[LcidKey]; string _address = string.Empty; if (Lcid == 0) { var userSettingsQuery = new QueryExpression("usersettings"); userSettingsQuery.ColumnSet.AddColumns("uilanguageid", "systemuserid"); userSettingsQuery.Criteria.AddCondition("systemuserid", ConditionOperator.Equal, pluginExecutionContext.InitiatingUserId); var userSettings = organizationService.RetrieveMultiple(userSettingsQuery); if (userSettings.Entities.Count > 0) { Lcid = (int)userSettings.Entities[0]["uilanguageid"]; } } _address = GisUtility.FormatInternationalAddress(Lcid, (string)InputParameters[Address1Key], (string)InputParameters[PostalCodeKey], (string)InputParameters[CityKey], (string)InputParameters[StateKey], (string)InputParameters[CountryKey]); var street = ((string)InputParameters[Address1Key]).Replace(" ", "+"); var city = ((string)InputParameters[CityKey]).Replace(" ", "+"); var state = (string)InputParameters[StateKey]; var postcode = (string)InputParameters[PostalCodeKey]; tracingService.Trace("street " + street); tracingService.Trace("postcode " + postcode); tracingService.Trace("city " + city); tracingService.Trace("state " + state); var url = $"https://{trimbleMaps.ApiServer}{trimbleMaps.GeocodePath}?street={street}&city={city}&state={state}&postcode={postcode}®ion=NA&dataset=Current"; tracingService.Trace($"Calling {url}\n"); Uri requestUri = new Uri(url); HttpWebRequest req = WebRequest.Create(requestUri) as HttpWebRequest; req.Headers["Authorization"] = "03F68EA06887B2428771784EFEB79DDD"; req.ContentType = "application/json"; try { using (HttpWebResponse response = (HttpWebResponse)req.GetResponse()) { //string txtResponse = ""; //using (StreamReader sr = new StreamReader(response.GetResponseStream())) //{ // string txtResponse.Text = sr.ReadToEnd(); //} tracingService.Trace("Parsing response ...\n"); tracingService.Trace(response.ToString() + '\n'); string txtResponse = ""; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { txtResponse = sr.ReadToEnd(); } txtResponse = txtResponse.Remove(0, 1); txtResponse = txtResponse.Remove(txtResponse.Length - 1, 1); tracingService.Trace(txtResponse + '\n'); tracingService.Trace("about to serial\n"); DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(TrimbleMapsGeocodeResponse)); tracingService.Trace("about to read object\n"); object objResponse = jsonSerializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(txtResponse))); tracingService.Trace("about to ilist\n"); var geocodeResponseNotList = objResponse as TrimbleMapsGeocodeResponse; tracingService.Trace("Checking geocodeResponse.Result...\n"); tracingService.Trace(geocodeResponseNotList.ToString() + "not list\n"); tracingService.Trace("hope i got it all geez\n"); //if (geocodeResponse.First() != null) //{ //if (geocodeResponse.Count() == 1) //{ tracingService.Trace("Checking geocodeResponse.Coords...\n"); if (geocodeResponseNotList?.Coords != null) { tracingService.Trace("Setting Latitude, Longitude in OutputParameters...\n"); OutputParameters[LatitudeKey] = Convert.ToDouble(geocodeResponseNotList.Coords.Lat); OutputParameters[LongitudeKey] = Convert.ToDouble(geocodeResponseNotList.Coords.Lon); } else { throw new ApplicationException($"Server {trimbleMaps.ApiServer} application error (missing Coords)"); } //} // else throw new ApplicationException($"Server {trimbleMaps.ApiServer} application error (more than 1 result returned)"); //} //else throw new ApplicationException($"Server {trimbleMaps.ApiServer} application error (missing response body)"); } } catch (Exception ex) { throw new InvalidPluginExecutionException(string.Format("Response parse failed at {0} with exception -- {1}: {2}" , trimbleMaps.ApiServer, ex.GetType().ToString(), ex.Message), ex); } } catch (Exception ex) { // Signal to subsequent plugins in this message pipeline that geocoding failed here. OutputParameters[LatitudeKey] = 0d; OutputParameters[LongitudeKey] = 0d; //TODO: You may need to decide which caught exceptions will rethrow and which ones will simply signal geocoding did not complete. throw new InvalidPluginExecutionException(string.Format("Geocoding failed at {0} with exception -- {1}: {2}" , trimbleMaps.ApiServer, ex.GetType().ToString(), ex.Message), ex); } }
/// <summary> /// Initializes a new instance of the <see cref="Skybox"/> class. /// </summary> public Skybox() { Parameters = new ParameterCollection(); DiffuseLightingParameters = new ParameterCollection(); SpecularLightingParameters = new ParameterCollection(); }
// Updates the parameters collection associated with the specified property name private static void SetParameters(string propertyName, EntityDataSourceDesigner designer, ParameterCollection parameters) { switch (propertyName) { case "CommandText": designer.SetCommandParameterContents(parameters); break; case "OrderBy": designer.SetOrderByParameterContents(parameters); break; case "Select": designer.SetSelectParameterContents(parameters); break; case "Where": designer.SetWhereParameterContents(parameters); break; default: Debug.Fail("Unknown property name in EntityDataSourceStatementEditor: " + propertyName); break; } }
public void ApplyViewParameters(ParameterCollection parameters) { Marcher.ApplyViewParameters(parameters); }
public virtual void ApplyViewParameters(RenderDrawContext context, ParameterCollection parameters, LightShadowMapTexture shadowMapTexture) { }
/// <summary> /// 李程新添加查询用户信息代码 /// </summary> /// <param name="queryCollection"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="orderField"></param> /// <param name="orderDirection"></param> /// <param name="total"></param> /// <returns></returns> public List <string> GetUserInfoList(Dictionary <string, QueryItemDomainModel> queryCollection, int pageIndex, int pageSize, string orderField, string orderDirection, out int total) { total = 0; List <string> result = null; StringBuilder sqlBuilder = new StringBuilder(); sqlBuilder.Append("FROM user_info WHERE 1=1 "); ParameterCollection pc = new ParameterCollection(); int count = 0; #region 构造查询条件 foreach (QueryItemDomainModel item in queryCollection.Values) { switch (item.Operation) { case "equal": sqlBuilder.AppendFormat(@" AND [{0}] = $value{1}$", item.FieldType, count); pc.Add("value" + count.ToString(), item.SearchValue); break; case "notequal": sqlBuilder.AppendFormat(@" AND [{0}] <> $value{1}$", item.FieldType, count); pc.Add("value" + count.ToString(), item.SearchValue); break; case "contain": sqlBuilder.AppendFormat(@" AND [{0}] LIKE $value{1}$", item.FieldType, count); pc.Add("value" + count.ToString(), "%" + item.SearchValue + "%"); break; case "greater": sqlBuilder.AppendFormat(@" AND [{0}] > $value{1}$", item.FieldType, count); pc.Add("value" + count.ToString(), item.SearchValue); break; case "greaterequal": sqlBuilder.AppendFormat(@" AND [{0}] >= $value{1}$", item.FieldType, count); pc.Add("value" + count.ToString(), item.SearchValue); break; case "less": sqlBuilder.AppendFormat(@" AND [{0}] < $value{1}$", item.FieldType, count); pc.Add("value" + count.ToString(), item.SearchValue); break; case "lessequal": sqlBuilder.AppendFormat(@" AND [{0}] <= $value{1}$", item.FieldType, count); pc.Add("value" + count.ToString(), item.SearchValue); break; case "between": sqlBuilder.AppendFormat(@" AND [{0}] BETWEEN $begin{1}$ AND $end{1}$", item.FieldType, count); pc.Add("begin" + count.ToString(), item.BeginTime); pc.Add("end" + count.ToString(), item.EndTime); break; case "today": sqlBuilder.AppendFormat(@" AND DATEDIFF(DAY,[{0}],GETDATE()) = 0", item.FieldType); break; case "week": sqlBuilder.AppendFormat(@" AND DATEDIFF(WEEK,[{0}],GETDATE()) = 0", item.FieldType); break; case "month": sqlBuilder.AppendFormat(@" AND DATEDIFF(MONTH,[{0}],GETDATE()) = 0", item.FieldType); break; case "quarter": sqlBuilder.AppendFormat(@" AND DATEDIFF(QUARTER,[{0}],GETDATE()) = 0", item.FieldType); break; case "year": sqlBuilder.AppendFormat(@" AND DATEDIFF(YEAR,[{0}],GETDATE()) = 0", item.FieldType); break; default: break; } count++; } #endregion total = Convert.ToInt32(ExecuteScalar("SELECT COUNT(1) " + sqlBuilder.ToString(), pc)); DataTable dt = ExecuteDataTable("SELECT User_id " + sqlBuilder.ToString(), pc, pageIndex, pageSize, OrderByCollection.Create(orderField, orderDirection)); if (dt != null && dt.Rows.Count > 0) { result = new List <string>(); for (int i = 0; i < dt.Rows.Count; i++) { result.Add(dt.Rows[i][0].ToString()); } } return(result); }
public void SetParameters(ParameterCollection parameters) { }
/// <summary> /// Initializes a new instance of the <see cref="Material"/> class. /// </summary> public Material() { Parameters = new ParameterCollection(); }
internal EntityQueryBuilder(ISyntaxProvider syntax, EntityPersistentEnvironment environment, Type entityType, ParameterCollection parameters) : this(syntax, environment, entityType) { m_parameters = parameters; }
public void SetPriorityBasedStatus() { var serviceProvider = new StubIServiceProvider(); var pluginContext = new StubIPluginExecutionContext(); var organizationService = new StubIOrganizationService(); pluginContext.PrimaryEntityNameGet = () => "incident"; pluginContext.PrimaryEntityIdGet = () => new Guid("884A078B-0467-E711-80F5-3863BB3C0660"); ParameterCollection paramCollection = new ParameterCollection(); ParameterCollection paramCollectionPostImage = new ParameterCollection(); Entity incident = new Entity("incident"); incident.Id = new Guid("884A078B-0467-E711-80F5-3863BB3C0660"); incident.Attributes["statuscode"] = new OptionSetValue(2); incident.Attributes["smp_problembuilding"] = new EntityReference("smp_building", new Guid("884A078B-0467-E711-80F5-3863BB3C1560")) { Name = "building" }; incident.Attributes["new_problemroomnumber"] = new EntityReference("smp_room", new Guid("884A078B-0467-E711-80F5-3863BB3C0560")) { Name = "room" }; incident.Attributes["caseorigincode"] = new OptionSetValue(1); incident.Attributes["smp_duedate"] = new DateTime(2018, 1, 8); incident.Attributes["smp_portalsubmit"] = false; incident.Attributes["smp_duedatebybuildingtimezone"] = "2018-01-08"; incident.Attributes["smp_occureddatetimebybuildingtimezone"] = "2018-01-08"; incident["smp_submitteddatetime"] = "2018-01-08"; incident["createdon"] = "2018-01-08"; incident["smp_problemoccureddatetime"] = "2018-01-08"; incident["smp_createdfrom"] = new OptionSetValue(1); incident["smp_integrationstatus"] = true; incident.Attributes["smp_submitteddatetimebybuildingtimezone"] = "2018-01-08"; incident.Attributes["smp_createddatetimebybuildingtimezone"] = "2018-01-08"; incident["smp_contact"] = new EntityReference("contact", new Guid("884A078B-0466-E711-80F5-3863BB3C0560")) { Name = "contact" }; incident.Attributes["smp_priorityid"] = new EntityReference("smp_priority", new Guid("884A078B-0466-E711-80F5-3863BB3C0560")) { Name = "priority" }; incident.Attributes["smp_problemroomtype"] = new EntityReference("smp_roomtype", new Guid("884A078B-0466-E711-80F5-3863BB3C0560")) { Name = "roomtype" }; incident.Attributes["smp_problemclassid"] = new EntityReference("smp_problemclass", new Guid("884A078B-0468-E711-80F5-3863BB3C0560")) { Name = "problemClass" }; incident.Attributes["smp_problemtypeid"] = new EntityReference("smp_problemtype", new Guid("884A078B-0469-E711-80F5-3863BB3C0560")) { Name = "problemType" }; incident.Attributes["smp_priorityid"] = new EntityReference("smp_priority", new Guid("884A078B-0469-E711-80F5-3863BB3C0560")); incident.Attributes["customerid"] = new EntityReference("account", new Guid("884A078B-0469-E711-80F5-3863BB3C0560")); paramCollection.Add("Target", incident); pluginContext.InputParametersGet = () => paramCollection; EntityImageCollection postImage = new EntityImageCollection { (new KeyValuePair <string, Entity>("PostImage", incident)) }; Helper.Helper.PluginVariables(serviceProvider, pluginContext, organizationService, 40, "Create", postImage); organizationService.RetrieveMultipleQueryBase = (query) => { EntityCollection collection = new EntityCollection(); string entityName = string.Empty; if (query.GetType().Name.Equals("QueryExpression")) { entityName = ((QueryExpression)query).EntityName; } else { entityName = ((QueryByAttribute)query).EntityName; } if (entityName == "smp_configuration") { Entity configuration = new Entity("smp_configuration"); configuration.Id = new Guid("884A078B-0466-E711-80F5-3863BB3C0560"); configuration["smp_title"] = "8/8RoutingPriorities"; configuration["smp_value"] = "P1,P2,PS1,PS2"; collection.Entities.Add(configuration); Entity configuration1 = new Entity("smp_configuration"); configuration1.Id = new Guid("884A078B-0466-E711-80F5-3863BB3C0560"); configuration1["smp_title"] = "EmailSenderDomainName"; configuration1["smp_value"] = "*****@*****.**"; collection.Entities.Add(configuration1); Entity configuration2 = new Entity("smp_configuration"); configuration2.Id = new Guid("884A078B-0466-E711-80F5-3863BB3C0560"); configuration2["smp_title"] = "PendingDispatchStatusCode"; configuration2["smp_value"] = "2"; collection.Entities.Add(configuration2); Entity configuration3 = new Entity("smp_configuration"); configuration3.Id = new Guid("884A078B-0466-E711-80F5-3863BB3C0560"); configuration3["smp_title"] = "DefaultProviderName"; configuration3["smp_value"] = "NotAssigned"; collection.Entities.Add(configuration3); Entity configuration4 = new Entity("smp_configuration"); configuration4.Id = new Guid("884A078B-0466-E711-80F5-3863BB3C0560"); configuration4["smp_title"] = "NoCmmsIntegrationActionCodes"; configuration4["smp_value"] = "Draft"; collection.Entities.Add(configuration4); Entity configuration5 = new Entity("smp_configuration"); configuration5.Id = new Guid("884A078B-0466-E711-80F5-3863BB3C0560"); configuration5["smp_title"] = "StatusChangeOnCodes"; configuration5["smp_value"] = "Draft"; collection.Entities.Add(configuration5); } else if (entityName == "smp_servicerequeststatuscode") { Entity srStatusCode = new Entity(entityName); srStatusCode["smp_name"] = "test"; srStatusCode["smp_servicerequeststatus"] = new OptionSetValue(2); collection.Entities.Add(srStatusCode); } return(collection); }; organizationService.RetrieveStringGuidColumnSet = delegate(string entity, Guid guid, ColumnSet secondaryUserColumnSet) { if (entity == "account") { Entity account = new Entity(entity); account["name"] = "test Provider"; account["smp_iscmmsintegrationenabled"] = true; account["smp_cmmsurl"] = "testurl"; account["smp_hostedonazure"] = false; account["smp_providerteam"] = new EntityReference("team", new Guid("884A078B-0467-E711-80F5-3863BB3C0652")); return(account); } return(null); }; PostCreateorUpdateSetPriorityBasedStatus setPriorityBasedStatus = new PostCreateorUpdateSetPriorityBasedStatus(); setPriorityBasedStatus.Execute(serviceProvider); }
/// <summary> /// Initializes a new instance of the <see cref="Material"/> class. /// </summary> /// <param name="parameters">The parameters.</param> public Material(ParameterCollection parameters) { Parameters = parameters; }
protected void btnupdate_Click(object sender, EventArgs e) { try { if (btnupdate.Text == "Update") { string chapterid = hiddenchapterid.Value; string subid = string.Empty; string chapter = string.Empty; string Shortchapterdescription = string.Empty; string chapterdescription = string.Empty; string userid = Session["userid"].ToString(); if (ddlssubjectss.SelectedIndex > 0) { subid = ddlssubjectss.SelectedValue.ToString(); } else { return; } if (txtchapter.Text.Trim() == "") { return; } chapter = txtchapter.Text.Trim(); chapterdescription = txtdecsription.Text.Trim(); Shortchapterdescription = txtshortdescription.Text; ParameterCollection obParam = new ParameterCollection(); obParam.Add("@chapterid", chapterid); obParam.Add("@subid", subid); obParam.Add("@chapter", chapter); obParam.Add("@description", chapterdescription); obParam.Add("@userid", userid); obParam.Add("@shortdescription", Shortchapterdescription); Boolean result = dal.fnExecuteNonQueryByPro("updatechapter", obParam); if (result) { txtchapter.Text = ""; txtdecsription.Text = ""; Response.Redirect("Chapters"); } } else if (btnupdate.Text == "Delete") { string chapterid = hiddenchapterid.Value; obDs = dal.fnRetriveByQuery("select * from questions where chapterid='" + chapterid + "'"); DataTable dt = obDs.Tables[0]; if (dt.Rows.Count > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "ErrorShow('Can not Delete This Chapter Because Some Questions Are Assigned To This Chapter First you have to delete questions related to this chapter');", true); return; } Boolean result = dal.fnExecuteNonQuery("delete from chapters where chapterid='" + chapterid + "'"); if (result) { txtchapter.Text = ""; txtdecsription.Text = ""; Response.Redirect("Chapters"); } } } catch (Exception ex) { } }
public override void ApplyViewParameters(RenderDrawContext context, int viewIndex, ParameterCollection parameters) { base.ApplyViewParameters(context, viewIndex, parameters); parameters.Set(ambientLightKey, ref AmbientColor[viewIndex]); }
public IEntity Generate(string componentIdentifier, string originalName, string type, ParameterCollection parameters, ICircuitContext context) { BipolarJunctionTransistor bjt = new BipolarJunctionTransistor(componentIdentifier); // If the component is of the format QXXX NC NB NE MNAME off we will insert NE again before the model name if (parameters.Count == 5 && parameters[4] is WordParameter w && w.Image == "off") { parameters.Insert(3, parameters[2]); } // If the component is of the format QXXX NC NB NE MNAME we will insert NE again before the model name if (parameters.Count == 4) { parameters.Insert(3, parameters[2]); } context.CreateNodes(bjt, parameters); if (parameters.Count < 5) { context.Result.Validation.Add(new ValidationEntry(ValidationEntrySource.Reader, ValidationEntryLevel.Warning, "Wrong parameters count for BJT", parameters.LineInfo)); return(null); } context.SimulationPreparations.ExecuteActionBeforeSetup((simulation) => { context.ModelsRegistry.SetModel( bjt, simulation, parameters.Get(4), $"Could not find model {parameters.Get(4)} for BJT {originalName}", (Context.Models.Model model) => bjt.Model = model.Name, context.Result); }); for (int i = 5; i < parameters.Count; i++) { var parameter = parameters[i]; if (parameter is SingleParameter s) { if (s is WordParameter) { switch (s.Image.ToLower()) { case "on": bjt.SetParameter("off", false); break; case "off": bjt.SetParameter("on", false); break; default: throw new System.Exception(); } } else { // TODO: Verify it var bp = bjt.Parameters; if (bp.Area == 0.0) { bp.Area = context.Evaluator.EvaluateDouble(s.Image); } if (!bp.Temperature.Given) { bp.Temperature = context.Evaluator.EvaluateDouble(s.Image); } } } if (parameter is AssignmentParameter asg) { if (asg.Name.ToLower() == "ic") { context.SetParameter(bjt, "ic", asg.Value); } } } return(bjt); }
public abstract Task SetParametersAsync(ParameterCollection parameters);