public override void Flush(Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>> threadsAndFields, SegmentWriteState state) { Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>> oneThreadsAndFields = new Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>>(); Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>> twoThreadsAndFields = new Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>>(); foreach (KeyValuePair<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>> entry in new Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>>(threadsAndFields)) { DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread) entry.Key; IList<DocFieldConsumerPerField> fields = entry.Value; //IEnumerator<DocFieldConsumerPerField> fieldsIt = fields.GetEnumerator(); IList<DocFieldConsumerPerField> oneFields = new List<DocFieldConsumerPerField>(); IList<DocFieldConsumerPerField> twoFields = new List<DocFieldConsumerPerField>(); foreach (DocFieldConsumersPerField perField in fields) { oneFields.Add(perField.one); twoFields.Add(perField.two); } oneThreadsAndFields[perThread.one] = oneFields; twoThreadsAndFields[perThread.two] = twoFields; } one.Flush(oneThreadsAndFields, state); two.Flush(twoThreadsAndFields, state); }
public override void Flush(Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>> threadsAndFields, SegmentWriteState state) { Support.Dictionary<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>> childThreadsAndFields = new Support.Dictionary<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>>(); Support.Dictionary<InvertedDocEndConsumerPerThread, IList<InvertedDocEndConsumerPerField>> endChildThreadsAndFields = new Support.Dictionary<InvertedDocEndConsumerPerThread, IList<InvertedDocEndConsumerPerField>>(); foreach (KeyValuePair<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>> entry in new Support.Dictionary<DocFieldConsumerPerThread, IList<DocFieldConsumerPerField>>(threadsAndFields)) { DocInverterPerThread perThread = (DocInverterPerThread)entry.Key; List<InvertedDocConsumerPerField> childFields = new List<InvertedDocConsumerPerField>(); List<InvertedDocEndConsumerPerField> endChildFields = new List<InvertedDocEndConsumerPerField>(); foreach (DocFieldConsumerPerField field in entry.Value) { DocInverterPerField perField = (DocInverterPerField)field; childFields.Add(perField.consumer); endChildFields.Add(perField.endConsumer); } childThreadsAndFields[perThread.consumer] = childFields; endChildThreadsAndFields[perThread.endConsumer] = endChildFields; } consumer.Flush(childThreadsAndFields, state); endConsumer.Flush(endChildThreadsAndFields, state); }
public Edge ( Support a, Support b) { this.a = a; this.b = b; }
void Awake() { instance = this; influenceImpact = 0f; supportImpact = 1f; OppositionOverTime = 0.1f; }
protected void Page_Load(object sender, EventArgs e) { if ( Session["SlipAdmin"] == null) { //保存出错 Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); Response.StatusCode = 402; Response.StatusDescription = "您没有登录或登录超时,请重新登录!"; Response.End(); } if (IsPostBack) { JsonData jd = new JsonData(); int status = 0; string msg = "未知状态"; Support spt = new Support(); DataModal dm = new DataModal(); try { spt.supportID = Convert.ToInt32(Request.Form["supportID"]); spt.supportTitle = Request.Form["supportTitle"]; spt.supportContent = Request.Form["supportContent"]; dm.SaveSupport(spt); status = 1; msg = "保存成功!"; } catch (Exception ex) { msg = "错误:" + ex.Message; } jd["stauts"] = status; jd["msg"] = msg; Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); Response.Write(jd.ToJson()); Response.End(); } else { int id = 1; if (Request.Params["id"] == null || Request.Params["id"] == "") { id = 1; } else { id = Convert.ToInt32(Request.Params["id"]); } Support spt = new Support(); DataModal dm = new DataModal(); spt = dm.GetSupport(id); this.supportContent.Text = spt.supportContent; this.supportID.Value = spt.supportID.ToString(); this.supportTitle.Text = spt.supportTitle; this.supportTitle.ReadOnly = true; } }
public PartyIdentified(string partyName, List<DvIdentifier> identifiers, Support.Identification.PartyRef externalRef) : this() { this.name = partyName; this.identifiers = identifiers; this.SetBaseData(externalRef); }
public override Executed.BaseStatement CreateExecuted(Support.ExecutedFunctionContext context) { var tmpObj = new Executed.ExpressionStatement(context); tmpObj.Expression = mExpression.CreateExecuted(context); this.BaseStatement_CreateExecutedSupport(context, tmpObj); return tmpObj; }
public Element(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit, DataValue value, DvCodedText nullFlavour) : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit) { this.value = value; this.nullFlavour = nullFlavour; SetAttributeDictionary(); CheckInvariants(); }
public Archetyped(Support.Identification.ArchetypeId archetypeId, string rmVersion, Support.Identification.TemplateId templateId) { Check.Require(archetypeId != null, "archetype_id must not be null"); Check.Require(!string.IsNullOrEmpty(rmVersion), "rm_version must not be null or empty"); this.archetypeId = archetypeId; this.rmVersion = rmVersion; this.templateId = templateId; CheckInvariants(); }
public Cluster(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit, Item[] items) : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit) { if (items != null) { this.items = RmFactory.LocatableList<Item>(this, items); } SetAttributeDictionary(); CheckInvariants(); }
public ItemSingle(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit, Element item) : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit) { Check.Require(item != null, "item must not be null"); this.item = item; if (this.item != null) this.item.Parent = this; SetAttributeDictionary(); CheckInvariants(); }
protected Locatable(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, AssumedTypes.List<Link> links, Archetyped archetypeDetails, FeederAudit feederAudit) : this() { Check.Require(name != null, "name must not be null"); Check.Require(!string.IsNullOrEmpty(archetypeNodeId), "archetype_node_id must not be null or empty"); this.name = name; this.archetypeNodeId = archetypeNodeId; this.uid = uid; this.links = links; this.archetypeDetails = archetypeDetails; this.feederAudit = feederAudit; }
/// <summary> /// Adds the support to attack. /// </summary> public void AddSupportToAttack() { switch (support) { case Support.S_NONE: support = Support.S_ATTACKER; break; case Support.S_DEFENDER: support = Support.S_BOTH; break; default: Console.WriteLine("Attacker already has the support of a director!"); break; } }
public AdminEntry(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit, CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider, Participation[] otherParticipations, ObjectRef workflowId, ItemStructure data) : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit, language, encoding, subject, proider, otherParticipations, workflowId) { Check.Require(data != null, "data must not be null"); this.data = data; this.data.Parent = this; SetAttributeDictionary(); this.CheckInvariants(); }
protected Entry(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit, CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider, Participation[] otherParticipations, ObjectRef workflowId) : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit) { Check.Require(language != null, "language must not be null"); Check.Require(encoding != null, "encoding must not be null"); Check.Require(subject != null, "subject must not be null"); this.language = language; this.encoding = encoding; this.subject = subject; this.provider = proider; if (otherParticipations != null) this.otherParticipations = new OpenEhr.AssumedTypes.List<Participation>(otherParticipations); this.workflowId = workflowId; }
public Observation(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit, CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider, Participation[] otherParticipations, ObjectRef workflowId, ItemStructure protocol, ObjectRef guidelineId, History<ItemStructure> data, History<ItemStructure> state) : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit, language, encoding, subject, proider, otherParticipations, workflowId, protocol, guidelineId) { Check.Require(data != null, "data must not be null"); this.data = data; if (this.data != null) this.data.Parent = this; this.state = state; if (this.state != null) this.state.Parent = this; SetAttributeDictionary(); CheckInvariants(); }
public string createNewObjAndShow(string name, string phone) { string rString = string.Empty; using (var db = ConnectDB.Db()) { var sp = new Support { Name = name, Phone = phone }; db.AddToSupports(sp); db.SaveChanges(); var query = from s in db.Supports orderby s.Name select s; foreach (var item in query) { rString += item.Name.ToString() + " " + item.Phone + "\n"; } } return rString; }
public override Executed.Operator CreateExecuted(Support.ExecutedFunctionContext context) { var tmpObj = new Executed.CallMethodOperator(context, mMethodName); this.UnaryOperator_CreateExecutedSupport(context, tmpObj); if (!StillOneScriptCore.Common.TypeHelpers.ListHelper.IsEmpty(mParams)) { foreach (var param in mParams) { var tmpParam = new StillOneScriptCore.EntityModel.CustomFunctionModel.Operators.Executed.FunctionParameter(); tmpParam.Name = param.Name; tmpParam.Operator = param.Operator.CreateExecuted(context); tmpObj.AddParameter(tmpParam); } } return tmpObj; }
public override void Flush(Support.Dictionary<TermsHashConsumerPerThread, IList<TermsHashConsumerPerField>> threadsAndFields, SegmentWriteState state) { lock (this) { // NOTE: it's possible that all documents seen in this segment // hit non-aborting exceptions, in which case we will // not have yet init'd the TermVectorsWriter. This is // actually OK (unlike in the stored fields case) // because, although IieldInfos.hasVectors() will return // true, the TermVectorsReader gracefully handles // non-existence of the term vectors files. if (tvx != null) { if (state.numDocsInStore > 0) // In case there are some final documents that we // didn't see (because they hit a non-aborting exception): Fill(state.numDocsInStore - docWriter.GetDocStoreOffset()); tvx.Flush(); tvd.Flush(); tvf.Flush(); } foreach(KeyValuePair<TermsHashConsumerPerThread,IList<TermsHashConsumerPerField>> entry in threadsAndFields) { foreach (TermsHashConsumerPerField field in entry.Value ) { TermVectorsTermsWriterPerField perField = (TermVectorsTermsWriterPerField) field; perField.termsHashPerField.Reset(); perField.ShrinkHash(); } TermVectorsTermsWriterPerThread perThread = (TermVectorsTermsWriterPerThread) entry.Key; perThread.termsHashPerThread.Reset(true); } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { lnkCompanyBilling.HRef = string.Format("~/Company/CompanyFinancialDetails.aspx?companyid={0}", CompanyId); lnkCompanyInventory.HRef = string.Format("~/Inventory/CompanyInventory.aspx?companyid={0}", CompanyId); lnkCreateNewProject.CompanyId = this.CompanyId; lnkCreateNewProject.LoadData(); if (this.GetBL <CompanyBL>().HasCompanySuspendedbySBAdmin(CompanyId) || this.GetBL <CompanyBL>().IsCompanyPaymentFailed(CompanyId)) { spanCreateNewProject.Visible = false; } string companyName = Support.GetCompanyNameById(CompanyId); LoadBreadCrumbs(companyName); transactionSearch.RelatedId = CompanyId; planMonitor.CompanyId = CompanyId; transactionSearch.LoadData(); sbCompanyWarningDisplay.CompanyID = CompanyId; sbCompanyWarningDisplay.LoadData(); } }
private void btnCreateOrder_Click(object sender, EventArgs e) { if (MessageBox.Show("Create new order for\nCustomer : " + tbxCustomerName.Text + "\nNIC : " + tbxNIC.Text, "Create Order", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { String NIC = tbxNIC.Text; if (isValidNIC(NIC)) { dgvItems.Enabled = true; btnAddItem.Enabled = true; MessageBox.Show("Add Items and submit the order!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); btnCreateOrder.Enabled = false; btnCancelOrder.Enabled = true; btnClear.Enabled = false; btnAddItem.Focus(); } else { MessageBox.Show("Invalid NIC Number!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } Console.WriteLine(DateTime.Now.ToString()); Console.WriteLine(Support.getMaxVlaueFrom("OrderId", "dtcustomer_orders")); }
public async Task <IEnumerable <SupportFlag> > CheckCompliance(Support support) { await Task.CompletedTask; var approverName = support switch { ClothingSupport s => s.ApproverName, IncidentalsSupport s => s.ApproverName, FoodGroceriesSupport s => s.ApproverName, _ => null }; if (!string.IsNullOrEmpty(approverName)) { return new[] { new AmountExceededSupportFlag { Approver = approverName } } } ; return(Array.Empty <SupportFlag>()); } } }
private void KeyDowns(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Up: Support.UpDownDataGrid(false, GridLista); e.Handled = true; break; case Keys.Down: Support.UpDownDataGrid(true, GridLista); e.Handled = true; break; case Keys.Enter: EditClientes(); break; case Keys.Escape: Close(); break; } }
public void Create(Support_Model model) { var data = Connect_Enttity.Supports.FirstOrDefault(x => x.Id == model.Id); if (data == null) { var entity = new Support(); entity.Name = model.Name; entity.Tel = model.Tel; entity.Type = (int)(model.Type); entity.Nick = model.Nick; entity.Ord = (int)(model.Ord); entity.Active = (int)(model.Active); entity.Lang = model.Lang; entity.GroupSupportId = (int)(model.GroupSupportId); entity.Location = (int)(model.Location); Connect_Enttity.Supports.Add(entity); Connect_Enttity.SaveChanges(); Dispose(); } }
public ActionResult Delete(PrintJob printJob) { if (Support.AdditionalSecurity() == true) { var theADGroup = Support.ADGroupCanPurgePrintQueues(); bool isInRole = User.IsInRole(theADGroup); if (isInRole == false) { Support.SendEmail("Failed cancel print job", "User :"******" attempted to purge print jobs and failed because user does not have access."); return(RedirectToAction("Index")); } } if (CancelPrintJob(printJob.Server, printJob.Printer, printJob.PrintJobID)) { Support.SendEmail("Canceled Print Job", "The following print job has been canceled: " + printJob.PrintJobName + Environment.NewLine + "Printer: " + printJob.Printer + Environment.NewLine + "Print server: " + printJob.Server + Environment.NewLine + "User: "******"Canceled Print Job", "The following print job failed to cancel: " + printJob.PrintJobName + Environment.NewLine + "Printer: " + printJob.Printer + Environment.NewLine + "Print server: " + printJob.Server + Environment.NewLine + "User: "******"Index")); }
/// <summary> /// Sets the read only mode. /// </summary> /// <param name="project">The project.</param> private void SetReadOnlyMode(Data.Project project) { bool userHasAccess = false; //if it is a company admin return true if (Support.IsCompanyAdministrator(project.CompanyId)) { userHasAccess = true; } else { int projectAdminCodeID = Support.GetCodeByValue("ProjectUserTypeCode", "PROJADMIN").CodeId; var projAdmin = (from p in DataContext.Projects join pu in DataContext.ProjectUsers on p.ProjectId equals pu.ProjectId where p.ProjectId == ProjectId && pu.UserId == UserID && pu.IsActive == true && pu.ProjectUserTypeCodeId == projectAdminCodeID && pu.IsActive == true select pu).FirstOrDefault(); userHasAccess = (projAdmin != null); } IsReadOnly = Support.IsReadOnlyProjectByProjectStatus(ProjectId) || !userHasAccess; }
public void InsertingContent() { var dom = TestDom("TestHtml"); var totalCount = dom["*"].Length; string newHtml = Support.GetFile(TestDomPath("TestHtml")); //change it slightly to force the string refs to be offset newHtml = newHtml.Insert(newHtml.IndexOf("<body>") + 6, "<div id=\"new-div\">Johnny Come Lately</div>"); var dom2 = CQ.Create(newHtml); Assert.AreEqual(totalCount + 1, dom2["*"].Length, "The new copy was the same as the original"); var addingCount = dom2["body *"].Length; dom2["body"].Children().InsertBefore(dom["#hlinks-user"].Children().First()); Assert.AreEqual(totalCount + addingCount, dom["*"].Length, "The combined DOM is the right length"); dom["#hlinks-user .reputation-score"].Clone().AppendTo("body"); Assert.AreEqual("3,215", dom[".reputation-score"].First().Text(), "Text didn't get mangled on multiple moves (bug 11/11/11)"); Assert.AreEqual("3,215", dom[".reputation-score"].Last().Text(), "Text didn't get mangled on multiple moves (bug 11/11/11)"); }
public ActionResult Index(Support s) { RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper(); if (String.IsNullOrEmpty(recaptchaHelper.Response)) { ModelState.AddModelError("", "Captcha answer cannot be empty."); return View(s); } RecaptchaVerificationResult recaptchaResult = recaptchaHelper.VerifyRecaptchaResponse(); if (recaptchaResult != RecaptchaVerificationResult.Success) { ModelState.AddModelError("", "Incorrect captcha answer."); return View(s); } if (ModelState.IsValid) { _mailPusher.SendEmail("*****@*****.**", "Administrator","*****@*****.**", s.Subject +" "+ s.Name + "[" + s.MobileNumber + "]", s.Message); TempData["msg"] = "Your Message has been Successfully Sent"; return View(); } ModelState.AddModelError("", "Kindly ensure you supply all necessary and required details"); return View(s); }
public void Init(GameObject newCharacter, int newCharacterType) { this.characterGameobject = newCharacter; this.characterType = newCharacterType; if (this.characterType == 1 || this.characterType == 3) { this.characterScript = this.characterGameobject.GetComponent <Summoner> (); this.defenseGameobject.SetActive(false); } else if (this.characterType == 2) { this.supportScript = this.characterGameobject.GetComponent <Support> (); this.characterHealthBar.SetActive(false); this.characterName.gameObject.SetActive(false); } this.SetParent(); this.SetPlayerInfosPosition(); this.GenerateDices(); this.GenerateEtats(); this.UpdateInfos(); }
/// <summary> /// Loads the bread crumbs. /// </summary> private void LoadBreadCrumbs() { BreadCrumbs bc = GetBreadCrumbsControl(); StageBitz.Data.Project project = DataContext.Projects.Where(p => p.ProjectId == ProjectId).FirstOrDefault(); int companyId = project.Company.CompanyId; if (Support.IsCompanyAdministrator(companyId)) { bc.AddLink(project.Company.CompanyName, string.Format("~/Company/CompanyDashboard.aspx?companyid={0}", companyId)); } else { bc.AddLink(project.Company.CompanyName, string.Empty); } bc.AddLink(project.ProjectName, string.Format("~/Project/ProjectDashboard.aspx?ProjectId={0}", ProjectId)); //bc.AddLink(string.Concat(itemTypeName, " List"), string.Format("~/ItemBrief/ItemBriefList.aspx?ProjectId={0}&ItemTypeId={1}", ProjectId, projectItemTypes.ItemTypeId)); bc.AddLink("Task Manager", null); bc.LoadControl(); }
public Button(string displayName, string internalName, CommandTypesEnum commandType, string clientId, string description, string tooltip, Icon standardIcon, Icon largeIcon, ButtonDisplayEnum buttonDisplayType) { try { //get IPictureDisp for icons var standardIconIPictureDisp = (IPictureDisp)Support.IconToIPicture(standardIcon); var largeIconIPictureDisp = (IPictureDisp)Support.IconToIPicture(largeIcon); //create button definition m_buttonDefinition = m_inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition(displayName, internalName, commandType, clientId, description, tooltip, standardIconIPictureDisp, largeIconIPictureDisp, buttonDisplayType); //enable the button m_buttonDefinition.Enabled = true; //connect the button event sink ButtonDefinition_OnExecuteEventDelegate = ButtonDefinition_OnExecute; m_buttonDefinition.OnExecute += ButtonDefinition_OnExecuteEventDelegate; } catch (Exception e) { MessageBox.Show(e.ToString()); } }
private IEnumerator DelayUploadMessage() { loadingText.text = waitingString; float timeWaited = 0f; float ellipsesTimer = 0f; int ellipsesIndex = 0; while (IsWaitingForConfirmation && timeWaited < maxWaitTime) { float deltaTime = Support.GetDeltaTime(loadingDeltaTime); timeWaited += deltaTime; ellipsesTimer += deltaTime; if (ellipsesTimer > ellipsesInterval) { ellipsesTimer = 0f; ellipsesIndex++; UpdateEllipsesText(ellipsesIndex); } yield return(null); } IsWaitingForConfirmation = false; loadingText.text = wasSuccessful ? successMessage : failureMessage; }
static void Main(string[] args) { Configure(); Assembly assembly = Assembly.Load("PatternLibrary"); var types = assembly.GetTypes(); foreach (var start in from type in types let attributes = (from attr in type.GetCustomAttributes(false) where attr is RunnableAttribute let temp = attr as RunnableAttribute select temp) from start in (from attribute in attributes where attribute.IsRunnable select type.GetMethod("Start")) select start) { start.Invoke(null, null); } Support.Wait(); }
private string ProcessAsteroid(string asteroidName, Vector3I size, Vector3D position, Vector3D offset, Vector3I origin, List <AsteroidSphereLayer> layers) { var storeName = Support.CreateUniqueStorageName(asteroidName); var storage = MyAPIGateway.Session.VoxelMaps.CreateStorage(size); var voxelMap = MyAPIGateway.Session.VoxelMaps.CreateVoxelMap(storeName, storage, position - (Vector3D)origin - offset, 0); // OverwriteAllMaterials is Obsolete and doesn't appear to do anything any more. //if (layers.Count > 0) // voxelMap.Storage.OverwriteAllMaterials(layers[0].Material); bool isEmpty = true; foreach (var layer in layers) { var radius = (float)(layer.Diameter - 2) / 2f; IMyVoxelShapeSphere sphereShape = MyAPIGateway.Session.VoxelMaps.GetSphereVoxelHand(); sphereShape.Center = position; sphereShape.Radius = radius; if (layer.Material == 255) { MyAPIGateway.Session.VoxelMaps.CutOutShape(voxelMap, sphereShape); isEmpty = true; } else if (isEmpty) { MyAPIGateway.Session.VoxelMaps.FillInShape(voxelMap, sphereShape, layer.Material); isEmpty = false; } else { MyAPIGateway.Session.VoxelMaps.PaintInShape(voxelMap, sphereShape, layer.Material); } } return(storeName); }
private void glControl1_DoubleClick(object sender, EventArgs e) { // the screen was double clicked // do object selection MouseEventArgs me = e as MouseEventArgs; MouseButtons buttonPushed = me.Button; int xPos = me.X; int yPos = me.Y; List <ISectData> isects = TestHitTest(xPos, yPos); // find the first object that's not the ground // this will allow us to select an object from the bottom. foreach (ISectData i in isects) { if (i.obj.tag != Object3d.OBJ_GROUND && i.obj.tag != Object3d.OBJ_SEL_PLANE) { if (ModifierKeys == Keys.Control) // double click and control { UVDLPApp.Instance().AddToSelectionList(i.obj); UVDLPApp.Instance().m_engine3d.UpdateLists(); } else { if (i.obj.tag == Object3d.OBJ_SUPPORT) { Support sup = (Support)i.obj; sup.Select(i.poly); } UVDLPApp.Instance().SelectedObject = i.obj; UVDLPApp.Instance().m_engine3d.UpdateLists(); UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eUpdateSelectedObject, ""); } UpdateView(); break; } } }
protected void SubmitButton_Click(object sender, EventArgs e) { object obj = null; ArrayList list = null; Guid organizationId = UserContext.Current.OrganizationId; if (GroupListRow.Visible) { list = GroupIdArrayList; } else if (UserListRow.Visible) { obj = Support.ConvertStringToType(UserList.SelectedValue, typeof(Guid)); list = UserProvider.GetUserGroupIdList(organizationId, ((obj == null) ? Guid.Empty : (Guid)obj)); } Settings.GroupIdList.Clear(); if (list != null) { Settings.GroupIdList.AddRange(list); } if (FrameworkConfiguration.Current.WebApplication.EnableMultipleInstances) { obj = Support.ConvertStringToType(InstanceList.SelectedValue, typeof(Guid)); Settings.InstanceId = ((obj == null) ? Guid.Empty : (Guid)obj); } else { Instance firstInstance = InstanceProvider.GetFirstInstance(organizationId); if (firstInstance != null) { Settings.InstanceId = firstInstance.InstanceId; } } Settings.Visible = true; Settings.DataBind(); }
public override bool Invoke(ulong steamId, long playerId, string messageText) { var match = Regex.Match(messageText, @"/roidreplace\s+(?<Asteroid>[^\s]+)\s+(?<Material1>[^\s]+)\s+(?<Material2>[^\s]+)", RegexOptions.IgnoreCase); if (match.Success) { var searchAsteroidName = match.Groups["Asteroid"].Value; IMyVoxelBase originalAsteroid = null; if (!Support.FindAsteroid(steamId, searchAsteroidName, out originalAsteroid)) { MyAPIGateway.Utilities.SendMessage(steamId, "Cannot find asteroid", string.Format("'{0}'", searchAsteroidName)); return(true); } var searchMaterialName1 = match.Groups["Material1"].Value; var searchMaterialName2 = match.Groups["Material2"].Value; return(ReplaceAsteroidMaterial(steamId, originalAsteroid, searchMaterialName1, searchMaterialName2)); } match = Regex.Match(messageText, @"/roidreplace\s+(?<Material1>[^\s]+)\s+(?<Material2>[^\s]+)", RegexOptions.IgnoreCase); if (match.Success) { IMyEntity entity = Support.FindLookAtEntity(MyAPIGateway.Session.ControlledObject, false, false, false, true, true, false); if (entity != null && entity is IMyVoxelMap) { var voxelMap = (IMyVoxelMap)entity; var searchMaterialName1 = match.Groups["Material1"].Value; var searchMaterialName2 = match.Groups["Material2"].Value; return(ReplaceAsteroidMaterial(steamId, voxelMap, searchMaterialName1, searchMaterialName2)); } MyAPIGateway.Utilities.SendMessage(steamId, "Asteroid", "Was not targeted."); } return(false); }
private bool unitPricesNotSet() { decimal[] unitPrices = new decimal[2]; MySqlConnection con = Support.setConnection(); MySqlCommand command = new MySqlCommand("select * from dtunitprices ", con); con.Open(); MySqlDataReader reader = command.ExecuteReader(); int i = 0; while (reader.Read() && i < 2) { try { decimal iUnitPrice = reader.GetDecimal("unitprice"); unitPrices[i] = iUnitPrice; Console.WriteLine("Unit Price " + i + "= " + iUnitPrice); i++; } catch (System.Data.SqlTypes.SqlNullValueException) { unitPrices[i] = 0; i++; continue; } } con.Close(); if (unitPrices[0] == 0 || unitPrices[1] == 0) { return(true); } else { return(false); } }
public override bool Invoke(ulong steamId, long playerId, string messageText) { var match = Regex.Match(messageText, @"/roidfill\s+(?<Asteroid>[^\s]+)\s+(?<Material>[^\s]+)", RegexOptions.IgnoreCase); if (match.Success) { var searchAsteroidName = match.Groups["Asteroid"].Value; IMyVoxelBase originalAsteroid = null; if (!Support.FindAsteroid(steamId, searchAsteroidName, out originalAsteroid)) { MyAPIGateway.Utilities.SendMessage(steamId, "Cannot find asteroid", string.Format("'{0}'", searchAsteroidName)); return(true); } var searchMaterialName = match.Groups["Material"].Value; MyVoxelMaterialDefinition material; string suggestedMaterials = ""; if (!Support.FindMaterial(searchMaterialName, out material, ref suggestedMaterials)) { MyAPIGateway.Utilities.SendMessage(steamId, "Invalid Material specified.", "Cannot find the material '{0}'.\r\nTry the following: {1}", searchMaterialName, suggestedMaterials); return(true); } var boxShape = MyAPIGateway.Session.VoxelMaps.GetBoxVoxelHand(); // boundaries are in local space, you need to set translation into Transform property boxShape.Boundaries = (BoundingBoxD)originalAsteroid.PositionComp.LocalAABB; boxShape.Transform = MatrixD.CreateTranslation(originalAsteroid.PositionComp.GetPosition()); MyAPIGateway.Session.VoxelMaps.PaintInShape(originalAsteroid, boxShape, material.Index); MyAPIGateway.Utilities.SendMessage(steamId, "Asteroid", "'{0}' filled with material '{1}'.", originalAsteroid.StorageName, material.Id.SubtypeName); return(true); } return(false); }
public static string FormInBangDieuTraTuan(Dictionary <string, string> duLieu, DataTable BuaAn) { string tieude = "BẢNG TỔNG HỢP KHẨU PHẦN DINH DƯỠNG TRONG TUẦN" + "</br>"; tieude += "Tuan le tu: " + duLieu["TuNgay"] + " den ngay: " + duLieu["DenNgay"]; DuLieuHang duLieuHang = new DuLieuHang(tieude, "Ngay in: " + duLieu["NgayIn"], duLieu["TenNhomTre"]); string title = General(duLieuHang); for (int i = 0; i < BuaAn.Rows.Count; i++) { int so = Convert.ToInt16(BuaAn.Rows[i]["Thu"].ToString().Trim()); string thu = Support.Thu(so); title += "<h3>" + thu + ": " + BuaAn.Rows[i]["ngaythangnam"].ToString() + "</h3>"; Dictionary <string, string> CacBua = new Dictionary <string, string> { { "Bua sang: ", BuaAn.Rows[i]["buasang"].ToString() }, { "Bua trua: ", BuaAn.Rows[i]["buatrua"].ToString() }, { "Bua xe: ", BuaAn.Rows[i]["buaxe"].ToString() }, { "Bua phu: ", BuaAn.Rows[i]["buaphu"].ToString() } }; foreach (KeyValuePair <string, string> pair in CacBua) { title += "<p>"; title += "<b>" + pair.Key + "</b>"; title += pair.Value; title += "</p>"; } } return(title); }
public OBJECT(int _type, int _id, int _index, VECTOR2D _position, RECTANGLE _bound) { this.mType = _type; this.mID = _id; this.mIndex = _index; this.mPosition = _position; this.mBound = _bound; if ((ObjectType)_type == ObjectType.TILE_MAP) { this.mImage = new Image(); // Set atribute for image object if (Support.map != null) { BitmapSource bmpSource; JpegBitmapEncoder bmpCreate = new JpegBitmapEncoder(); byte[] arrPixel = new byte[((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8) * Support.HEIGHT_OF_TILE]; Support.map.TileMap[this.mID].ExportBitMap(0, 0, arrPixel, (Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel / 8)); bmpSource = BitmapSource.Create(Support.WIDTH_OF_TILE, Support.HEIGHT_OF_TILE, 96, 96, Support.map.BitMap.Format, null, arrPixel, ((Support.WIDTH_OF_TILE * Support.map.BitMap.Format.BitsPerPixel) / 8)); this.mImage.Source = bmpSource; this.mImage.Width = bmpSource.Width; this.mImage.Height = bmpSource.Height; this.mImage.Tag = this.mType; } } if (Support.IsDynamic((ObjectID)this.mID) && (ObjectType)(this.mType) == (ObjectType.NORMAL_OBJECT)) { this.mRangeOfMovement = new RECTANGLE(this.mBound.cX, this.mBound.cY, this.mBound.width + 600, this.mBound.height + 600); } else { this.mRangeOfMovement = new RECTANGLE(this.mBound.cX - this.mBound.width / 2, this.mBound.cY + this.mBound.height / 2, this.mBound.width, this.mBound.height); } }
// Create the Ocean Percentage Layer private SingleValueLayer CalculateOceanPercentage() { // Initialize a new layer SingleValueLayer oceanPer = new SingleValueLayer("Ocean Percentage", "Semi-static", 4); // Find the vertexes, sum th abs of all negative values and divide by sum of abs of all values. float[,] vertexArray = elevationVertices.worldArray; float[] corners; float sumOfNegatives; float sumOfAll; for (int x = 0; x < WorldX; x++) { for (int z = 0; z < WorldZ; z++) { corners = Support.CellsAroundVertex(x + 1, z + 1, WorldX, WorldZ, vertexArray); sumOfNegatives = FindAbsOfNegatives(corners); sumOfAll = FindAbsSum(corners); oceanPer.worldArray[x, z] = sumOfNegatives / sumOfAll; } } return(oceanPer); }
protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e) { base.OnPreviewMouseDoubleClick(e); if (e.ChangedButton == MouseButton.Right) { return; } var target_item = Support.FindVisualParent <TreeViewItem>(e.OriginalSource as DependencyObject); if (target_item == null) { return; } var context = target_item.DataContext as EvBase; if (context == null) { return; } Manager.OnDoubleClick?.Invoke(context, target_item, this, e); }
/// <summary> /// Copy all referenced DLL files from the project directory into the RockWeb/bin directory. /// We do this by scanning each csproj file in the directory and looking for HintPath nodes. /// </summary> /// <param name="projectDirectory">The project directory to scan.</param> private void CopyProjectReferences(string projectDirectory) { string destPath = Path.Combine(Path.Combine(Support.GetBuildPath(), "RockWeb"), "Bin"); foreach (var proj in Directory.EnumerateFiles(Path.Combine(Support.GetBuildPath(), projectDirectory), "*.csproj")) { // // Load the csproj file. // var doc = new XmlDocument(); doc.Load(proj); var mgr = new XmlNamespaceManager(doc.NameTable); mgr.AddNamespace("df", doc.DocumentElement.NamespaceURI); // // Find and process all HintPath nodes. // foreach (XmlNode node in doc.DocumentElement.SelectNodes("//df:HintPath", mgr)) { string libPath = Path.GetDirectoryName(Path.Combine(Path.GetDirectoryName(proj), node.InnerText)); foreach (var dllFile in Directory.EnumerateFiles(libPath, "*.dll")) { string destFile = Path.Combine(destPath, Path.GetFileName(dllFile)); // // If we found a DLL in the project directory that does not exist in the RockWeb directory // then copy it over. // if (File.Exists(dllFile) && !File.Exists(destFile)) { File.Copy(dllFile, destFile); } } } } }
protected void gvDiscountCodeUsage_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = (GridDataItem)e.Item; int discountCodeUsageId = (int)dataItem.OwnerTableView.DataKeyValues[dataItem.ItemIndex]["DiscountCodeUsageId"]; DiscountCodeUsage discountUsage = (from dcu in DataContext.DiscountCodeUsages where dcu.DiscountCodeUsageId == discountCodeUsageId select dcu).FirstOrDefault(); dataItem["StartDate"].Text = Support.FormatDate(discountUsage.CreatedDate); dataItem["EndDate"].Text = Support.FormatDate(discountUsage.EndDate); HyperLink lnkCompanyName = (HyperLink)dataItem.FindControl("lnkCompanyName"); if (lnkCompanyName != null) { lnkCompanyName.Text = Support.TruncateString(discountUsage.Company.CompanyName, 40); lnkCompanyName.ToolTip = discountUsage.Company.CompanyName; lnkCompanyName.NavigateUrl = ResolveUrl("~/Company/CompanyDetails.aspx") + "?CompanyID=" + discountUsage.Company.CompanyId.ToString(CultureInfo.InvariantCulture); } } }
/// <summary> /// Compress the RockWeb folder into a ZIP file as a template. Then do final cleanup. /// </summary> private void BuildTemplate() { // // Compress the RockWeb folder into a template ZIP file. // UpdateStatusText("Compressing RockWeb..."); var zipFile = Path.Combine(Support.GetTemplatesPath(), TemplateName + ".zip"); var rockWeb = Path.Combine(Support.GetBuildPath(), "RockWeb"); Support.CreateZipFromFolder(zipFile, rockWeb); // // Cleanup temporary files. // UpdateStatusText("Cleaning up..."); Directory.Delete(Support.GetBuildPath(), true); string tempfilename = Path.Combine(Support.GetDataPath(), "temp.zip"); File.Delete(tempfilename); UpdateStatusText("Template has been created."); BuildCompleted?.Invoke(this, new EventArgs()); }
static void Main() { #if LEADTOOLS_V175_OR_LATER if (!Support.SetLicense()) { return; } #else Support.Unlock(false); #endif // #if LEADTOOLS_V175_OR_LATER if (RasterSupport.IsLocked(RasterSupportType.Medical)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.Medical.ToString()), "Warning"); return; } DicomEngine.Startup(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); DicomEngine.Shutdown(); }
public void Remove(List <int> indx) { int choise; if (indx[0] == -1) { return; } while (true) { Console.WriteLine(); Console.Write("Pozycja do usuniecia: "); try { choise = int.Parse(Console.ReadLine()); if (choise < 1 || choise > indx.Count) { Support.WriteCol("Nieprawidlowa wartosc!", "DY"); } else { break; } } catch { Support.WriteCol("Nieprawidlowa wartosc!", "R"); } } list.RemoveAt(indx[choise - 1]); Console.WriteLine("Pomyslnie usunieto pozycje."); }
internal static void RegisterStyleSheetResource(Control ctl, string resourceName, string id, bool registerStyleSheetLoader) { Page page = ctl.Page; bool useStyleSheetLoader = false; string resourceUrl = GetResourceUrl(resourceName, true); ScriptManager sm = ScriptManager.GetCurrent(ctl.Page); if (sm != null) { useStyleSheetLoader = sm.IsInAsyncPostBack; } if (!useStyleSheetLoader) { HtmlHead head = page.Header; if (head == null) { useStyleSheetLoader = true; } else if (head.FindControl(id) == null) { head.Controls.Add(Support.CreateStyleSheetLink(resourceUrl, id)); } } if (useStyleSheetLoader) { Type pageType = page.GetType(); if (registerStyleSheetLoader) { RegisterScriptResource(page, "Micajah.Common.StyleSheetLoader", StyleSheetLoader); } ScriptManager.RegisterStartupScript(page, pageType, resourceName, string.Format(CultureInfo.InvariantCulture, "Micajah.Common.StyleSheetLoader.getInstance().addStyleSheet(\"{0}\");\r\n", resourceUrl), true); } }
private void OnStockUpdated(object sender, Support.StockEventArgs e) { Close(); }
public virtual StillOneScriptCore.EntityModel.CustomFunctionModel.Operators.Executed.Operator CreateExecuted(Support.ExecutedFunctionContext context) { throw new System.NotImplementedException(); }
void CurrentCarViewModel_CarUpdated(object sender, Support.CarEventArgs e) { if (!e.IsNew) { Car car = _Cars.Where(item => item.CarId == e.Car.CarId).FirstOrDefault(); if (car != null) { car.Description = e.Car.Description; car.Color = e.Car.Color; car.Year = e.Car.Year; car.RentalPrice = e.Car.RentalPrice; } } else { _Cars.Add(e.Car); } CurrentCarViewModel = null; }
void CurrentOrderDetailViewModel_OrderDetailUpdated(object sender, Support.OrderDetailEventArgs e) { if (!e.IsNew) { OrderDetail orderDetail = _order.Items.Single(item => item.Id == e.OrderDetail.Id); if (orderDetail != null) { orderDetail.Count = e.OrderDetail.Count; orderDetail.OrderId = e.OrderDetail.OrderId; orderDetail.Price = e.OrderDetail.Price; orderDetail.PartId = e.OrderDetail.PartId; orderDetail.PartDescription = e.OrderDetail.PartDescription; orderDetail.Notes = e.OrderDetail.Notes; } } else { // TODO: check that we have saved new order recently if (_order.Id != 0) { _order.Items = _order.Items.Concat(new[] { new OrderDetail { Id = e.OrderDetail.Id, Count = e.OrderDetail.Count, OrderId = e.OrderDetail.OrderId, Price = e.OrderDetail.Price, PartId = e.OrderDetail.PartId, PartDescription = e.OrderDetail.PartDescription, Notes = e.OrderDetail.Notes } }); } } CurrentOrderDetailViewModel = null; }
private void EditComponentViewModel_ComponentUpdated(object sender, Support.ComponentEventArgs e) { if (!e.IsNew) { Subassembly component = Part.Components.FirstOrDefault(item => item.Id == e.Component.Id); if (component != null) { component.AssemblyId = e.Component.AssemblyId; component.SubassemblyId = e.Component.SubassemblyId; component.PartDescription = e.Component.PartDescription; component.CostContribution = e.Component.CostContribution; component.Notes = e.Component.Notes; } } else _part.Components = _part.Components.Concat(new[] { e.Component }); _part.IsDirty = true; CurrentAddComponentViewModel = null; }
public static Support CreateSupport(int id) { Support support = new Support(); support.ID = id; return support; }
internal override void Flush(Support.Dictionary<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>> threadsAndFields, SegmentWriteState state) { lock (this) { Support.Dictionary<TermsHashConsumerPerThread, IList<TermsHashConsumerPerField>> childThreadsAndFields = new Support.Dictionary<TermsHashConsumerPerThread, IList<TermsHashConsumerPerField>>(); Support.Dictionary<InvertedDocConsumerPerThread,IList<InvertedDocConsumerPerField>> nextThreadsAndFields; if (nextTermsHash != null) { nextThreadsAndFields = new Support.Dictionary<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>>(); } else nextThreadsAndFields = null; foreach (KeyValuePair<InvertedDocConsumerPerThread, IList<InvertedDocConsumerPerField>> entry in threadsAndFields) { TermsHashPerThread perThread = (TermsHashPerThread) entry.Key; IList<InvertedDocConsumerPerField> fields = entry.Value; IEnumerator<InvertedDocConsumerPerField> fieldsIt = fields.GetEnumerator(); List<TermsHashConsumerPerField> childFields = new List<TermsHashConsumerPerField>(); List<InvertedDocConsumerPerField> nextChildFields; if (nextTermsHash != null) { nextChildFields = new List<InvertedDocConsumerPerField>(); } else nextChildFields = null; while (fieldsIt.MoveNext()) { TermsHashPerField perField = (TermsHashPerField) fieldsIt.Current; childFields.Add(perField.consumer); if (nextTermsHash != null) nextChildFields.Add(perField.nextPerField); } childThreadsAndFields[perThread.consumer] = childFields; if (nextTermsHash != null) nextThreadsAndFields[perThread.nextPerThread] = nextChildFields; } consumer.Flush(childThreadsAndFields, state); ShrinkFreePostings(threadsAndFields, state); if (nextTermsHash != null) nextTermsHash.Flush(nextThreadsAndFields, state); } }
public void AddToSupports(Support support) { base.AddObject("Supports", support); }
/// <summary> /// This new evaluate function includes support to assignment and short circuit of the IIF[] operand function /// </summary> /// <param name="RPNQueue"></param> /// <param name="sValue"></param> /// <param name="ErrorMsg"></param> /// <returns></returns> public bool Evaluate(Support.ExQueue<Parser.TokenItem> RPNQueue, out string sValue, out string ErrorMsg) { // initialize the outgoing variable ErrorMsg = ""; sValue = ""; // reset the results in the token token.LastEvaluationResult = ""; // create a stop watch to time the evaluation System.Diagnostics.Stopwatch evalTime = System.Diagnostics.Stopwatch.StartNew(); // make sure the otkens are valid if (token.AnyErrors == true) { // the token already has an error, return the token error as the evaluator error message ErrorMsg = token.LastErrorMessage; return false; } // create the evaluation stack Support.ExStack<Parser.TokenItem> eval = new Support.ExStack<Parser.TokenItem>(token.TokenItems.Count); // start looping through the tokens int count = RPNQueue.Count; int index = 0; // the index of the curent token item in the rpn queue while (index < count) { // get the next token item Parser.TokenItem item = RPNQueue[index]; index++; System.Diagnostics.Debug.WriteLine(item.TokenName); if (item.TokenDataType == Parser.TokenDataType.Token_DataType_Variable) { #region Token_DataType_Variable // determine if we need to assign the variable represented by the token // or the rule syntax is doing the assignment if (item.WillBeAssigned == false) { // The rule syntax is not doing the assignment, we are doing it. // lookup the value of the variable and push it onto the evaluation stack if (token.Variables.VariableExists(item.TokenName) == true) { // the variable exists, push it on the stack eval.Push(new Parser.TokenItem(token.Variables[item.TokenName].VariableValue, Parser.TokenType.Token_Operand, item.InOperandFunction)); } else { // the variable does not exist...push an empty string on the stack eval.Push(new Parser.TokenItem("", Parser.TokenType.Token_Operand, item.InOperandFunction)); } } else { // the rule syntax is doing the assignment, add the token item to the evaluation stack eval.Push(item); } #endregion } else if (item.TokenType == Parser.TokenType.Token_Operator) { #region Token_Operator // pop 2 items off the stack and perform the operation // push the result back onto the evaluation stack Parser.TokenItem rightOperand = null; Parser.TokenItem leftOperand = null; try { if (eval.Count > 0) rightOperand = eval.Pop(); if (eval.Count > 0) leftOperand = eval.Pop(); } catch (Exception err) { ErrorMsg = "Error in Evaluator.Evaluate() while popping 2 tokens for an operator: " + err.Message; return false; } // double check that we got the tokens before we evaluate if (rightOperand == null) { ErrorMsg = "Failed to evaluate the rule expression: The right operand token is null: There may be an issue with the rule syntax."; return false; } if (leftOperand == null) { ErrorMsg = "Failed to evaluate the rule expression: The left operand token is null: There may be an issue with the rule syntax."; return false; } // process the operator try { Parser.TokenItem result = null; if (EvaluateTokens(leftOperand, rightOperand, item, out result, out ErrorMsg) == false) return false; else { // double check that we got a result if (result == null) { ErrorMsg = "Failed to evaluate the rule expression: The result of an operator is null: There may be an issue with the rule syntax."; return false; } else { eval.Push(result); } } } catch (Exception err) { ErrorMsg = "Failed to evaluate the rule expression: The result of an operator threw an error: " + err.Message; return false; } #endregion } else if (item.TokenType == Parser.TokenType.Token_Operand_Function_Stop) { #region Token_Operand_Function_Stop // find the start of the function by popping off items // evaluate the function and push the result back onto the evaluation stack // start popping items from the evaluation stack // until we get the start of the of the operand function int evalCount = eval.Count; Parser.TokenItems parameters = new Parser.TokenItems(token); try { for (int j = 0; j < evalCount; j++) { Parser.TokenItem opItem = eval.Pop(); if (opItem.TokenType == Parser.TokenType.Token_Operand_Function_Start) { // we found the start of the operand function; let's evaluate it Parser.TokenItem result = null; if (EvaluateOperandFunction(opItem, parameters, out result, out ErrorMsg) == false) return false; else { // make sure we got a result if (result == null) { ErrorMsg = "Failed to evaluate the rule expression: The result of an operand function is null: There may be an issue with the rule syntax."; return false; } else eval.Push(result); } break; } else if (opItem.TokenType != Parser.TokenType.Token_Operand_Function_Delimiter) { // we have a parameter to the operand function parameters.AddToFront(opItem); } } } catch (Exception err) { ErrorMsg = "Failed to evaluate the rule expression: The evaluation of an operand function threw an error: " + err.Message; return false; } #endregion } else if (item.TokenType == Parser.TokenType.Token_Assignemt_Start) { #region Token_Assignment_Start // assign the value to the variable // pop 2 items off the stack - save the value into the variable Parser.TokenItem rightOperand = null; Parser.TokenItem leftOperand = null; try { if (eval.Count > 0) rightOperand = eval.Pop(); if (eval.Count > 0) leftOperand = eval.Pop(); } catch (Exception err) { ErrorMsg = "Error in Evaluator.Evaluate() while popping 2 tokens for an operator: " + err.Message; return false; } // double check that we got the tokens before we evaluate if (rightOperand == null) { ErrorMsg = "Failed to evaluate the rule expression: The right operand token is null: There may be an issue with the rule syntax."; return false; } if (leftOperand == null) { ErrorMsg = "Failed to evaluate the rule expression: The left operand token is null: There may be an issue with the rule syntax."; return false; } // look for the variable and assign the value to it if (token.Variables.VariableExists(leftOperand.TokenName) == true) { // the variable exists, push it on the stack token.Variables[leftOperand.TokenName].VariableValue = rightOperand.TokenName; } else { // failed to find the variable....this is an error ErrorMsg = "Failed to evaluate the rule expression: Failed to find the variable '" + leftOperand.TokenName + "' for the assignment."; return false; } #endregion } else if (item.TokenType == Parser.TokenType.Token_Operand_Function_Start) { #region New Short Circuit Code // we are only short circuiting the IIF[] operand function if (item.TokenName.Trim().ToLower() != "iif[") { // add the token to the evaluation stack eval.Push(item); } else { // we found the iif statement. // see if the iff[] operand function allows for short circuiting if (item.CanShortCircuit == false) { // no short circuiting, add it to the evaluation stack eval.Push(item); } else { //////////////////////////////////////////////// // We can short circuit this iif[] statement // //////////////////////////////////////////////// Parser.TokenItem result = item.ShortCircuit.Evaluate(out ErrorMsg); if (result == null) { // there was an error doing the short circuit return false; } else { // we successfully did the short circuit eval.Push(result); // increment the index so we skip the ] which should be the next token index++; } } } #endregion } else { // push the item on the evaluation stack eval.Push(item); } } if (eval.Count == 1) { // just 1 item on the stack; should be our answer try { Parser.TokenItem final = eval.Pop(); sValue = final.TokenName; // set the results in the token token.LastEvaluationResult = sValue; } catch (Exception err) { ErrorMsg = "Failed to evaluate the rule expression after all the tokens have been considered: " + err.Message; return false; } } else if (eval.Count == 0) { // there is no result in the evaluation stack because it my have been assigned // do nothing here } else { ErrorMsg = "Invalid Rule Syntax"; return false; } // stop the timer evalTime.Stop(); tokenEvalTime = evalTime.Elapsed.TotalMilliseconds; token.LastEvaluationTime = tokenEvalTime; // set this evaluation time in the token object. return true; }
protected DataStructure(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid, Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit) : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit) { }
private void OnOrderUpdated(object sender, Support.OrderEventArgs e) { Close(); }