/// <summary> /// Try to bind the idenfier as operation import (function import or action import) segment, /// Append it into path. /// </summary> private static bool TryBindOperationImport(string identifier, string parenthesisExpressions, IEdmModel model, IList <PathSegment> path, PathParserSettings settings) { // split the parameter key/value pair parenthesisExpressions.ExtractKeyValuePairs(out IDictionary <string, string> parameters, out string remaining); IList <string> parameterNames = parameters == null ? null : parameters.Keys.ToList(); IEdmOperationImport operationImport = OperationHelper.ResolveOperationImports(identifier, parameterNames, model, settings.EnableCaseInsensitive); if (operationImport != null) { operationImport.TryGetStaticEntitySet(model, out IEdmEntitySetBase entitySetBase); path.Add(new OperationImportSegment(operationImport, entitySetBase, identifier)); if (remaining != null && operationImport.IsFunctionImport()) { IEdmFunction function = (IEdmFunction)operationImport.Operation; if (function.IsComposable) { if (TryBindKeySegment(parenthesisExpressions, path)) { return(true); } } } return(true); } return(false); }
/// <summary> /// repositions the polygon so the Centroid is the origin. /// </summary> /// <param name="vertices">The vertices of the polygon.</param> /// <returns>The vertices of the polygon with the Centroid as the Origin.</returns> public static Vector2D[] MakeCentroidOrigin(Vector2D[] vertices) { Vector2D centroid; BoundingPolygon.GetCentroid(vertices, out centroid); return(OperationHelper.ArrayRefOp <Vector2D, Vector2D, Vector2D>(vertices, ref centroid, Vector2D.Subtract)); }
/// <summary> /// Initializes a new instance of the <see cref="FunctionImportSegmentTemplate" /> class. /// </summary> /// <param name="segment">The input function import segment.</param> public FunctionImportSegmentTemplate(OperationImportSegment segment) { if (segment == null) { throw Error.ArgumentNull(nameof(segment)); } IEdmOperationImport operationImport = segment.OperationImports.First(); if (!operationImport.IsFunctionImport()) { throw new ODataException(Error.Format(SRResources.SegmentShouldBeKind, "FunctionImport", "FunctionImportSegmentTemplate")); } FunctionImport = (IEdmFunctionImport)operationImport; NavigationSource = segment.EntitySet; ParameterMappings = OperationHelper.BuildParameterMappings(segment.Parameters, operationImport.Name); // join the parameters as p1={p1} Literal = FunctionImport.Name + "(" + string.Join(",", ParameterMappings.Select(a => $"{a.Key}={{{a.Value}}}")) + ")"; IsSingle = FunctionImport.Function.ReturnType.TypeKind() != EdmTypeKind.Collection; }
/// <summary> /// 通信结束 /// </summary> public static bool CommunicateStop() { if (Current.Tester.IsEnabled) { string msg = string.Empty; if (!Current.Tester.DisConnect(out msg)) { OperationHelper.ShowTips(msg); Current.Tester.RealtimeStatus = "断开连接出现异常"; return(false); } Current.Tester.AlarmStr = string.Empty; Current.Tester.RealtimeStatus = "断开连接"; OperationHelper.ShowTips("关闭串口连接成功:" + Current.Tester.PortName); } if (Current.Collector.IsEnabled) { string msg = string.Empty; if (!Current.Collector.DisConnect(out msg)) { OperationHelper.ShowTips(msg); Current.Collector.RealtimeStatus = "断开连接出现异常"; return(false); } Current.Collector.AlarmStr = string.Empty; Current.Collector.RealtimeStatus = "断开连接"; OperationHelper.ShowTips("关闭串口连接成功:" + Current.Collector.PortName); } if (Current.Controller.IsEnabled) { string msg = string.Empty; if (!Current.Controller.PLC.DisConnect(out msg)) { OperationHelper.ShowTips(msg); Current.Controller.RealtimeStatus = "断开连接出现异常"; return(false); } Current.Controller.IsAlive = false; Current.Controller.RealtimeStatus = "断开连接"; OperationHelper.ShowTips("关闭PLC连接成功:" + Current.Controller.PLC.IP); } if (Current.Mes.IsEnabled) { string msg = string.Empty; if (!Current.Mes.DisConnect(out msg)) { OperationHelper.ShowTips(msg); Current.Mes.RealtimeStatus = "断开连接出现异常"; return(false); } Current.Mes.RealtimeStatus = "断开连接"; OperationHelper.ShowTips("关闭MES连接成功:" + Current.Mes.Host); } return(true); }
public StatusService(AppDbContext context, OperationHelper operationHelper, IdentityErrorHelper errorHelper, IMapper mapper) { _context = context; _operationHelper = operationHelper; _errorHelper = errorHelper; _mapper = mapper; }
public void Push(FunctionArgument _args, EvalContext cal) { OperationHelper.AssertArgsNumberThrowIf(this, 1, _args.Arguments); var v = cal.GetValue <IValue>(_args.Arguments[0]); stack.Enqueue(v); }
/// <summary> /// operation employee add custom clearance order from process operation order /// </summary> /// <param name="id">Operation Id</param> /// <returns>add custom clearance order patial view</returns> public ActionResult CustomClearanceOrder(int id, int houseBillId, byte orderFrom) { #region Check Rights bool hasRights; if (orderFrom == 1) //Check export rights { hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportHB, ActionEnum.AddEditCCOrder); } else { hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportHB, ActionEnum.AddEditCCOrder); } if (!hasRights) { return(PartialView("~/Views/Shared/_UnAuthorized.cshtml")); } #endregion ViewBag.customClearObj = CustomClearanceHelper.GetCustomClearance(id, houseBillId); EasyFreight.Models.HouseBillView operationView = HouseBillHelper.GetHBView(houseBillId); ViewBag.ContainerSummary = OperationHelper.GetContainersSummary(id); return(PartialView("~/Views/CustomClearance/_CustomClearance.cshtml", operationView)); }
public void MoveToOneStepWithOpinion() { WfClientProcessInfo processInfo = OperationHelper.PreapreProcessWithConditionLinesInstance(); WfClientTransferParams transferParams = new WfClientTransferParams("N2"); transferParams.Assignees.Add(Consts.Users["CEO"]); WfClientRuntimeContext runtimeContext = new WfClientRuntimeContext(); runtimeContext.Operator = Consts.Users["Requestor"]; runtimeContext.Opinion = new WfClientOpinion() { Content = "我很高兴" }; processInfo = WfClientProcessRuntimeServiceProxy.Instance.MoveTo(processInfo.ID, transferParams, runtimeContext); processInfo.Output(); Assert.AreEqual("N2", processInfo.CurrentActivity.Descriptor.Key); Assert.IsTrue(processInfo.CurrentActivity.Assignees.Contains(Consts.Users["CEO"].ID)); WfClientProcessInfo prevProcessInfo = WfClientProcessRuntimeServiceProxy.Instance.GetProcessInfoByActivityID(processInfo.PreviousActivity.ID, runtimeContext.Operator); prevProcessInfo.Output(); Assert.IsNotNull(prevProcessInfo.CurrentOpinion); WfClientOpinionCollection opinions = WfClientProcessRuntimeServiceProxy.Instance.GetOpinionsByResourceID(prevProcessInfo.ResourceID); Assert.IsTrue(opinions.Count > 0); }
public void SaveProcessWithOpinionTest() { WfClientProcessInfo processInfo = OperationHelper.PreapreProcessWithConditionLinesInstance(); WfClientRuntimeContext runtimeContext = new WfClientRuntimeContext(); runtimeContext.ApplicationRuntimeParameters["Amount"] = 1000; runtimeContext.Operator = Consts.Users["Requestor"]; runtimeContext.ProcessContext["Context"] = "This is process context"; runtimeContext.Opinion = new WfClientOpinion() { Content = "我很高兴" }; runtimeContext.AutoCalculate = true; processInfo = WfClientProcessRuntimeServiceProxy.Instance.SaveProcess(processInfo.ID, runtimeContext); processInfo.Output(); Assert.AreEqual("N2", processInfo.NextActivities[0].Activity.DescriptorKey); Assert.IsNotNull(processInfo.CurrentOpinion); WfClientOpinionCollection opinions = WfClientProcessRuntimeServiceProxy.Instance.GetOpinionsByProcessID(processInfo.ID); Assert.IsTrue(opinions.Count > 0); }
/// <summary> /// Metoda pobierająca z bazy danych MySQL pojedynczy rekord o podanym identyfikatorze (IdInventory) i przypisująca go do podanej strukturze tabeli (tableInventoryItem). /// </summary> /// <param name="dbClient"></param> /// <param name="IdInventory"></param> /// <param name="tableInventoryItem"></param> /// <returns></returns> public static bool Get(Database.Client dbClient, int IdInventory, Database.Structure.Tables.Inventory tableInventoryItem) { if (dbClient == null || dbClient.Connection() == null) { return(false); } if (!dbClient.OpenConnection()) // próba nawiązania połączenia z bazą { return(false); } try { MySqlCommand mySqlCmd = new MySqlCommand("InventoryGet", dbClient.Connection()); mySqlCmd.CommandType = System.Data.CommandType.StoredProcedure; mySqlCmd.Parameters.AddWithValue("_IdInventory", IdInventory); mySqlCmd.ExecuteNonQuery(); MySqlDataReader reader = mySqlCmd.ExecuteReader(); if (reader.Read()) { int i = 0; tableInventoryItem.Idinventory = (int)reader[i++]; tableInventoryItem.Idproduct = (int)reader[i++]; tableInventoryItem.Qty = (int)reader[i++]; tableInventoryItem.Last_activity = OperationHelper.PrepareDateTimeValue(reader[i].ToString()); reader.Close(); } return(true); } catch (MySqlException ex) { Trace.WriteLine(ex.Message); return(false); } // pamiętać, aby zamykać połączenie }
/// <summary> /// String representation of <see cref="FilterStatement{TPropertyType}" />. /// </summary> /// <returns></returns> public override string ToString() { var value = Value; IEnumerable <string> valueList; if (ValueIsList(out valueList)) { var matchType = new OperationHelper().FetchMatchType(Operation, MatchType); if (Operation == Operation.Between) { value = string.Join(" AND ", valueList); } else if (valueList.Count() == 1) { value = valueList.First(); } else { value = matchType + " ( \"" + string.Join("\", \"", valueList) + "\" )"; } } var operationHelper = new OperationHelper(); switch (operationHelper.NumberOfValuesAcceptable(Operation, MatchType)) { case 0: return(string.Format("{0} {1}", PropertyId, Operation)); default: return(string.Format("{0} {1} {2}", PropertyId, Operation, value)); } }
/// <summary> /// 添加外键。 /// </summary> /// <typeparam name="TEntity">实体类。</typeparam> /// <typeparam name="TPrincipal">主键类。</typeparam> /// <param name="columns">字段。</param> /// <param name="principalColumns">主键列。</param> /// <param name="onUpdate">更新时候对应的操作。</param> /// <param name="onDelete">删除时候对应的操作。</param> /// <returns>返回迁移构建实例。</returns> public virtual OperationBuilder <AddForeignKeyOperation> AddForeignKey <TEntity, TPrincipal>( Expression <Func <TEntity, object> > columns, Expression <Func <TPrincipal, object> > principalColumns = null, ReferentialAction onUpdate = ReferentialAction.NoAction, ReferentialAction onDelete = ReferentialAction.NoAction) { Check.NotNull(columns, nameof(columns)); var operation = new AddForeignKeyOperation { Table = typeof(TEntity).GetTableName(), Columns = columns.GetPropertyNames(), PrincipalTable = typeof(TPrincipal).GetTableName(), OnUpdate = onUpdate, OnDelete = onDelete }; if (principalColumns == null) { operation.PrincipalColumns = operation.Columns; } else { operation.PrincipalColumns = principalColumns.GetPropertyNames(); } operation.Name = OperationHelper.GetName(NameType.ForeignKey, operation.Table, operation.Columns, operation.PrincipalTable); Operations.Add(operation); return(new OperationBuilder <AddForeignKeyOperation>(operation)); }
/// <summary> /// 添加外键。 /// </summary> /// <param name="table">当前外键所在得表格。</param> /// <param name="columns">字段列表。</param> /// <param name="principal">主键所在得表格。</param> /// <param name="principalColumns">主键字段列表。</param> /// <param name="onUpdate">更新时候对应的操作。</param> /// <param name="onDelete">删除时候对应的操作。</param> /// <returns>返回迁移构建实例。</returns> public virtual OperationBuilder <AddForeignKeyOperation> AddForeignKey( string table, string[] columns, string principal, string[] principalColumns = null, ReferentialAction onUpdate = ReferentialAction.NoAction, ReferentialAction onDelete = ReferentialAction.NoAction) { Check.NotNull(columns, nameof(columns)); var operation = new AddForeignKeyOperation { Table = table, Columns = columns, PrincipalTable = principal, OnUpdate = onUpdate, OnDelete = onDelete }; operation.PrincipalColumns = principalColumns ?? operation.Columns; operation.Name = OperationHelper.GetName(NameType.ForeignKey, operation.Table, operation.Columns, operation.PrincipalTable); Operations.Add(operation); return(new OperationBuilder <AddForeignKeyOperation>(operation)); }
/// <summary> /// 通信结束 /// </summary> public static bool CommunicateStop() { if (Current.Plc.IsEnabled) { string msg = string.Empty; if (!Current.Plc.DisConnect(out msg)) { OperationHelper.ShowTips(msg); return(false); } Current.Plc.AlarmStr = string.Empty; } OperationHelper.ShowTips("关闭和PLC的连接成功,IP:" + Current.Plc.IP); if (Current.Communicator.IsEnabled) { string msg = string.Empty; if (!Current.Communicator.DisConnect(out msg)) { OperationHelper.ShowTips(msg); return(false); } Current.Communicator.AlarmStr = string.Empty; OperationHelper.ShowTips("关闭串口连接成功:" + Current.Communicator.PortName); } return(true); }
public static async Task <IActionResult> Login([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log) { var requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic credenciales = JsonConvert.DeserializeObject(requestBody); string clientId = Environment.GetEnvironmentVariable("clientID", EnvironmentVariableTarget.Process); string scope = Environment.GetEnvironmentVariable("scope", EnvironmentVariableTarget.Process); string clientSecret = Environment.GetEnvironmentVariable("clientSecret", EnvironmentVariableTarget.Process); string username = (string)credenciales["username"]; string password = (string)credenciales["password"]; string grantType = "password"; string tenant = Environment.GetEnvironmentVariable("tenant", EnvironmentVariableTarget.Process); string endPoint = $"https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token"; HttpClient client = new HttpClient(); var parametros = new Dictionary <string, string> { { "client_id", clientId }, { "scope", scope }, { "client_secret", clientSecret }, { "username", username }, { "password", password }, { "grant_type", grantType } }; var requestMessage = new HttpRequestMessage(HttpMethod.Post, endPoint); requestMessage.Content = new FormUrlEncodedContent(parametros); var response = await client.SendAsync(requestMessage); var responseBody = await response.Content.ReadAsStringAsync(); dynamic json = JsonConvert.DeserializeObject(responseBody); client.Dispose(); string accessToken = json.access_token; return(ContainerMethods.GetJsonGetContainer(OperationHelper.GetElement(accessToken), log)); }
public void StartWorkflowWithoutPersist() { WfClientProcessDescriptor processDesp = OperationHelper.PrepareSimpleProcess(); WfClientProcessStartupParams clientStartupParams = ProcessRuntimeHelper.PrepareClientProcessStartupParams(processDesp.Key); clientStartupParams.AutoPersist = false; WfClientProcessInfo processInfo = WfClientProcessRuntimeServiceProxy.Instance.StartWorkflow(clientStartupParams); processInfo.Output(); AssertStartedProcess(processInfo, clientStartupParams); try { WfClientProcess process = WfClientProcessRuntimeServiceProxy.Instance.GetProcessByID(processInfo.ID, Consts.Users["Requestor"]); } catch (WfClientChannelException ex) { if (ex.Message.IndexOf("不能找到") == -1) { throw ex; } } }
protected virtual OperationResponse HandleDebugGame(MasterClientPeer peer, OperationRequest operationRequest) { var operation = new DebugGameRequest(peer.Protocol, operationRequest); OperationResponse response; if (OperationHelper.ValidateOperation(operation, log, out response) == false) { return(response); } GameState gameState; if (this.GameList.TryGetGame(operation.GameId, out gameState) == false) { return(new OperationResponse { OperationCode = operationRequest.OperationCode, ReturnCode = (short)ErrorCode.GameIdNotExists, DebugMessage = LBErrorMessages.GameIdDoesNotExist }); } var debugGameResponse = this.GetDebugGameResponse(peer, gameState); log.InfoFormat("DebugGame: {0}", debugGameResponse.Info); return(new OperationResponse(operationRequest.OperationCode, debugGameResponse)); }
public void InvalidUpdateTagTest() { WfClientProcessInfo processInfo = OperationHelper.PreapreProcessWithConditionLinesInstance(); WfClientRuntimeContext runtimeContext = new WfClientRuntimeContext(Consts.Users["Requestor"]); processInfo = WfClientProcessRuntimeServiceProxy.Instance.GetProcessInfoByID(processInfo.ID, Consts.Users["Requestor"]); processInfo.Output(); runtimeContext.UpdateTag = processInfo.UpdateTag + 1; //Invalid UpdateTag bool thrown = false; try { WfClientProcessRuntimeServiceProxy.Instance.MoveToNextDefaultActivity(processInfo.ID, runtimeContext); } catch (System.Exception ex) { thrown = true; Assert.IsTrue(ex.Message.IndexOf("流程状态已经改变") >= 0); } Assert.IsTrue(thrown); }
private void BtnShowHistoryData_Click(object sender, RoutedEventArgs e) { using (var data = new InsulationContext()) { var dataLogs = data.DataLogs.Where(d => d.DateTime > StartDateTimePicker.Value && d.DateTime < StopDateTimePicker.Value).Take(maxDataCount.Value.Value).ToList(); if (dataLogs.Count < 1) { OperationHelper.ShowTips("该时间范围没数据!", true); return; } ShowDataOrder.Clear(); ShowResistanceData.Clear(); ShowTemperatureData.Clear(); int order = 1; foreach (var cvData in dataLogs) { ShowDataOrder.Add(order); ShowResistanceData.Add(cvData.Resistance); ShowTemperatureData.Add(cvData.Temperature); order++; } } var lgResistance = (LineGraph)linesResistance.Children[0]; lgResistance.Plot(ShowDataOrder, ShowResistanceData); var lgTemperature = (LineGraph)linesTemperature.Children[0]; lgTemperature.Plot(ShowDataOrder, ShowTemperatureData); }
public void ClearTenantProcessInstanceDataTest() { WfClientProcessQueryCondition condition = new WfClientProcessQueryCondition(); condition.BeginStartTime = DateTime.Now.AddHours(-1); condition.EndStartTime = DateTime.Now.AddHours(1); condition.ProcessCreatorID = Consts.Users["Requestor"].ID; TenantContext.Current.DoActions("Test2", () => { WfClientProcessInfo process = OperationHelper.PrepareSimpleProcessInstance(); WfClientProcess processLoaded = WfClientProcessRuntimeServiceProxy.Instance.GetProcessByID(process.ID, Consts.Users["Requestor"]); Assert.IsNotNull(processLoaded); WfClientProcessRuntimeServiceProxy.Instance.ClearTenantProcessInstanceData("Test2"); try { processLoaded = WfClientProcessRuntimeServiceProxy.Instance.GetProcessByID(process.ID, Consts.Users["Requestor"]); Assert.Fail("流程已经被删除,加载流程不能成功"); } catch (System.Exception) { } }); }
private void Button_Click(object sender, RoutedEventArgs e) { try { if ((BitmapImage)NewProfileImage.Source == null) { Tip.Alert("尚未选中新头像"); return; } var newProfilePicture = ((BitmapImage)NewProfileImage.Source).UriSource.ToString(); if (Current.App.UserProfilePicture == newProfilePicture) { Tip.Alert("请选择不同的头像"); return; } Current.App.UserProfilePicture = ((BitmapImage)NewProfileImage.Source).UriSource.ToString(); TengDa.Wpf.Context.UserContext.SaveChanges(); OperationHelper.ShowTips("更换头像成功!", true); } catch (Exception ex) { Error.Alert(ex); } }
public override void OnCreate() { base.OnCreate(); Profiler.Start("OnResume"); CrossCurrentActivity.Current.Init(this); //Set the default notification channel for your app when running Android Oreo if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { //Change for your default notification channel id here FirebasePushNotificationManager.DefaultNotificationChannelId = "FirebasePushNotificationChannel"; //Change for your default notification channel name here FirebasePushNotificationManager.DefaultNotificationChannelName = "General"; } FirebasePushNotificationManager.Initialize(this, false); //Handle notification when app is closed here CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => { if (Xamarin.Forms.Application.Current == null || !IsInForeground()) { bool isAlarmActive = Preferences.Get(Constants.PreferenceAlarmActivate, Constants.PreferenceAlarmActivateDefault); var operation = OperationHelper.MapFirebaseToOperation(p.Data); if (isAlarmActive && p.Data != null) { Intent intent = new Intent(this, typeof(MainActivity)); intent.PutExtra(INTENT_EXTRA_OPERATION, JsonConvert.SerializeObject(operation)); StartActivity(intent); } } }; }
/// <summary> /// Validates the FilterStatement regarding the number of provided values and supported operations. /// </summary> public void Validate() { var helper = new OperationHelper(); ValidateNumberOfValues(); // ValidateSupportedOperations(helper); }
public async Task <ExtGetContainer <List <T> > > GetElements() { var entityQuery = repo.GetEntities(); var entities = await commonDb.TolistAsync(entityQuery); return(OperationHelper.GetElements(entities)); }
/// <summary> /// Initializes a new instance of the <see cref="FunctionSegmentTemplate" /> class. /// </summary> /// <param name="operationSegment">The operation segment, it should be a function segment and the parameters are template.</param> public FunctionSegmentTemplate(OperationSegment operationSegment) { if (operationSegment == null) { throw Error.ArgumentNull(nameof(operationSegment)); } IEdmOperation operation = operationSegment.Operations.FirstOrDefault(); if (!operation.IsFunction()) { throw new ODataException(Error.Format(SRResources.SegmentShouldBeKind, "Function", "FunctionSegmentTemplate")); } Function = (IEdmFunction)operation; NavigationSource = operationSegment.EntitySet; ParameterMappings = OperationHelper.BuildParameterMappings(operationSegment.Parameters, operation.FullName()); // join the parameters as p1={p1} string routeKey = ParameterMappings.BuildRouteKey(); string parameterStr = ParameterMappings.Count == 0 ? "()" : $"({{{routeKey}}})"; UnqualifiedIdentifier = Function.Name + parameterStr; Literal = Function.FullName() + parameterStr; // Function will always have the return type IsSingle = Function.ReturnType.TypeKind() != EdmTypeKind.Collection; }
public void CreateLabelInfoTexts(Node node) { SuspendTextChanges(); try { Texts.Clear(); if (node is GroupNode) { AddLabelInfoText(OperationHelper.GetMenuStringByType(((GroupNode)node).NodeType), new FilterControlFocusInfo(node, 0), Owner.OwnerControl.AppearanceGroupOperatorColor, ElementType.Group, true); if (node.OwnerControl.ShowGroupCommandsIcon) { AddLabelInfoText("@*", new FilterControlFocusInfo(node, 0), Color.Empty, ElementType.NodeAction, true); } AddLabelInfoText("@+", new FilterControlFocusInfo(node, 0), Color.Empty, ElementType.NodeAdd, true); } ClauseNode clauseNode = node as ClauseNode; if (clauseNode != null) { AddLabelInfoText(GetDisplayText(clauseNode.FirstOperand), new FilterControlFocusInfo(clauseNode, 0), Owner.OwnerControl.AppearanceFieldNameColor, ElementType.Property, true); AddSpace(); AddLabelInfoText(OperationHelper.GetMenuStringByType(clauseNode.Operation), new FilterControlFocusInfo(clauseNode, 1), Owner.OwnerControl.AppearanceOperatorColor, ElementType.Operation, true); AddSpace(); AddAdditionalOperands(clauseNode); AddLabelInfoText("@-", new FilterControlFocusInfo(node, 0), Color.Empty, ElementType.NodeRemove, true); } } finally { ResumeTextChanges(); } Invalidate(); }
public bool HandleGroupOperation(EditorCommand command) { switch (command) { case EditorCommand.Copy: OperationHelper.CopyShapes(); return(true); case EditorCommand.Paste: OperationHelper.PasteShapes(); return(true); case EditorCommand.Cut: OperationHelper.CutShapes(); return(true); case EditorCommand.SplitShapes: OperationHelper.ExplodeShapes(); return(true); case EditorCommand.MergeShapes: OperationHelper.MergeShapes(); return(true); case EditorCommand.RemoveShapes: OperationHelper.RemoveShapes(); return(true); } return(false); }
public JsonResult GetColorAndSize(string BigProdNum) { var data = OperationHelper.Try((opera) => { var query = _productContract.Products.Where(x => x.BigProdNum == BigProdNum).ToList(); var list = (from x in query group x by new { x.ProductOriginNumber.TagPrice, x.ProductOriginNumber.PurchasePrice, x.ProductOriginNumber.HtmlPath } into gx select new { gx.Key.TagPrice, gx.Key.PurchasePrice, gx.Key.HtmlPath, list = gx.DistinctBy(b => b.ColorId).Select(s => new { s.ColorId, s.Color.ColorName, ColorImg = s.Color.IconPath, ThumbnailPath = s.ThumbnailPath.IsNotNullAndEmpty() ? s.ThumbnailPath : s.ProductOriginNumber.ThumbnailPath, Sizes = gx.Where(w => w.ColorId == s.ColorId).DistinctBy(xx => xx.SizeId).Select(ss => new { ss.SizeId, ss.Size.SizeName }), }) }).FirstOrDefault(); return(OperationHelper.ReturnOperationResult(true, opera, list)); }, "获取颜色尺码"); return(Json(data)); }
static void InitShape() { Coefficients DefaultCoefficients = TimeWarp.Coefficients; Vector2D[] engineconevertecies = new Vector2D[] { new Vector2D(30, 10), new Vector2D(-30, 40), new Vector2D(-30, -40), new Vector2D(30, -10) }; Vector2D offset = Polygon2D.CalcCentroid(engineconevertecies); OperationHelper.ArrayRefOp <Vector2D, Vector2D, Vector2D>( engineconevertecies, ref offset, engineconevertecies, Vector2D.Subtract); //engineconevertecies = Vector2D.Translate(-offset, engineconevertecies); IGeometry2D mainhull = new Polygon2D(ALVector2D.Zero, Polygon2D.FromRectangle(80, 10)); IGeometry2D engine = new Polygon2D(new ALVector2D(0, new Vector2D(-30, 0)), Polygon2D.FromNumberofSidesAndRadius(10, 40)); IGeometry2D enginecone = new Polygon2D(new ALVector2D(0, offset), engineconevertecies); DefaultShape = new RigidBodyTemplate(12, 1231.9384791047398f, new IGeometry2D[] { engine, mainhull, enginecone }, new Coefficients[] { DefaultCoefficients, DefaultCoefficients, DefaultCoefficients }); DefaultShape.BalanceBody(); //////DefaultShape.CalcInertiaMultiplier(.1f); }
public override double Execute(double[][] data) { var first = this.first.Execute(data); var second = this.second.Execute(data); return(OperationHelper.Calculate(first, second, operation)); }