public void RecreateEventAndGetEventId( DataCollection.Event evt, bool recreateEvent = true, bool deleteTestReg = false) { if (KeywordProvider.ManagerDefault.DoesEventExist(evt.Title)) { if (recreateEvent) { KeywordProvider.ManagerDefault.DeleteEvent(evt.Title); KeywordProvider.EventCreator.CreateEvent(evt); } else { if (deleteTestReg) { evt.Id = KeywordProvider.ManagerDefault.GetLatestEventId(evt.Title); KeywordProvider.ManagerDefault.OpenFormDashboard(evt.Id); PageObject.PageObjectProvider.Manager.Dashboard.EventDetails.DeleteTestReg_Click(); PageObject.PageObjectProvider.Manager.Dashboard.EventDetails.DeleteTestRegFrame.SelectByName(); PageObject.PageObjectProvider.Manager.Dashboard.EventDetails.DeleteTestRegFrame.Delete_Click(); PageObject.PageObjectProvider.Manager.Dashboard.ReturnToList_Click(); } } } else { KeywordProvider.EventCreator.CreateEvent(evt); } evt.Id = KeywordProvider.ManagerDefault.GetLatestEventId(evt.Title); }
private void LoadAccessRights(DataCollection<AccessRights> _selectableAccessRights) { foreach (DataRow AccessEntryRow in DataModell.DataSetForStaticTables.Tables["AccessRights"].Rows) { _selectableAccessRights.Add(new AccessRights(AccessEntryRow)); } }
public DataCollection<CommonSearchClass> GetLastModifiedWerbung (DateTime? LastModifiedFrom = null, DateTime? LastModifiedTo = null, int MaxNumber = 10) { DataCollection<CommonSearchClass> Result = new DataCollection<CommonSearchClass>(); return Result; }
private void LoadAllTimingTypen(DataCollection<TimingTypen> _allTimingTypen) { foreach (DataRow TimingTypenRow in DataModell.DataSetForStaticTables.Tables["TimingTypen"].Rows) { _allTimingTypen.Add(new TimingTypen(TimingTypenRow)); } }
public void AddMerchandises(DataCollection.MerchandiseItem merch, Event evt) { if (PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.EmptyAddMerchandise.IsPresent) { PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.EmptyAddMerchandise_Click(); } else { PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.AddMerchandise_Click(); } PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.SelectByName(); PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.MerchandiseType_Select(((int)merch.Type).ToString()); switch (merch.Type) { case FormData.MerchandiseType.Fixed: PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.FeeAmount.Type(merch.Price.Value); break; case FormData.MerchandiseType.Variable: PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.VariableFeeMinAmount.Type(merch.MinPrice.Value); PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.VariableFeeMaxAmount.Type(merch.MaxPrice.Value); break; case FormData.MerchandiseType.Header: break; default: break; } PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.NameOnForm.Type(merch.Name); PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.NameOnReceipt.Type(merch.Name); PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.NameOnReports.Type(merch.Name); PageObject.PageObjectProvider.Builder.EventDetails.FormPages.Advanced_Click(); if ((evt.TaxRateOne != null) || (evt.TaxRateTwo != null)) { KeywordProvider.AddTaxRate.AddTaxRates(evt.TaxRateOne, evt.TaxRateTwo, FormData.Location.Merchandise); } if ((evt.TaxRateOne != null) && (merch.ApplyTaxOne.HasValue)) { PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.ApplyTaxOne.Set(merch.ApplyTaxOne.Value); } if ((evt.TaxRateTwo != null) && (merch.ApplyTaxTwo.HasValue)) { PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.ApplyTaxTwo.Set(merch.ApplyTaxTwo.Value); } if (merch.DiscountCodes.Count != 0) { string discountCodeString = CustomFieldCode.GenerateBulkCodes(merch.DiscountCodes); PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.DiscountCodes.Type(discountCodeString); } PageObject.PageObjectProvider.Builder.EventDetails.FormPages.MerchandisePage.MerchandiseDefine.SaveAndClose_Click(); }
public AuswertungsFunktion(String NameIDParameter, String HeaderStringParameter, DataCollection<Object> ChildrenParameter) { NameID = NameIDParameter; HeaderText = HeaderStringParameter; Children = ChildrenParameter; ID = new Guid(); }
private void LoadTypTree(DataCollection<TreeEntryClass> _typTree) { foreach (DataRow RootDataTemplateRow in DataModell.DataSetForStaticTables.Tables["RootDataTemplates"].Rows) { RootDataTemplates RootTyp = new RootDataTemplates(RootDataTemplateRow); _typTree.Add(new TreeEntryClass() { Parent = null, HeadLine = RootTyp.NameID, ConnectedObject = RootTyp }); foreach (DataRow TypRow in DataModell.DataSetForStaticTables.Tables["Typ"].Rows) { if (((Guid)TypRow["RootFormat"]) != RootTyp.ID) continue; Typ SelectableTyp = new Typ(TypRow); _typTree.Last().Childs.Add(new TreeEntryClass() { Parent = _typTree.Last(), HeadLine = SelectableTyp.NameID, ConnectedObject = SelectableTyp }); } } }
//Instance of object which contains configuration for sending data. //ULoader_JSON config; //Instacje of object which sends data. //USender uSender; public MainWindow() { InitializeComponent(); attentionValuesCollection = new DataCollection(); var attentionDataSource = new EnumerableDataSource<Data>(attentionValuesCollection); attentionDataSource.SetXMapping(x => dateAttention.ConvertToDouble(x.Date)); attentionDataSource.SetYMapping(y => y.Value); plotterAttention.AddLineGraph(attentionDataSource, Colors.Red, 2, "Attetion"); connector = new Connector(); connector.DeviceConnected += new EventHandler(OnDeviceConnected); connector.DeviceConnectFail += new EventHandler(OnDeviceFail); connector.DeviceValidating += new EventHandler(OnDeviceValidating); connector.ConnectScan("COM3"); //Stworzenie obiektu typu Random do wyboru losowego słowa ze słownika. randomWordNumber = new Random(); wordNumber = 0; attentionComingCounter = 0; attentionValueSum = 0; puzzlesSolved = 0; wordStatList = new List<WordStat>(); currentWord = ""; //config = new ULoader_JSON(@"..\..\config.json"); //uSender = config.GetSender("output1"); }
public static DataCollection LoadDataCollectionFile(string FName) { DataCollection res = new DataCollection(); StreamReader F = new StreamReader(FName); res = LoadDataCollectionFromJSON(F.ReadToEnd()); F.Close(); return res; }
/// <summary> /// /// </summary> /// <param name="datas"></param> /// <returns></returns> private DataTable ConvertToDataTable(DataCollection datas) { DataTable tbl = new DataTable(); if (datas.Count > 0) { IData last = datas[datas.Count - 1]; Type lastType = last.GetType(); //ReportItemCollection reportItems = last.GetReportItems(); //foreach (ReportItem ri in reportItems) //{ // Type valueType = ri.Value.GetType(); // DataColumn column = new DataColumn(ri.Name, valueType); // tbl.Columns.Add(column); //} //foreach (IData data in datas) //{ // if (data.GetType() != lastType) // { // continue; // } // object[] values = GetReportItemCollectionValues(data.GetReportItems()); // tbl.Rows.Add(values); //} AttributePropertyInfoPairCollection ss = last.GetDeviceDataItemAttributes(); foreach (AttributePropertyInfoPair s in ss) { Type valueType = s.PropertyInfo.PropertyType; DataItemAttribute diAttribute = s.Attribute; string columnName = diAttribute.Name; DataColumn column = new DataColumn(columnName, valueType); column.ExtendedProperties["unit"] = diAttribute.Unit.Text; column.ExtendedProperties["format"] = diAttribute.Format; column.ExtendedProperties["name"] = diAttribute.Name; tbl.Columns.Add(column); } foreach (IData data in datas) { if (data.GetType() != lastType) { continue; } object[] values = new object[ss.Count]; int idx = 0; foreach (AttributePropertyInfoPair s in ss) { object v= s.PropertyInfo.GetValue(data, null); values[idx++] = v; } tbl.Rows.Add(values); } } return tbl; }
public void SignInAndRecreateEventAndGetEventId( EventFolders.Folders folder, DataCollection.Event evt, bool recreateEvent = true, bool deleteTestReg = false) { this.SignIn(folder); this.RecreateEventAndGetEventId(evt, recreateEvent, deleteTestReg); }
public static void On_GnomanEmpire_LoadGame(GnomanEmpire self, string file, bool fallen) { var dc = new DataCollection(); dc.ToString(); //var seri = new System.Web.Script.Serialization.JavaScriptSerializer(); //var text = seri.Serialize(dc); var text = Newtonsoft.Json.JsonConvert.SerializeObject(dc, Newtonsoft.Json.Formatting.Indented); System.IO.File.WriteAllText(@"C:\Users\Faark\Documents\Visual Studio 2010\Projects\GnomoriaModding\Release\Data.js", text); }
public static DataCollection<Kandidat> LoadKandidaten(MBRWahlDataModell Parent) { DataCollection<Kandidat> KandidatenEntries = new DataCollection<Kandidat>(); foreach (DataRow Entry in MBRWahlDataWrapper.Instance.StaticDataSetForInternet.Tables ["Kandidaten"].Rows) { KandidatenEntries.Add (new Kandidat (Entry) {Parent = Parent}); } return KandidatenEntries; }
public void CFType_Select(DataCollection.FormData.CustomFieldType type) { Clickable Type = new Clickable( string.Format("//div[@id='divMoreFormats']//span[text()='{0}']", CustomStringAttribute.GetCustomString(type)), LocateBy.XPath); Type.WaitForDisplay(); Type.Click(); }
public void SelectParentEvent(DataCollection.Event evt) { Utility.ThreadSleep(1); this.ParentEventList.WaitForDisplay(); this.ParentEventList.SelectWithText(string.Format( "{0} ({1})", evt.StartPage.AdvancedSettings.ParentEvent.Title, evt.StartPage.AdvancedSettings.ParentEvent.Id)); }
private DataCollection<UseForRootDataTemplates> LoadAvailableUseForRootDataTemplatesForSelectedDataDependencyEntry (DataDependency Selected) { DataCollection<UseForRootDataTemplates> Result = new DataCollection<UseForRootDataTemplates> (); foreach (Guid EntryGuid in AssignedUseForRootDataTemplates.Keys) foreach (UseForRootDataTemplates Entry in AssignedUseForRootDataTemplates [EntryGuid]) if (Entry.DataDependencyID == Selected.Id) Result.Add(Entry); return Result; }
private void LoadSelectableTyp(DataCollection<Typ> _selectableTyp) { foreach (DataRow TypRow in DataModell.DataSetForStaticTables.Tables["Typ"].Rows) { _selectableTyp.Add(new Typ(TypRow) { }); } }
private void LoadSelectableZielGruppe(DataCollection<ZielGruppen> _selectableZielGruppe) { foreach (DataRow ZielGruppenRow in DataModell.DataSetForStaticTables.Tables["ZielGruppen"].Rows) { _selectableZielGruppe.Add(new ZielGruppen(ZielGruppenRow) { }); } }
public void AddCustomField(DataCollection.CustomField field) { customFieldDefine.SelectByName(); customFieldDefine.NameOnForm.Type(field.NameOnForm); customFieldDefine.FieldType_Click(); customFieldDefine.CFType_Select(field.Type); customFieldDefine.SaveAndClose_Click(); }
//private Dictionary<Guid,DataCollection<FullUseForTyp>> _availableFullTypForTypOrRoot; //public Dictionary<Guid, DataCollection<FullUseForTyp>> AvailableFullTypForTypOrRoot // { // get // { // if (_availableFullTypForTypOrRoot == null) // _availableFullTypForTypOrRoot = new Dictionary<Guid, DataCollection<FullUseForTyp>>(); // if (Profile.ActiveTyp != null) // { // if (!_availableFullTypForTypOrRoot.ContainsKey(Profile.ActiveTyp.ID)) // _availableFullTypForTypOrRoot[Profile.ActiveTyp.ID] = LoadAvailableFullTypForTyp(Profile.ActiveTyp); // } // else // { // if (Profile.ActiveRootDataTemplates != null) // { // if (!_availableFullTypForTypOrRoot.ContainsKey(Profile.ActiveRootDataTemplates.ID)) // _availableFullTypForTypOrRoot[Profile.ActiveRootDataTemplates.ID] = LoadAvailableFullTypForRoot(Profile.ActiveRootDataTemplates); // } // } // return _availableFullTypForTypOrRoot; // } // set { SetProperty (ref _availableFullTypForTypOrRoot, value); } // } private DataCollection<FullUseForTyp> LoadAvailableFullTypForRoot(RootDataTemplates RootToSearchFor) { DataCollection<FullUseForTyp> Result = new DataCollection<FullUseForTyp>(); foreach (FullUseForTyp Entry in AvailableFullTyp.Values) { if (Entry.ConnectedID == RootToSearchFor.ID) Result.Add(Entry); } return Result; }
public DataCollection<PropertyInfo> PropertiesForClass (String ClassName) { DataCollection<PropertyInfo> Result = new DataCollection<PropertyInfo> (); if (!String.IsNullOrEmpty (ClassName)) foreach (PropertyInfo PropInfo in DataWrapper.GetTypeToCreate (ClassName).GetProperties ()) { Result.Add (PropInfo); } return Result; }
public void BuildIt_Click(DataCollection.HtmlButton button) { if (button.WithPreview) { switch (button.Graphic_Type) { case DataCollection.HtmlButton.GraphicType.Button: this.BuildIt_Button_Preview.WaitForDisplay(); this.BuildIt_Button_Preview.Click(); break; case DataCollection.HtmlButton.GraphicType.Secure: this.BuildIt_Secure_Preview.WaitForDisplay(); this.BuildIt_Secure_Preview.Click(); break; case DataCollection.HtmlButton.GraphicType.TextLink: this.BuildIt_TextLink_Preview.WaitForDisplay(); this.BuildIt_TextLink_Preview.Click(); break; case DataCollection.HtmlButton.GraphicType.CountdownWidget: this.BuildIt_CountdownWidget_Preview.WaitForDisplay(); this.BuildIt_CountdownWidget_Preview.Click(); break; default: break; } } else { switch (button.Graphic_Type) { case DataCollection.HtmlButton.GraphicType.Button: this.BuildIt_Button.WaitForDisplay(); this.BuildIt_Button.Click(); break; case DataCollection.HtmlButton.GraphicType.Secure: this.BuildIt_Secure.WaitForDisplay(); this.BuildIt_Secure.Click(); break; case DataCollection.HtmlButton.GraphicType.TextLink: this.BuildIt_TextLink.WaitForDisplay(); this.BuildIt_TextLink.Click(); break; case DataCollection.HtmlButton.GraphicType.CountdownWidget: this.BuildIt_CountdownWidget.WaitForDisplay(); this.BuildIt_CountdownWidget.Click(); break; default: break; } } Utilities.Utility.ThreadSleep(2); WaitForAJAX(); }
public void FillInformationAndInformationenAddOns(Guid? ActiveInformationenID) { ActiveInformationen = DataModell.LoadDBInformationenShortTreeFromEntryDataSet (DataModell.GetEntryDataSet((Guid) ActiveInformationenID, null, null, false)); if (ActiveInformationen == null) return; InformationAndInformationenAddOns = new DataCollection<object>(); InformationAndInformationenAddOns.Add(ActiveInformationen); foreach (InformationenAddOn Entry in ActiveInformationen.ConnectedInformationenAddOn) InformationAndInformationenAddOns.Add(Entry); }
private int LoadAllWSPLakate() { _allWSPlakate = new DataCollection<WSPlakate>(); int Counter = 0; foreach (DataRow WSPlakateRow in WordUpBasics.WordUpWCFAccess.GetCommonDataSet("Select * from WSPlakate order by NameID").Tables["WSPlakate"].Rows) { _allWSPlakate.Add(new WSPlakate(WSPlakateRow) { Parent = _allWSPlakate }); Counter++; } return Counter; }
private Dictionary<Guid, DataCollection<DefaultFillings>> LoadAvailableDefaultFillingsPerDataDependency() { Dictionary<Guid, DataCollection<DefaultFillings>> Result = new Dictionary<Guid, DataCollection<DefaultFillings>> (); foreach (DataRow RowEntry in DataModell.DataSetForProfileManagement.Tables ["DefaultFillings"].Rows) { if (!Result.ContainsKey((Guid)RowEntry["FullDataDependencyID"])) Result[(Guid)RowEntry["FullDataDependencyID"]] = new DataCollection<DefaultFillings>(); Result[(Guid)RowEntry["FullDataDependencyID"]].Add(new DefaultFillings(RowEntry)); } return Result; }
public MerchandiseRow(DataCollection.MerchandiseItem merch) { this.Merchandise = new Clickable(string.Format("//table[@id='ctl00_cph_grdFees_tblGrid']//a[text()='{0}']", merch.Name), LocateBy.XPath); string merchHrefAttriString = this.Merchandise.GetAttribute("href"); string tmp = merchHrefAttriString.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries)[3]; tmp = tmp.Split(new string[] { "&" }, StringSplitOptions.RemoveEmptyEntries)[0]; this.MerchandiseId = Convert.ToInt32(tmp); }
public CollectionStrategy(IList list,ReportSettings reportSettings):base(reportSettings) { if (list.Count > 0) { firstItem = list[0]; itemType = firstItem.GetType(); this.baseList = new DataCollection <object>(itemType); this.baseList.AddRange(list); } this.listProperties = this.baseList.GetItemProperties(null); }
private DataCollection<FullUseForTyp> LoadAvailableFullTypForTyp (Typ TypToSearchFor) { DataCollection<FullUseForTyp> Result = new DataCollection<FullUseForTyp> (); foreach (FullUseForTyp Entry in AvailableFullTyp.Values) { if (Entry.ConnectedID == TypToSearchFor.ID) Result.Add(Entry); else if (Entry.ConnectedID == TypToSearchFor.RootFormat) Result.Add ((Entry)); } return Result; }
public static DataCollection<DatenUmfang> CreateMyElements() { DataCollection<DatenUmfang> Elements = new DataCollection<DatenUmfang>(); foreach (Basics.DataSelection Entry in Enum.GetValues(typeof(Basics.DataSelection))) { Elements.Add(new DatenUmfang() { DataToUse = Entry }); } return Elements; }
public static DataCollection<Graphics> CreateMyElements() { DataCollection<Graphics> Elements = new DataCollection<Graphics>(); foreach (DataWrapper.Graphics Entry in Enum.GetValues(typeof(DataWrapper.Graphics))) { Elements.Add(new WordUp23.Graphics() { GraphicsToCreate = Entry }); } return Elements; }
/// <summary> /// 请求Api的上下文 /// </summary> /// <param name="httpContext"></param> /// <param name="apiAction"></param> /// <param name="arguments"></param> /// <param name="properties"></param> protected ApiRequestContext(HttpContext httpContext, ApiActionDescriptor apiAction, object?[] arguments, DataCollection properties) { this.HttpContext = httpContext; this.ApiAction = apiAction; this.Arguments = arguments; this.Properties = properties; }
public static DataCollectionViewModelStep1 MapFrom(this DataCollectionViewModelStep1 vm, Project project, DataCollection collection = null) { if (vm == null || project == null) { return(vm); } if (collection != null) { vm.InjectFrom(collection); } vm.ProjectTitle = project.Title; return(vm); }
public static DataCollectionViewModelStep2 MapFrom(this DataCollectionViewModelStep2 vm, DataCollection collection) { if (vm == null || collection == null) { return(vm); } vm.InjectFrom(collection); MapForCodes(vm.FieldsOfResearch, collection.FieldsOfResearch); MapSeoCodes(vm.SocioEconomicObjectives, collection.SocioEconomicObjectives); vm.Manager = MapManager(collection.Parties); vm.UrdmsUsers = MapUrdmsUsers(collection.Parties); vm.NonUrdmsUsers = MapNonUrdmsUsers(collection.Parties); return(vm); }
protected override void ParseDataCollection2Result(DataCollection d, ref object obj) { }
public static string GetCols(string col, string width, int i, DataCollection list, string userId) { string blockHtmls = ""; string colBeginHtml = "<DIV class=\"col_div\" id=\"col_{0}\" style=\"WIDTH: {1}\">"; string colEndHtml = @"<DIV class='drag_div no_drag' id='col_{0}_hidden_div'> <DIV id='col_{0}_hidden_div_h'></DIV> </DIV></DIV>" ; string BlockBeginHtml = "<DIV class=\"drag_div\" id=\"drag_{0}\" style=\"BORDER-COLOR: {1}; BACKGROUND: #fff;Height:{2}\">"; //string BlockBeginHtml = "";<DIV id='loadeditorid_{0}' style='WIDTH: 100px'><IMG src='/Modules/WebPart/loading.gif'><SPAN id='loadeditortext_{0}' style='COLOR: #333'></SPAN></DIV> //<DIV class='drag_editor' id='drag_editor_{0}' style='DISPLAY: none'></DIV> // // string BlockEndHtml = @"<DIV id='drag_switch_{0}' style='width:100%'> <DIV id='drag_content_{0}' style='background-color:{2}'> <DIV id='loadcontentid_{0}' style='WIDTH: 100px'><IMG src='/Modules/WebPart/loading.gif'><SPAN id='loadcontenttext_{0}' style='COLOR: #333'></SPAN></DIV> </DIV> </DIV> </DIV> <SCRIPT>{1}</SCRIPT>"; blockHtmls += string.Format(colBeginHtml, Convert.ToString(i + 1), width); string[] blockIds = col.Split(','); //每列的各块class='drag_content' foreach (string blockId in blockIds) { if (blockId != "" && WebPart.Exists <String>(blockId)) { WebPart bl = WebPart.TryFind(blockId); if (bl == null) { continue; } //读取模版中实例化参数 DataElement item = list.GetElement("Id", blockId); if (item != null) { bl.BlockKey = item.GetAttr("BlockKey"); bl.BlockImage = item.GetAttr("BlockImage"); bl.BlockTitle = item.GetAttr("BlockTitle"); bl.BlockType = item.GetAttr("BlockType"); bl.ColorValue = item.GetAttr("ColorValue"); bl.Color = item.GetAttr("Color"); bl.RepeatItemCount = int.Parse(item.GetAttr("RepeatItemCount")); bl.RepeatItemLength = int.Parse(item.GetAttr("RepeatItemLength")); bl.DelayLoadSecond = int.Parse(item.GetAttr("DelayLoadSecond")); } blockHtmls += string.Format(BlockBeginHtml, blockId, bl.ColorValue, bl.DefaultHeight); WebPartExt wb = new WebPartExt(bl, userId); blockHtmls += wb.GetHeadHtml(); //是否延时加载 if (bl.DelayLoadSecond.ToString().Trim() != "0") { blockHtmls += string.Format(BlockEndHtml, blockId, "window.setTimeout(\"loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "')\"," + Convert.ToString(bl.DelayLoadSecond * 1000) + ");" + "\n" + bl.RelateScript, bl.ContentColor); } else { blockHtmls += string.Format(BlockEndHtml, blockId, "loadDragContent('" + blockId + "','" + bl.RepeatItemCount + "');" + "\n" + bl.RelateScript, bl.ContentColor); } } } blockHtmls += string.Format(colEndHtml, Convert.ToString(i + 1)); return(blockHtmls); }
/// <summary> /// Parses through the block structure for item data and case name+collection /// </summary> /// <param name="caseUrLs"></param> /// <returns></returns> private static async Task <Dictionary <string, DataCollection> > ParseGridBlocks(IEnumerable <string> caseUrLs) { var csgoData = new Dictionary <string, DataCollection>(); foreach (string caseUrL in caseUrLs) { string page = await HtmlFetcher.RetrieveFromUrl(caseUrL); //Get case name and collection HtmlDocument htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(page); //Get the data out of the <a3> tags HtmlNode caseNodeData = htmlDoc.DocumentNode.SelectSingleNode( "//div[@class='inline-middle collapsed-top-margin']"); //inline-middle collapsed-top-margin string caseName = ExtractStringFromTags(caseNodeData, "h1"); string caseCollection = ExtractStringFromTags(caseNodeData, "h4"); //img-responsive center-block content-header-img-margin string iconUrL = ExtractImgSrc(htmlDoc, "img-responsive center-block content-header-img-margin"); var caseData = new DataCollection { Name = caseName, CaseCollection = caseCollection, IconUrL = iconUrL }; //If case name already exists, pass if (csgoData.ContainsKey(caseName)) { continue; } //Separate single string with line breaks into array string[] lines = page.Split( new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None ); //Filter to lines containing " | " List <string> fLines = lines.Where(l => l.Contains(" | ")).ToList(); //Select the text out of the html foreach (var dataDuoLines in fLines) //The 2 lines containing the item name and collection { HtmlDocument duoHtml = new HtmlDocument(); duoHtml.LoadHtml(dataDuoLines); //Get the data out of the <a3> tags HtmlNodeCollection duoLineDataNodes = duoHtml.DocumentNode.SelectNodes("/h3/a"); if (duoLineDataNodes != null && duoLineDataNodes.Any()) { List <string> duoLineData = duoLineDataNodes.Select(i => i.InnerHtml).ToList(); //Concat into item name if (duoLineData.Any()) { caseData.Items.Add(string.Join(" | ", duoLineData)); //Weapon name | skin name } } } if (!csgoData.TryGetValue(caseName, out _)) { csgoData.Add(caseName, caseData); } } return(csgoData); }
public void Deserialize(ITypeSerializer handler, DataCollection data) { handler.Deserialize(this, data); referenceCollection.InitRefCollection(tempProjectDependencies, tempIncludes); }
protected override void OnError(Exception ex, ParameterStd p, DataCollection d) { p.Resources.RollbackTransaction(p.CurrentTransToken); GlobalCommon.Logger.WriteLog(Base.Constants.LoggerLevel.ERROR, ex.Message + "\n" + ex.StackTrace); }
private static List <queryContainer> transformLinkEntitiesToQueries(CrmServiceClient service, SchemaEntities listOfEntities_DS, DataCollection <LinkEntity> linkEntities, queryContainer upper) { List <queryContainer> result = new List <queryContainer>(); foreach (LinkEntity le in linkEntities) { queryContainer current = new queryContainer { isRoot = false, masterEntityLogicalName = upper.entityLogicalName, entityLogicalName = le.LinkToEntityName, ExequteAsSeparateLinkedQueries = upper.ExequteAsSeparateLinkedQueries, CollectAllReferences = upper.CollectAllReferences }; SchemaField attr = GlobalHelper.getFieldFromSchema(listOfEntities_DS, le.LinkToEntityName, le.LinkToAttributeName); if (ReferenceEquals(attr, null)) { throw new Exception("Entity '" + le.LinkToEntityName + "' and its attribute '" + le.LinkToEntityName + "' are absent in source schema file"); } string attrType = attr.primaryKey ? "pk" : attr.type; //n:1 entity : linkedEntity if (attrType == "pk") { current.RelationShipType = relationShipType.Lookup; //recurse to first level FilterExpression filter = new FilterExpression(LogicalOperator.And); filter.AddFilter(le.LinkCriteria); ////move to crm helprer to query //ConditionExpression cond = new ConditionExpression(attr.name, ConditionOperator.Equal, upper.references[le.LinkToAttributeName] - is null); current.expression = transformLinkToQueryExpression(le); //update filter current.expression.Criteria = filter; //add a column to get lookup in resultset upper.expression.ColumnSet.AddColumn(le.LinkFromAttributeName); current.masterEntityLogicalName = le.LinkFromEntityName; current.entityLogicalName = le.LinkToEntityName; current.masterEntityLookUpName = le.LinkFromAttributeName; current.primaryKeyName = le.LinkToAttributeName; result.Add(transformToSeparateQueries(service, listOfEntities_DS, current)); } //1:n entity : linkedEntity else { current.RelationShipType = relationShipType.Child; current.masterEntityLookUpName = attr.name; QueryExpression linkEntityQuiery = new QueryExpression(le.LinkToEntityName); ////move to crm helprer to query //ConditionExpression cond = new ConditionExpression(attr.name, ConditionOperator.Equal, current.masterEntityLookUpID); FilterExpression filter = new FilterExpression(LogicalOperator.And); //filter.AddCondition(cond); linkEntityQuiery.ColumnSet = le.Columns; filter.AddFilter(le.LinkCriteria); linkEntityQuiery.Criteria = filter; linkEntityQuiery.NoLock = true; linkEntityQuiery.ExtensionData = le.ExtensionData; current.expression = linkEntityQuiery; if (!ReferenceEquals(le.LinkEntities, null) && le.LinkEntities.Count > 0) { //recurse to itself List <queryContainer> subQueries = transformLinkEntitiesToQueries(service, listOfEntities_DS, le.LinkEntities, current); if (!ReferenceEquals(subQueries, null) && subQueries.Count > 0) { result.AddRange(subQueries); } } result.Add(current); } } return(result); }
public MetadataFilterExpression() { Conditions = new DataCollection <MetadataConditionExpression>(); Filters = new DataCollection <MetadataFilterExpression>(); }
public LabelQueryExpression() { FilterLanguages = new DataCollection <int>(); }
private PlotModel LoadChart() { if (DataCollection == null || DataCollection.Count() == 0) { return(default);
public DataCollection(DataCollection other) : this(EfficioRuntimePINVOKE.new_DataCollection__SWIG_1(DataCollection.getCPtr(other)), true) { if (EfficioRuntimePINVOKE.SWIGPendingException.Pending) { throw EfficioRuntimePINVOKE.SWIGPendingException.Retrieve(); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DataCollection obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
/// <summary> /// Runs all of the tasks for this target, batched as necessary. /// </summary> internal async Task ExecuteTarget(ITaskBuilder taskBuilder, BuildRequestEntry requestEntry, ProjectLoggingContext projectLoggingContext, CancellationToken cancellationToken) { #if MSBUILDENABLEVSPROFILING try { string beginTargetBuild = String.Format(CultureInfo.CurrentCulture, "Build Target {0} in Project {1} - Start", this.Name, projectFullPath); DataCollection.CommentMarkProfile(8800, beginTargetBuild); #endif try { VerifyState(_state, TargetEntryState.Execution); ErrorUtilities.VerifyThrow(!_isExecuting, "Target {0} is already executing", _target.Name); _cancellationToken = cancellationToken; _isExecuting = true; // Generate the batching buckets. Note that each bucket will get a lookup based on the baseLookup. This lookup will be in its // own scope, which we will collapse back down into the baseLookup at the bottom of the function. List <ItemBucket> buckets = BatchingEngine.PrepareBatchingBuckets(GetBatchableParametersForTarget(), _baseLookup, _target.Location); WorkUnitResult aggregateResult = new WorkUnitResult(); TargetLoggingContext targetLoggingContext = null; bool targetSuccess = false; int numberOfBuckets = buckets.Count; string projectFullPath = requestEntry.RequestConfiguration.ProjectFullPath; string parentTargetName = null; if (ParentEntry != null && ParentEntry.Target != null) { parentTargetName = ParentEntry.Target.Name; } for (int i = 0; i < numberOfBuckets; i++) { ItemBucket bucket = buckets[i]; // If one of the buckets failed, stop building. if (aggregateResult.ActionCode == WorkUnitActionCode.Stop) { break; } targetLoggingContext = projectLoggingContext.LogTargetBatchStarted(projectFullPath, _target, parentTargetName, _buildReason); WorkUnitResult bucketResult = null; targetSuccess = false; Lookup.Scope entryForInference = null; Lookup.Scope entryForExecution = null; try { // This isn't really dependency analysis. This is up-to-date checking. Based on this we will be able to determine if we should // run tasks in inference or execution mode (or both) or just skip them altogether. ItemDictionary <ProjectItemInstance> changedTargetInputs; ItemDictionary <ProjectItemInstance> upToDateTargetInputs; Lookup lookupForInference; Lookup lookupForExecution; // UNDONE: (Refactor) Refactor TargetUpToDateChecker to take a logging context, not a logging service. TargetUpToDateChecker dependencyAnalyzer = new TargetUpToDateChecker(requestEntry.RequestConfiguration.Project, _target, targetLoggingContext.LoggingService, targetLoggingContext.BuildEventContext); DependencyAnalysisResult dependencyResult = dependencyAnalyzer.PerformDependencyAnalysis(bucket, out changedTargetInputs, out upToDateTargetInputs); switch (dependencyResult) { // UNDONE: Need to enter/leave debugger scope properly for the <Target> element. case DependencyAnalysisResult.FullBuild: case DependencyAnalysisResult.IncrementalBuild: case DependencyAnalysisResult.SkipUpToDate: // Create the lookups used to hold the current set of properties and items lookupForInference = bucket.Lookup; lookupForExecution = bucket.Lookup.Clone(); // Push the lookup stack up one so that we are only modifying items and properties in that scope. entryForInference = lookupForInference.EnterScope("ExecuteTarget() Inference"); entryForExecution = lookupForExecution.EnterScope("ExecuteTarget() Execution"); // if we're doing an incremental build, we need to effectively run the task twice -- once // to infer the outputs for up-to-date input items, and once to actually execute the task; // as a result we need separate sets of item and property collections to track changes if (dependencyResult == DependencyAnalysisResult.IncrementalBuild) { // subset the relevant items to those that are up-to-date foreach (string itemType in upToDateTargetInputs.ItemTypes) { lookupForInference.PopulateWithItems(itemType, upToDateTargetInputs[itemType]); } // subset the relevant items to those that have changed foreach (string itemType in changedTargetInputs.ItemTypes) { lookupForExecution.PopulateWithItems(itemType, changedTargetInputs[itemType]); } } // We either have some work to do or at least we need to infer outputs from inputs. bucketResult = await ProcessBucket(taskBuilder, targetLoggingContext, GetTaskExecutionMode(dependencyResult), lookupForInference, lookupForExecution); // Now aggregate the result with the existing known results. There are four rules, assuming the target was not // skipped due to being up-to-date: // 1. If this bucket failed or was cancelled, the aggregate result is failure. // 2. If this bucket Succeeded and we have not previously failed, the aggregate result is a success. // 3. Otherwise, the bucket was skipped, which has no effect on the aggregate result. // 4. If the bucket's action code says to stop, then we stop, regardless of the success or failure state. if (dependencyResult != DependencyAnalysisResult.SkipUpToDate) { aggregateResult = aggregateResult.AggregateResult(bucketResult); } else { if (aggregateResult.ResultCode == WorkUnitResultCode.Skipped) { aggregateResult = aggregateResult.AggregateResult(new WorkUnitResult(WorkUnitResultCode.Success, WorkUnitActionCode.Continue, null)); } } // Pop the lookup scopes, causing them to collapse their values back down into the // bucket's lookup. // NOTE: this order is important because when we infer outputs, we are trying // to produce the same results as would be produced from a full build; as such // if we're doing both the infer and execute steps, we want the outputs from // the execute step to override the outputs of the infer step -- this models // the full build scenario more correctly than if the steps were reversed entryForInference.LeaveScope(); entryForInference = null; entryForExecution.LeaveScope(); entryForExecution = null; targetSuccess = (bucketResult != null) && (bucketResult.ResultCode == WorkUnitResultCode.Success); break; case DependencyAnalysisResult.SkipNoInputs: case DependencyAnalysisResult.SkipNoOutputs: // We have either no inputs or no outputs, so there is nothing to do. targetSuccess = true; break; } } catch (InvalidProjectFileException e) { // Make sure the Invalid Project error gets logged *before* TargetFinished. Otherwise, // the log is confusing. targetLoggingContext.LogInvalidProjectFileError(e); if (null != entryForInference) { entryForInference.LeaveScope(); } if (null != entryForExecution) { entryForExecution.LeaveScope(); } aggregateResult = aggregateResult.AggregateResult(new WorkUnitResult(WorkUnitResultCode.Failed, WorkUnitActionCode.Stop, null)); } finally { // Don't log the last target finished event until we can process the target outputs as we want to attach them to the // last target batch. if (targetLoggingContext != null && i < numberOfBuckets - 1) { targetLoggingContext.LogTargetBatchFinished(projectFullPath, targetSuccess, null); targetLoggingContext = null; } } } // Produce the final results. List <TaskItem> targetOutputItems = new List <TaskItem>(); try { // If any legacy CallTarget operations took place, integrate them back in to the main lookup now. LeaveLegacyCallTargetScopes(); // Publish the items for each bucket back into the baseLookup. Note that EnterScope() was actually called on each // bucket inside of the ItemBucket constructor, which is why you don't see it anywhere around here. foreach (ItemBucket bucket in buckets) { bucket.LeaveScope(); } string targetReturns = _target.Returns; ElementLocation targetReturnsLocation = _target.ReturnsLocation; // If there are no targets in the project file that use the "Returns" attribute, that means that we // revert to the legacy behavior in the case where Returns is not specified (null, rather // than the empty string, which indicates no returns). Legacy behavior is for all // of the target's Outputs to be returned. // On the other hand, if there is at least one target in the file that uses the Returns attribute, // then all targets in the file are run according to the new behaviour (return nothing unless otherwise // specified by the Returns attribute). if (targetReturns == null) { if (!_target.ParentProjectSupportsReturnsAttribute) { targetReturns = _target.Outputs; targetReturnsLocation = _target.OutputsLocation; } } if (!String.IsNullOrEmpty(targetReturns)) { // Determine if we should keep duplicates. bool keepDupes = ConditionEvaluator.EvaluateCondition ( _target.KeepDuplicateOutputs, ParserOptions.AllowPropertiesAndItemLists, _expander, ExpanderOptions.ExpandPropertiesAndItems, requestEntry.ProjectRootDirectory, _target.KeepDuplicateOutputsLocation, projectLoggingContext.LoggingService, projectLoggingContext.BuildEventContext, FileSystems.Default); // NOTE: we need to gather the outputs in batches, because the output specification may reference item metadata // Also, we are using the baseLookup, which has possibly had changes made to it since the project started. Because of this, the // set of outputs calculated here may differ from those which would have been calculated at the beginning of the target. It is // assumed the user intended this. List <ItemBucket> batchingBuckets = BatchingEngine.PrepareBatchingBuckets(GetBatchableParametersForTarget(), _baseLookup, _target.Location); if (keepDupes) { foreach (ItemBucket bucket in batchingBuckets) { targetOutputItems.AddRange(bucket.Expander.ExpandIntoTaskItemsLeaveEscaped(targetReturns, ExpanderOptions.ExpandAll, targetReturnsLocation)); } } else { HashSet <TaskItem> addedItems = new HashSet <TaskItem>(); foreach (ItemBucket bucket in batchingBuckets) { IList <TaskItem> itemsToAdd = bucket.Expander.ExpandIntoTaskItemsLeaveEscaped(targetReturns, ExpanderOptions.ExpandAll, targetReturnsLocation); foreach (TaskItem item in itemsToAdd) { if (!addedItems.Contains(item)) { targetOutputItems.Add(item); addedItems.Add(item); } } } } } } finally { if (targetLoggingContext != null) { // log the last target finished since we now have the target outputs. targetLoggingContext.LogTargetBatchFinished(projectFullPath, targetSuccess, targetOutputItems != null && targetOutputItems.Count > 0 ? targetOutputItems : null); } } _targetResult = new TargetResult(targetOutputItems.ToArray(), aggregateResult); if (aggregateResult.ResultCode == WorkUnitResultCode.Failed && aggregateResult.ActionCode == WorkUnitActionCode.Stop) { _state = TargetEntryState.ErrorExecution; } else { _state = TargetEntryState.Completed; } } finally { _isExecuting = false; } #if MSBUILDENABLEVSPROFILING } finally { string endTargetBuild = String.Format(CultureInfo.CurrentCulture, "Build Target {0} in Project {1} - End", this.Name, projectFullPath); DataCollection.CommentMarkProfile(8801, endTargetBuild); } #endif }
public void Should_CreateAnd_LoadFields() { var path = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); DataCollection collection = new DataCollection(); Table table = new Table(); table.Name = "COMISIO"; table.AddField(new Field("cp")); table.AddField(new Field("direccion")); table.AddField(new Field("poblacion")); table.AddField(new Field("provincia")); table.AddField(new Field("nacioper")); table.AddField(new Field("telefono")); table.AddField(new Field("fax")); table.AddField(new Field("movil")); table.AddField(new Field("alta_comi")); table.AddField(new Field("baja_comi")); table.AddField(new Field("idioma")); table.AddField(new Field("iata")); table.AddField(new Field("ivasino")); table.AddField(new Field("retensino")); table.AddField(new Field("nacional")); table.AddField(new Field("conceptos_cond")); table.AddField(new Field("agencia")); table.AddField(new Field("traduce_ws")); table.AddField(new Field("truck_rental_broker")); table.AddField(new Field("combus_prepago_comi")); table.AddField(new Field("no_generar_autofac")); table.AddField(new Field("todos_extras")); table.AddField(new Field("auto_oneway")); table.AddField(new Field("COT_INCLUIDOS_SIN_GRUPO")); table.AddField(new Field("no_mail_res")); table.AddField(new Field("autofac_sin_iva")); table.AddField(new Field("commision_sin_iva_com")); table.AddField(new Field("num_sobreque")); table.AddField(new Field("porcen")); table.AddField(new Field("porcenlo")); table.AddField(new Field("porcencl")); table.AddField(new Field("por_subcontra")); table.AddField(new Field("imp_comi")); table.AddField(new Field("ref_a_cli")); table.AddField(new Field("cliente")); table.AddField(new Field("product_comi")); table.AddField(new Field("nif")); table.AddField(new Field("email")); collection.AddTable(table); DataLoader loader = new DataLoader(); StringBuilder builder = new StringBuilder(); Uri fileUri = new Uri(path); builder.Append(fileUri.LocalPath); builder.Append("\\CommissionAgent.xml"); string savedPathFile = builder.ToString(); // we save the data to xml. try { loader.SaveXmlData(collection, savedPathFile); // now we shall load the fields from the data contained. } catch (Exception e) { Console.Write(e.Message); Assert.Fail(e.Message); } // ok now we have to load the data from disk again. DataCollection newCollection = loader.LoadXmlData(savedPathFile); Assert.NotNull(newCollection); bool equalList = CompareEqualList(newCollection.DataList, collection.DataList); Assert.IsTrue(equalList); }
public void ProcessResult(DataCollection <Entity> result, SourceTypes sourceType) { foreach (var en in result) { var id = en.Id; var entityName = en.GetAttributeValue <string>("north52_sourceentityname"); var formulaName = en.GetAttributeValue <string>("north52_name"); var formula = new CrmFormula() { Id = id, Name = formulaName, //Type = new Option() //{ // Value = en.GetAttributeValue<OptionSetValue>("north52_formulatype").Value, // Name = en.FormattedValues["north52_formulatype"] //}, Type = CrmHelper.GetOption(en, "north52_formulatype"), StatusCode = CrmHelper.GetOption(en, "statuscode"), StateCode = CrmHelper.GetOption(en, "statecode"), SourceEntityName = en.GetAttributeValue <string>("north52_sourceentityname"), SourceEntityProperty = en.GetAttributeValue <string>("north52_sourceentityproperty"), TargetEntityName = en.GetAttributeValue <string>("north52_targetentityname"), TargetEntityproperty = en.GetAttributeValue <string>("north52_targetentityproperty"), Description = en.GetAttributeValue <string>("north52_formuladescription"), }; var dr = FormulaDiffRecords.Where(x => x.Name == formulaName && x.EntityName == entityName).FirstOrDefault(); if (dr == null) { dr = new FormulaDiffRecord() { Name = formulaName, EntityName = entityName, }; FormulaDiffRecords.Add(dr); } if (sourceType == SourceTypes.Left) { dr.LFormula = formula; } else { dr.RFormula = formula; } CrmFormulaEntity crmEntity = FormulaEntities.Where(x => x.LogicalName == entityName).FirstOrDefault(); if (crmEntity == null) { crmEntity = new CrmFormulaEntity() { LogicalName = entityName }; FormulaEntities.Add(crmEntity); } var fdr = crmEntity.FormulaDiffRecords.Where(x => x.Name == formulaName).FirstOrDefault(); if (fdr == null) { fdr = dr; crmEntity.FormulaDiffRecords.Add(fdr); } } }
private void FillObjectEntities(DataContainer container, DataCollection collection, string prefix, JObject obj, List <DataEntity> entities) { var properties = obj.Properties(); foreach (var property in properties) { if (entities.Find(x => x.Name.Equals($"{prefix}{property.Name}")) != null) { continue; } switch (property.Value.Type) { case JTokenType.Boolean: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.Boolean, "Boolean", container, collection)); break; case JTokenType.String: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.String, "String", container, collection)); break; case JTokenType.Date: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.DateTime, "Date", container, collection)); break; case JTokenType.Float: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.Float, "Float", container, collection)); break; case JTokenType.Integer: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.Int, "Integer", container, collection)); break; case JTokenType.Guid: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.Guid, "Guid", container, collection)); break; case JTokenType.Uri: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.String, "Uri", container, collection)); break; case JTokenType.Array: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.String, "Array", container, collection)); var arr = (JArray)property.Value; for (int i = 0; i < arr.Count; i++) { var arrayItem = arr[i]; if (arrayItem.Type == JTokenType.Object) { FillObjectEntities(container, collection, $"{prefix}{property.Name}.", (JObject)arrayItem, entities); } } break; case JTokenType.Object: FillObjectEntities(container, collection, $"{prefix}{property.Name}.", (JObject)property.Value, entities); break; default: entities.Add(new DataEntity($"{prefix}{property.Name}", DataType.Unknown, Enum.GetName(typeof(JTokenType), property.Value.Type), container, collection)); break; } } }
private void StoreValueInRecord(DataColumn column, DataRow rowValue, DataCollection rowRecord) { bool conversionResult; float floatConvValue; int intConvValue; float million = 1000000; switch (column.ColumnName) { case "Column1": rowRecord.CompanyName = rowValue[column].ToString(); break; case "Sector": rowRecord.Sector = rowValue[column].ToString(); break; case "Ticker": rowRecord.Ticker = rowValue[column].ToString(); break; case "Revenues (in million, TTM, USD)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.Revenue = conversionResult ? floatConvValue * million : 0; break; case "EBITDA (in million, TTM, USD)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.EbitdaCurrent = conversionResult ? floatConvValue * million : 0; break; case "EBITDA (in million, TTM-1, USD)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.Ebitda1YrAgo = conversionResult ? floatConvValue * million : 0; break; case "EBITDA (in million, TTM-2, USD)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.Ebitda2YrAgo = conversionResult ? floatConvValue * million : 0; break; case "EBITDA (in million, TTM-3, USD)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.Ebitda3YrAgo = conversionResult ? floatConvValue * million : 0; break; case "Net Margin (TTM)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.NetMargin = conversionResult ? floatConvValue * 100 : 0; break; case "P. F-Score (TTM)": conversionResult = int.TryParse(rowValue[column].ToString(), out intConvValue); rowRecord.PiotroskiScoreCurrent = conversionResult ? intConvValue : 0; break; case "P. F-Score (TTM-1)": conversionResult = int.TryParse(rowValue[column].ToString(), out intConvValue); rowRecord.PiotroskiScore1YrAgo = conversionResult ? intConvValue : 0; break; case "P. F-Score (TTM-2)": conversionResult = int.TryParse(rowValue[column].ToString(), out intConvValue); rowRecord.PiotroskiScore2YrAgo = conversionResult ? intConvValue : 0; break; case "P. F-Score (TTM-3)": conversionResult = int.TryParse(rowValue[column].ToString(), out intConvValue); rowRecord.PiotroskiScore3YrAgo = conversionResult ? intConvValue : 0; break; case "Gross Margin (TTM)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.GrossMargin = conversionResult ? floatConvValue * 100 : 0; break; case "Operating Margin (TTM)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.OperatingMargin = conversionResult ? floatConvValue * 100 : 0; break; case "ROE (TTM)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.ReturnOnEquity = conversionResult ? floatConvValue * 100 : 0; break; case "ROA (TTM)": conversionResult = float.TryParse(rowValue[column].ToString(), out floatConvValue); rowRecord.ReturnOnAssets = conversionResult ? floatConvValue * 100 : 0; break; default: return; } }
public MetadataPropertiesExpression() { PropertyNames = new DataCollection <string>(); }
public SpiderChart(DataCollection data, SpiderChartStyle style, int width, int height) : base(data, style, width, height) { this._style = style; this.ValueSteps = 0.1F; }
public void AddFrame(AnalogFrame frame) { DataCollection.Add(frame); }
public void AddFrame(int num, int timeBias, int value) { AnalogFrame frame = new AnalogFrame(num, timeBias, value); DataCollection.Add(frame); }
public static DataCollectionReadOnlyViewModel MapFrom(this DataCollectionReadOnlyViewModel vm, DataCollection collection, Project project) { if (vm == null || collection == null || project == null) { return(vm); } vm.InjectFrom(collection); MapForCodes(vm.FieldsOfResearch, collection.FieldsOfResearch); MapSeoCodes(vm.SocioEconomicObjectives, collection.SocioEconomicObjectives); vm.Manager = MapManager(collection.Parties); vm.UrdmsUsers = MapUrdmsUsers(collection.Parties); vm.NonUrdmsUsers = MapNonUrdmsUsers(collection.Parties); vm.ProjectTitle = project.Title; return(vm); }
/// <summary> /// This method creates any entity records that this sample requires. /// Create a queue record. /// Create a team record. /// Create a role and add queue privileges. /// Assign role to team. /// </summary> public void CreateRequiredRecords() { // Create a queue instance and set its property values. Queue newQueue = new Queue { Name = "Example Queue", Description = "This is an example queue." }; // Create a new queue and store its returned GUID in a variable for later use. _queueId = _serviceProxy.Create(newQueue); Console.WriteLine("Created {0}", newQueue.Name); // Retrieve the default business unit for the creation of the team and role. QueryExpression queryDefaultBusinessUnit = new QueryExpression { EntityName = BusinessUnit.EntityLogicalName, ColumnSet = new ColumnSet("businessunitid"), Criteria = new FilterExpression { Conditions = { new ConditionExpression { AttributeName = "parentbusinessunitid", Operator = ConditionOperator.Null } } } }; BusinessUnit defaultBusinessUnit = (BusinessUnit)_serviceProxy.RetrieveMultiple( queryDefaultBusinessUnit).Entities[0]; // Create a new example team. Team setupTeam = new Team { Name = "Example Team", BusinessUnitId = new EntityReference(BusinessUnit.EntityLogicalName, defaultBusinessUnit.BusinessUnitId.Value) }; _teamId = _serviceProxy.Create(setupTeam); Console.WriteLine("Created {0}", setupTeam.Name); // Create a new example role. Role setupRole = new Role { Name = "Example Role", BusinessUnitId = new EntityReference(BusinessUnit.EntityLogicalName, defaultBusinessUnit.BusinessUnitId.Value) }; _roleId = _serviceProxy.Create(setupRole); Console.WriteLine("Created {0}", setupRole.Name); // Retrieve the prvReadQueue and prvAppendToQueue privileges. QueryExpression queryQueuePrivileges = new QueryExpression { EntityName = Privilege.EntityLogicalName, ColumnSet = new ColumnSet("privilegeid", "name"), Criteria = new FilterExpression { Conditions = { new ConditionExpression { AttributeName = "name", Operator = ConditionOperator.In, Values = { "prvReadQueue", "prvAppendToQueue" } } } } }; DataCollection <Entity> retrievedQueuePrivileges = _serviceProxy.RetrieveMultiple(queryQueuePrivileges).Entities; Console.WriteLine("Retrieved prvReadQueue and prvAppendToQueue privileges."); // Define a list to hold the RolePrivileges we'll need to add List <RolePrivilege> rolePrivileges = new List <RolePrivilege>(); foreach (Privilege privilege in retrievedQueuePrivileges) { RolePrivilege rolePrivilege = new RolePrivilege( (int)PrivilegeDepth.Local, privilege.PrivilegeId.Value); rolePrivileges.Add(rolePrivilege); } // Add the prvReadQueue and prvAppendToQueue privileges to the example role. AddPrivilegesRoleRequest addPrivilegesRequest = new AddPrivilegesRoleRequest { RoleId = _roleId, Privileges = rolePrivileges.ToArray() }; _serviceProxy.Execute(addPrivilegesRequest); Console.WriteLine("Retrieved privileges are added to {0}.", setupRole.Name); // Add the example role to the example team. _serviceProxy.Associate( Team.EntityLogicalName, _teamId, new Relationship("teamroles_association"), new EntityReferenceCollection() { new EntityReference(Role.EntityLogicalName, _roleId) }); // It takes some time for the privileges to propogate to the team. // Verify this is complete before continuing. bool teamLacksPrivilege = true; while (teamLacksPrivilege) { RetrieveTeamPrivilegesRequest retrieveTeamPrivilegesRequest = new RetrieveTeamPrivilegesRequest { TeamId = _teamId }; RetrieveTeamPrivilegesResponse retrieveTeamPrivilegesResponse = (RetrieveTeamPrivilegesResponse)_serviceProxy.Execute( retrieveTeamPrivilegesRequest); if (retrieveTeamPrivilegesResponse.RolePrivileges.Any( rp => rp.PrivilegeId == rolePrivileges[0].PrivilegeId) & amp; & retrieveTeamPrivilegesResponse.RolePrivileges.Any( rp => rp.PrivilegeId == rolePrivileges[1].PrivilegeId)) { teamLacksPrivilege = false; }
private void simpleButton1_Click(object sender, EventArgs e) { DataCollection coll = new DataCollection(DateTime.Parse(cDateEdit1.EditValue.ToString()), DateTime.Parse(cDateEdit2.EditValue.ToString())); coll.Collect(); }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { int totalCount = 0; try { EntityObj obj = (EntityObj)this.comboBox.SelectedItem; QueryExpression query = new QueryExpression(obj.EntityName); query.ColumnSet = new ColumnSet(true); query.Distinct = true; //query.ColumnSet.AddColumn(obj.EntityOC); query.PageInfo = new PagingInfo(); query.PageInfo.Count = 5000; query.PageInfo.PageNumber = 1; query.PageInfo.ReturnTotalRecordCount = true; EntityCollection entityCollection = svcClient.OrganizationServiceProxy.RetrieveMultiple(query); totalCount = entityCollection.Entities.Count; while (entityCollection.MoreRecords) { query.PageInfo.PageNumber += 1; query.PageInfo.PagingCookie = entityCollection.PagingCookie; entityCollection = svcClient.OrganizationServiceProxy.RetrieveMultiple(query); totalCount = totalCount + entityCollection.Entities.Count; } MessageBox.Show("Total Record Count :" + totalCount.ToString()); // Retrieve Views //<snippetWorkWithViews2> QueryExpression mySavedQuery = new QueryExpression { ColumnSet = new ColumnSet("savedqueryid", "name", "querytype", "isdefault", "returnedtypecode", "isquickfindquery"), EntityName = "savedquery", Criteria = new FilterExpression { Conditions = { //new ConditionExpression //{ // AttributeName = "querytype", // Operator = ConditionOperator.Equal, // Values = {0} //}, new ConditionExpression { AttributeName = "returnedtypecode", Operator = ConditionOperator.Equal, Values = { obj.EntityName } } } } }; RetrieveMultipleRequest retrieveSavedQueriesRequest = new RetrieveMultipleRequest { Query = mySavedQuery }; RetrieveMultipleResponse retrieveSavedQueriesResponse = (RetrieveMultipleResponse)svcClient.OrganizationServiceProxy.Execute(retrieveSavedQueriesRequest); DataCollection <Entity> savedQueries = retrieveSavedQueriesResponse.EntityCollection.Entities; this.label1.Visibility = Visibility.Visible; this.comboBox1.Visibility = Visibility.Visible; this.label2.Visibility = Visibility.Visible; this.listView.Visibility = Visibility.Visible; this.button.Visibility = Visibility.Visible; //Display the Retrieved views ArrayList viewList = new ArrayList(); foreach (Entity ent in savedQueries) { viewList.Add(ent["name"].ToString()); } viewList.Sort(); listView.ItemsSource = viewList; RetrieveEntityRequest reqAttr = new RetrieveEntityRequest(); reqAttr.EntityFilters = EntityFilters.Attributes; reqAttr.LogicalName = obj.EntityName; reqAttr.RetrieveAsIfPublished = true; RetrieveEntityResponse resAttr = (RetrieveEntityResponse)svcClient.OrganizationServiceProxy.Execute(reqAttr); EntityMetadata metaAttr = resAttr.EntityMetadata; List <AttributeObj> lstAttr = new List <AttributeObj>(); foreach (AttributeMetadata attrMeta in metaAttr.Attributes) { AttributeObj attrobj = new AttributeObj(); attrobj.AttributeName = attrMeta.SchemaName; attrobj.AttributeSchemaName = attrMeta.LogicalName; lstAttr.Add(attrobj); } lstAttr = lstAttr.OrderBy(o => o.AttributeName).ToList(); this.comboBox1.DisplayMemberPath = "AttributeName"; this.comboBox1.SelectedValuePath = "AttributeSchemaName"; this.comboBox1.ItemsSource = lstAttr; this.comboBox1.Text = "Select Attribute Name"; } catch (Exception ex) { MessageBox.Show("Error Message: " + ex.Message); } }
/// <summary> /// Button to login to CRM and create a CrmService Client /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LoginButton_Click(object sender, RoutedEventArgs e) { List <EntityObj> lst = new List <EntityObj>(); List <SystemUser> lstActiveUsr = new List <SystemUser>(); #region Login Control // Establish the Login control CrmLogin ctrl = new CrmLogin(); // Wire Event to login response. ctrl.ConnectionToCrmCompleted += ctrl_ConnectionToCrmCompleted; // Show the dialog. ctrl.ShowDialog(); // Handel return. if (ctrl.CrmConnectionMgr != null && ctrl.CrmConnectionMgr.CrmSvc != null && ctrl.CrmConnectionMgr.CrmSvc.IsReady) { MessageBox.Show("Good Connect"); } else { MessageBox.Show("BadConnect"); } #endregion #region CRMServiceClient if (ctrl.CrmConnectionMgr != null && ctrl.CrmConnectionMgr.CrmSvc != null && ctrl.CrmConnectionMgr.CrmSvc.IsReady) { svcClient = ctrl.CrmConnectionMgr.CrmSvc; ctrl.Close(); this.loginbutton.Visibility = Visibility.Hidden; if (svcClient.IsReady) { this.label.Visibility = Visibility.Visible; this.comboBox.Visibility = Visibility.Visible; //RetrieveEntityRequest req = new RetrieveEntityRequest() //{ // EntityFilters = EntityFilters.All, // RetrieveAsIfPublished=true, // LogicalName="account" //}; //RetrieveEntityResponse res = (RetrieveEntityResponse)svcClient.OrganizationServiceProxy.Execute(req); RetrieveAllEntitiesRequest request = new RetrieveAllEntitiesRequest() { EntityFilters = EntityFilters.Entity, RetrieveAsIfPublished = true }; // Retrieve the MetaData. RetrieveAllEntitiesResponse response = (RetrieveAllEntitiesResponse)svcClient.OrganizationServiceProxy.Execute(request); foreach (EntityMetadata currentEntity in response.EntityMetadata) { //if (currentEntity.DisplayName.UserLocalizedLabel!=null) //{ EntityObj obj = new EntityObj(); obj.EntityName = currentEntity.LogicalName; obj.EntityOC = currentEntity.ObjectTypeCode.ToString(); lst.Add(obj); //} } lst = lst.OrderBy(o => o.EntityName).ToList(); this.comboBox.DisplayMemberPath = "EntityName"; this.comboBox.SelectedValuePath = "EntityOC"; this.comboBox.ItemsSource = lst; this.comboBox.Text = "Select Entity Name"; this.label3.Visibility = Visibility.Visible; this.comboBox2.Visibility = Visibility.Visible; DataCollection <Entity> activeUsrsColl = MainWindow.FindEnabledUsers(svcClient.OrganizationServiceProxy); foreach (Entity user in activeUsrsColl) { SystemUser sysUser = new SystemUser(); sysUser.FullName = user["fullname"].ToString(); sysUser.SystemUserID = user["systemuserid"].ToString(); lstActiveUsr.Add(sysUser); } lstActiveUsr = lstActiveUsr.OrderBy(o => o.FullName).ToList(); this.comboBox2.DisplayMemberPath = "FullName"; this.comboBox2.SelectedValuePath = "SystemUserID"; this.comboBox2.ItemsSource = lstActiveUsr; this.comboBox2.Text = "Select Active User Name"; // Get data from CRM . //string FetchXML = // @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> // <entity name='account'> // <attribute name='name' /> // <attribute name='primarycontactid' /> // <attribute name='telephone1' /> // <attribute name='accountid' /> // <order attribute='name' descending='false' /> // </entity> // </fetch>"; //var Result = svcClient.GetEntityDataByFetchSearchEC(FetchXML); //if (Result != null) //{ // MessageBox.Show(string.Format("Found {0} records\nFirst Record name is {1}", Result.Entities.Count, Result.Entities.FirstOrDefault().GetAttributeValue<string>("name"))); //} //// Core API using SDK OOTB //CreateRequest req = new CreateRequest(); //Entity accENt = new Entity("account"); //accENt.Attributes.Add("name", "TESTFOO"); //req.Target = accENt; //CreateResponse res = (CreateResponse)svcClient.OrganizationServiceProxy.Execute(req); ////CreateResponse res = (CreateResponse)svcClient.ExecuteCrmOrganizationRequest(req, "MyAccountCreate"); //MessageBox.Show(res.id.ToString()); //// Using Xrm.Tooling helpers. //Dictionary<string, CrmDataTypeWrapper> newFields = new Dictionary<string, CrmDataTypeWrapper>(); //// Create a new Record. - Account //newFields.Add("name", new CrmDataTypeWrapper("CrudTestAccount", CrmFieldType.String)); //Guid guAcctId = svcClient.CreateNewRecord("account", newFields); //MessageBox.Show(string.Format("New Record Created {0}", guAcctId)); } } #endregion }
/// <summary> /// Token constructor /// </summary> public Tokens() { InitializeComponent(); if (Device.Idiom == TargetIdiom.Desktop) { MainGrid.VerticalOptions = LayoutOptions.Center; MainGrid.HorizontalOptions = LayoutOptions.Center; MainGrid.HeightRequest = 500; MainGrid.WidthRequest = 500; TitleGrid.Margin = new Thickness(10, 0, 0, 0); TitleLabel.VerticalOptions = LayoutOptions.Start; HeadingGrid.Margin = new Thickness(10, 0, 0, 0); HeadingLabel.VerticalOptions = LayoutOptions.Start; } var fontFamily = "switch.ttf"; if (Device.RuntimePlatform == Device.UWP) { MainSwitch.WidthRequest = 64; MainSwitch.SegmentHeight = 23; MainSwitch.SelectionTextColor = Color.White; #if COMMONSB fontFamily = "/Assets/Fonts/switch.ttf#switch"; #else if (Core.SampleBrowser.IsIndividualSB) { fontFamily = "/Assets/Fonts/switch.ttf#switch"; } else { fontFamily = $"ms-appx:///SampleBrowser.SfSegmentedControl.UWP/Assets/Fonts/switch.ttf#switch"; } #endif } else if (Device.RuntimePlatform == Device.iOS) { fontFamily = "switch"; } if (Device.RuntimePlatform == Device.UWP) { DataCollection.Add(new SfSegmentItem() { IconFont = "\uE711", FontIconFontColor = Color.Transparent, FontIconFontSize = 12, FontIconFontFamily = "Segoe MDL2 Assets" }); DataCollection.Add(new SfSegmentItem() { IconFont = "\uE738", FontIconFontColor = Color.Transparent, FontIconFontSize = 12, FontIconFontFamily = "Segoe MDL2 Assets" }); DataCollection.Add(new SfSegmentItem() { IconFont = "\uE710", FontIconFontColor = Color.Transparent, FontIconFontSize = 12, FontIconFontFamily = "Segoe MDL2 Assets" }); } else { DataCollection.Add(new SfSegmentItem() { IconFont = "o", FontIconFontColor = Color.Transparent, FontIconFontSize = 20, FontIconFontFamily = fontFamily }); DataCollection.Add(new SfSegmentItem() { IconFont = "i", FontIconFontColor = Color.Transparent, FontIconFontSize = 20, FontIconFontFamily = fontFamily }); DataCollection.Add(new SfSegmentItem() { IconFont = "c", FontIconFontColor = Color.Transparent, FontIconFontSize = 20, FontIconFontFamily = fontFamily }); } ListCollection.Add(new AppModel(this) { Name = "Facebook", IconColor = Color.FromHex("FF355088"), Icon = "F", CanNotify = true }); ListCollection.Add(new AppModel(this) { Name = "Twitter", IconColor = Color.FromHex("FF1192DF"), Icon = "T" }); ListCollection.Add(new AppModel(this) { Name = "Youtube", IconColor = Color.FromHex("FFD41D1F"), Icon = "Y", CanNotify = true }); ListCollection.Add(new AppModel(this) { Name = "Instagram", IconColor = Color.FromHex("FFE1306C"), Icon = "I" }); ListCollection.Add(new AppModel(this) { Name = "Gmail", IconColor = Color.FromHex("FFE9594E"), Icon = "Z" }); ListCollection.Add(new AppModel(this) { Name = "Linked In", IconColor = Color.FromHex("FF0172B6"), Icon = "L", CanNotify = true }); ListCollection.Add(new AppModel(this) { Name = "Maps", IconColor = Color.FromHex("FFD88722"), Icon = "A" }); ListCollection.Add(new AppModel(this) { Name = "Word", IconColor = Color.FromHex("FF2B569A"), Icon = "W" }); ListCollection.Add(new AppModel(this) { Name = "Excel", IconColor = Color.FromHex("FF207346"), Icon = "E", CanNotify = true }); ListCollection.Add(new AppModel(this) { Name = "PowerPoint", IconColor = Color.FromHex("FFD24625"), Icon = "O" }); ListCollection.Add(new AppModel(this) { Name = "Skype", IconColor = Color.FromHex("FF1EA5DD"), Icon = "S", CanNotify = true }); ListCollection.Add(new AppModel(this) { Name = "Photo", IconColor = Color.FromHex("FFFF7214"), Icon = "P" }); ListCollection.Add(new AppModel(this) { Name = "Music", IconColor = Color.FromHex("FF359D8A"), Icon = "M" }); ListCollection.Add(new AppModel(this) { Name = "Video", IconColor = Color.FromHex("FF90558B"), Icon = "V" }); this.BindingContext = this; }
protected override void Dispose(ParameterStd p, DataCollection d) { p.Dispose(); d.Dispose(); }