private List <DataReportMenu> GetDataReportItemMenus(MyDataObject item) { var result = new List <DataReportMenu>(); SetRelationshipMenus(result, item); return(result); }
public void TestThatGetTargetValueWithMapperGetsOriginalTargetValueIfAnDeliveryEngineMappingExceptionOccurs() { var fixture = new Fixture(); fixture.Customize <IDeliveryEngineMappingExceptionInfo>(e => e.FromFactory(() => MockRepository.GenerateMock <IDeliveryEngineMappingExceptionInfo>())); var fieldMock = MockRepository.GenerateMock <IField>(); fieldMock.Expect(m => m.DatatypeOfSource) .Return(typeof(string)) .Repeat.Any(); fieldMock.Expect(m => m.Map) .Return(null) .Repeat.Any(); Assert.That(fieldMock, Is.Not.Null); var mapperMock = MockRepository.GenerateMock <IMap>(); mapperMock.Expect(m => m.MapValue <string, string>(Arg <string> .Is.NotNull)) .Throw(fixture.CreateAnonymous <DeliveryEngineMappingException>()) .Repeat.Any(); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); var targetValue = dataObject.GetTargetValue <string>(mapperMock); Assert.That(targetValue, Is.Not.Null); Assert.That(targetValue, Is.Not.Empty); fieldMock.AssertWasCalled(m => m.DatatypeOfSource); fieldMock.AssertWasCalled(m => m.Map); mapperMock.AssertWasCalled(m => m.MapValue <string, string>(Arg <string> .Is.NotNull)); }
public void TestThatGetTargetValueGetsUnmappedTargetValueWhereSourceValueIsNotNullAndTypeOfTargetIsNullable() { var fieldMock = MockRepository.GenerateMock <IField>(); fieldMock.Expect(m => m.DatatypeOfSource) .Return(typeof(string)) .Repeat.Any(); fieldMock.Expect(m => m.Map) .Return(null) .Repeat.Any(); Assert.That(fieldMock, Is.Not.Null); var fixture = new Fixture(); fixture.Customize <string>(e => e.FromFactory(() => fixture.CreateAnonymous <int>().ToString(CultureInfo.InvariantCulture))); var dataObject = new MyDataObject(fieldMock, fixture); Assert.That(dataObject, Is.Not.Null); var targetValue = dataObject.GetTargetValue <int?>(); Assert.That(targetValue, Is.Not.Null); fieldMock.AssertWasCalled(m => m.DatatypeOfSource); fieldMock.AssertWasCalled(m => m.Map); }
public void TestThatGetTargetValueGetsUnmappedTargetValueWhereSourceValueIsNullAndTypeOfTargetIsNullable() { var fieldMock = MockRepository.GenerateMock <IField>(); fieldMock.Expect(m => m.DatatypeOfSource) .Return(typeof(DateTime?)) .Repeat.Any(); fieldMock.Expect(m => m.Map) .Return(null) .Repeat.Any(); Assert.That(fieldMock, Is.Not.Null); var fixture = new Fixture(); fixture.Inject <DateTime?>(null); var dataObject = new MyDataObject(fieldMock, fixture); Assert.That(dataObject, Is.Not.Null); var targetValue = dataObject.GetTargetValue <DateTime?>(); Assert.That(targetValue, Is.Null); fieldMock.AssertWasCalled(m => m.DatatypeOfSource); fieldMock.AssertWasCalled(m => m.Map); }
public void TestThatGetTargetValueWithMapperGetsTargetValueFromMapper() { var fieldMock = MockRepository.GenerateMock <IField>(); fieldMock.Expect(m => m.DatatypeOfSource) .Return(typeof(string)) .Repeat.Any(); fieldMock.Expect(m => m.Map) .Return(null) .Repeat.Any(); Assert.That(fieldMock, Is.Not.Null); var mapperMock = MockRepository.GenerateMock <IMap>(); mapperMock.Expect(m => m.MapValue <string, string>(Arg <string> .Is.NotNull)) .Return(null) .Repeat.Any(); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); var targetValue = dataObject.GetTargetValue <string>(mapperMock); Assert.That(targetValue, Is.Null); fieldMock.AssertWasCalled(m => m.DatatypeOfSource); fieldMock.AssertWasCalled(m => m.Map); mapperMock.AssertWasCalled(m => m.MapValue <string, string>(Arg <string> .Is.NotNull)); }
public void TestThatGetTargetValueThrowsDeliveryEngineMappingExceptionWithInnerExceptionIfDeliveryEngineMappingExceptionOccursInMapper() { var fixture = new Fixture(); fixture.Customize <IDeliveryEngineMappingExceptionInfo>(e => e.FromFactory(() => MockRepository.GenerateMock <IDeliveryEngineMappingExceptionInfo>())); var mapException = fixture.CreateAnonymous <DeliveryEngineMappingException>(); var mapMock = MockRepository.GenerateMock <IMap>(); mapMock.Expect(m => m.MapValue <string, string>(Arg <string> .Is.NotNull)) .Throw(mapException) .Repeat.Any(); var tableMock = MockRepository.GenerateMock <ITable>(); tableMock.Expect(m => m.NameTarget) .Return(fixture.CreateAnonymous <string>()) .Repeat.Any(); var fieldMock = MockRepository.GenerateMock <IField>(); fieldMock.Expect(m => m.Table) .Return(tableMock) .Repeat.Any(); fieldMock.Expect(m => m.NameTarget) .Return(fixture.CreateAnonymous <string>()) .Repeat.Any(); fieldMock.Expect(m => m.DatatypeOfSource) .Return(typeof(string)) .Repeat.Any(); fieldMock.Expect(m => m.Map) .Return(mapMock) .Repeat.Any(); Assert.That(fieldMock, Is.Not.Null); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); var exception = Assert.Throws <DeliveryEngineMappingException>(() => dataObject.GetTargetValue <string>()); Assert.That(exception, Is.Not.Null); Assert.That(exception.Message, Is.Not.Null); Assert.That(exception.Message, Is.Not.Empty); Assert.That(exception.Message, Is.StringStarting(Resource.GetExceptionMessage(ExceptionMessage.UnableToMapValueForField, dataObject.GetSourceValue <string>(), fieldMock.NameTarget, tableMock.NameTarget, string.Empty))); var innerException = exception.InnerException; Assert.That(innerException, Is.Not.Null); Assert.That(innerException, Is.TypeOf <DeliveryEngineMappingException>()); Assert.That(innerException.Message, Is.Not.Null); Assert.That(innerException.Message, Is.Not.Empty); fieldMock.AssertWasCalled(m => m.NameTarget); tableMock.AssertWasCalled(m => m.NameTarget); }
// ... protected override void OnDrawNode(DrawTreeNodeEventArgs e) { if (e.Node.Tag != null) { if (e.Node.Tag.GetType() == typeof(MyDataObject)) { MyDataObject data = (MyDataObject)e.Node.Tag; e.Node.Name = data.Number + ". " + data.Name; } } }
public void TestThatConstructorInitializeAnDataObject() { var fieldMock = MockRepository.GenerateMock <IField>(); Assert.That(fieldMock, Is.Not.Null); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); Assert.That(dataObject.Field, Is.Not.Null); Assert.That(dataObject.Field, Is.EqualTo(fieldMock)); }
public void TestThatUpdateSourceValueThrowsNotSupportedException() { var fieldMock = MockRepository.GenerateMock <IField>(); Assert.That(fieldMock, Is.Not.Null); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); Assert.Throws <NotSupportedException>(() => dataObject.UpdateSourceValue <object>(null)); }
public static void Add <T>(T data) where T : class { var dataFormat = GetDataFormat(typeof(T)); var mdo = new MyDataObject(dataFormat, data); try { Clipboard.SetDataObject(mdo, false); } catch (ExternalException) { return; } weakRefMyDataObject = new WeakReference(mdo); }
public void TestThatCloneThrowsNotSupportedException() { var fieldMock = MockRepository.GenerateMock <IField>(); Assert.That(fieldMock, Is.Not.Null); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); // ReSharper disable ReturnValueOfPureMethodIsNotUsed Assert.Throws <NotSupportedException>(() => dataObject.Clone()); // ReSharper restore ReturnValueOfPureMethodIsNotUsed }
public void TestThatGetSourceValueGetsSourceValue() { var fieldMock = MockRepository.GenerateMock <IField>(); Assert.That(fieldMock, Is.Not.Null); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); var sourceValue = dataObject.GetSourceValue <string>(); Assert.That(sourceValue, Is.Not.Null); Assert.That(sourceValue, Is.Not.Empty); }
public void LoadPoint() { IReadMapper<MyDataObject, MyTable> mapper = new ReadMapBuilder<MyDataObject, MyTable>(MyTable.Instance) .Map(dObj => dObj.Id, t => t.Id) .Map(dObj => dObj.Location, MyDataObject.ReadGeoPoint, t => t.Longitude, t => t.Lotitude) .Compile(); DataReaderCap reader = new DataReaderCap(new object[] {(int)123, 0.5d, 0.2d}); MyDataObject model = new MyDataObject(); mapper.LoadInstance(reader, model); Assert.IsNotNull(model.Location); Assert.AreEqual(0.5d, model.Location.Value.Longitude); Assert.AreEqual(0.2d, model.Location.Value.Lotitude); }
public void TestThatGetTargetValueForUnmappedValueThrowsDeliveryEngineSystemExceptionIfParseFails() { var fixture = new Fixture(); var tableMock = MockRepository.GenerateMock <ITable>(); tableMock.Expect(m => m.NameTarget) .Return(fixture.CreateAnonymous <string>()) .Repeat.Any(); var fieldMock = MockRepository.GenerateMock <IField>(); fieldMock.Expect(m => m.NameTarget) .Return(fixture.CreateAnonymous <string>()) .Repeat.Any(); fieldMock.Expect(m => m.Table) .Return(tableMock) .Repeat.Any(); fieldMock.Expect(m => m.DatatypeOfSource) .Return(typeof(string)) .Repeat.Any(); fieldMock.Expect(m => m.Map) .Return(null) .Repeat.Any(); Assert.That(fieldMock, Is.Not.Null); var dataObject = new MyDataObject(fieldMock, fixture); Assert.That(dataObject, Is.Not.Null); var exception = Assert.Throws <DeliveryEngineSystemException>(() => dataObject.GetTargetValue <int?>()); Assert.That(exception, Is.Not.Null); Assert.That(exception.Message, Is.Not.Null); Assert.That(exception.Message, Is.Not.Empty); Assert.That(exception.InnerException, Is.Not.Null); fieldMock.AssertWasCalled(m => m.DatatypeOfSource); fieldMock.AssertWasCalled(m => m.Map); fieldMock.AssertWasCalled(m => m.NameTarget); tableMock.AssertWasCalled(m => m.NameTarget); }
private void ShowGrid() { List <MyDataObject> list = new List <MyDataObject>(); MyDataObject myDataObject = new MyDataObject(); Template template; int bmpWidth = 600; int bmpHeight = 200; for (int i = 0; i < RowCount; i++) { Bitmap temp = new Bitmap(bmpWidth, bmpHeight); Graphics gp = Graphics.FromImage(temp); template = samples[i]; var rect = new System.Drawing.Rectangle(0, 0, (bmpWidth - 24) / 2, bmpHeight); rect.Inflate(-20, -20); System.Drawing.Rectangle boundRect = template.contour.SourceBoundingRect; float k1 = 1f * rect.Width / boundRect.Width; float k2 = 1f * rect.Height / boundRect.Height; float k = Math.Min(k1, k2); //绘制bmp的指定部分,就是将那一块轮廓分割出来 gp.DrawImage(bmp, new System.Drawing.Rectangle(rect.X, rect.Y, (int)(boundRect.Width * k), (int)(boundRect.Height * k)), boundRect, GraphicsUnit.Pixel); System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(0, 0, bmpWidth, bmpHeight); template.Draw(gp, rectangle); list.Add(new MyDataObject() { Number = i, image = ConvertBitmap(temp) }); } this.dgvContours.ItemsSource = list; //dgvContours.ItemsSource = dt.DefaultView; dgvContours.GridLinesVisibility = DataGridGridLinesVisibility.All; }
public void Test() { IReadMapper<MyDataObject, MyTable> mapper = new ReadMapBuilder<MyDataObject, MyTable>(MyTable.Instance) .Map(dObj => dObj.Id, t => t.Id) .Map(dObj => dObj.Name, t => t.Name) .Map(dObj => dObj.Rooms, t => t.Rooms) .Map(dObj => dObj.Verify, t => t.Verify) .Compile(); DataReaderCap reader = new DataReaderCap(new object[] {(int)123, "text Name", null, true}); MyDataObject model = new MyDataObject(); mapper.LoadInstance(reader, model); Assert.AreEqual(123, model.Id); Assert.AreEqual("text Name", model.Name); Assert.IsNull(model.Rooms); Assert.IsTrue(model.Verify); }
public void ShowDataViewItemMenus(MyDataObject dataObject, List <DataReportMenu> menus) { RadRadialMenu menu = new RadRadialMenu(); //menu.ShowEventName = "MouseEnter"; //menu.HideEventName = "MouseLeave"; foreach (var item in menus) { AddMenu(menu.Items, item); } menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; //(dataViewItem as UC_DataViewItem).SetMenu(menu); RadRadialMenu.SetRadialContextMenu(this, menu); RadialMenuCommands.Show.Execute(null, this); menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; menu.IsOpen = true; menu.PopupPlacement = System.Windows.Controls.Primitives.PlacementMode.Center; //menu.PopupHorizontalOffset = 115; //menu.PopupVerticalOffset = 5; }
private void AddData_SwitchValueOf15_ShouldAddToStorageTwo() { // Mock the repository then add it to the service Mock <IRepository> mockRepository = new Mock <IRepository>(); MyService service = new MyService { Repository = mockRepository }; MyDataObject myDataObject = new MyDataObject(); // Assign some data to myDataObject // This should insert myDataObject into StorageTwo service.AddData(myDataObject, 15); // Check that the correct method was called once, with our parameter mockRepository.Verify(r => r.AddToStorageTwo(myDataObject), Times.Once()); // Check that the other methods were never called, with any input mockRepository.Verify(r => r.AddToStorageOne(It.IsAny <MyDataObject>()), Times.Never()); mockRepository.Verify(r => r.AddToStorageThree(It.IsAny <MyDataObject>()), Times.Never()); }
public async void AsyncWrite_UpdateViaPrimaryKey() { var path = "/path/to/some/item"; MyDataObject obj = null; _realm.Write(() => { obj = _realm.CreateObject <MyDataObject>(); obj.Path = path; }); await _realm.WriteAsync(realm => { var dataObj = realm.Find <MyDataObject>(path); dataObj.ExpensiveToComputeValue = 123; // imagine this was a very CPU-intensive operation }); // see #564 TestHelpers.RunEventLoop(); Assert.That(obj.ExpensiveToComputeValue, Is.Not.Null); }
public async void AsyncWrite_UpdateViaObjectId() { var path = "/path/to/some/item"; MyDataObject obj = null; _realm.Write(() => { obj = _realm.CreateObject <MyDataObject>(); obj.Path = path; }); await _realm.WriteAsync(realm => { var dataObj = realm.All <MyDataObject>().Single(d => d.Path == path); dataObj.ExpensiveToComputeValue = 123; // imagine this was a very CPU-intensive operation }); // see #564 TestHelpers.RunEventLoop(TimeSpan.FromMilliseconds(100)); Assert.That(obj.ExpensiveToComputeValue, Is.Not.Null); }
// Split the series of null terminated strings back up into an array of strings. static string[] UtilGetFilesFromPROJITEMDrop(IntPtr hDropInfo) { string[] result = null; IntPtr data = MyDataObject.GlobalLock(hDropInfo); try { _DROPFILES df = (_DROPFILES)Marshal.PtrToStructure(data, typeof(_DROPFILES)); if (df.fWide != 0)// unicode? { IntPtr pdata = new IntPtr((long)data + df.pFiles); string s = Marshal.PtrToStringUni(pdata); ArrayList list = new ArrayList(); int pos = 0; int i = 0; int len = s.Length; for (; i < len; i++) { if (s[i] == '\0') { if (i == len - 1 || s[i + 1] == '\0') { break; } list.Add(s.Substring(pos, i - 1)); pos = i + 1; } } if (i > pos) { list.Add(s.Substring(pos, i)); } result = (String[])list.ToArray(typeof(string)); } } catch { } MyDataObject.GlobalUnLock(data); return(result); }
public void TestThatGetTargetValueGetsUnmappedTargetValueWhereDatatypeOfSourceIsNotEqualToTypeOfTargetValueAndTypeOfTargetValueIsNotString() { var fieldMock = MockRepository.GenerateMock <IField>(); fieldMock.Expect(m => m.DatatypeOfSource) .Return(typeof(int)) .Repeat.Any(); fieldMock.Expect(m => m.Map) .Return(null) .Repeat.Any(); Assert.That(fieldMock, Is.Not.Null); var dataObject = new MyDataObject(fieldMock, new Fixture()); Assert.That(dataObject, Is.Not.Null); var targetValue = dataObject.GetTargetValue <decimal>(); Assert.That(targetValue, Is.GreaterThan(0M)); fieldMock.AssertWasCalled(m => m.DatatypeOfSource); fieldMock.AssertWasCalled(m => m.Map); }
public void AsyncWrite_UpdateViaPrimaryKey() { AsyncContext.Run(async delegate { var path = "/path/to/some/item"; MyDataObject obj = null; _realm.Write(() => { obj = _realm.Add(new MyDataObject { Path = path }); }); await _realm.WriteAsync(realm => { var dataObj = realm.Find <MyDataObject>(path); dataObj.ExpensiveToComputeValue = 123; // imagine this was a very CPU-intensive operation }); await Task.Yield(); Assert.That(obj.ExpensiveToComputeValue, Is.Not.Null); }); }
static void TestJson2(MySqlConnection conn) { new MySqlCommand("drop table if exists facts", conn).ExecuteNonQuery(); new MySqlCommand(" CREATE TABLE facts (sentence JSON)", conn).ExecuteNonQuery(); //-------------- //new MySqlCommand("INSERT INTO facts VALUES (JSON_OBJECT('mascot', 'Our mascot is a dolphin named \"Sakila\".'))", conn).ExecuteNonQuery(); //from https://dev.mysql.com/doc/refman/5.7/en/json.html //mysql> INSERT INTO facts VALUES //> ('{"mascot": "Our mascot is a dolphin named \\"Sakila\\"."}'); //C#, note that \=> \\ ,"=> \" //so ... MyDataObject mascot1 = new MyDataObject { mascot = "Our mascot is a dolphin named \"A\"" }; var options = new JsonSerializerOptions { //SOME WARNING: https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to?view=netcore-3.1#customize-character-encoding Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; //original //new MySqlCommand("INSERT INTO facts VALUES ('{\"mascot\": \"Our mascot is a dolphin named \\\\\"A\\\\\"\"}')", conn).ExecuteNonQuery(); //---------------------- { string json_str = TestSet_JsonHelper.EscapeMore(JsonSerializer.Serialize(mascot1, options)); //1. insert new MySqlCommand($"INSERT INTO facts VALUES ('{json_str}')", conn).ExecuteNonQuery(); //2. var cmd = new MySqlCommand("SELECT sentence FROM facts", conn); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { string data = reader.GetString(0); System.Diagnostics.Debug.WriteLine(data); var my_obj = JsonSerializer.Deserialize <MyDataObject>(data); } reader.Close(); } //---------------------- { //1. insert var cmd = new MySqlCommand("INSERT INTO facts VALUES (?data)", conn); cmd.Parameters.AddWithJsonString("?data", mascot1); cmd.ExecuteNonQuery(); //2. select var cmd2 = new MySqlCommand("SELECT sentence FROM facts", conn); MySqlDataReader reader = cmd2.ExecuteReader(); while (reader.Read()) { // string data = reader.GetString(0); System.Diagnostics.Debug.WriteLine(data); //read object //1. var my_obj = JsonSerializer.Deserialize <MyDataObject>(data); //2. var my_obj1 = reader.GetObjectFromJson <MyDataObject>(0); //3. reader.GetObjectFromJson(0, out MyDataObject my_obj2); } reader.Close(); } }
public SelectableDataObject(MyDataObject obj) { this.DataObject = obj; }
MyDataObjectProxy(MyDataObject model) { _model = model; _editedStartDate = model.StartDate; _editedEndDate = model.EndDate; }
public void BringIntoView(MyDataObject defaultDataReportItem) { }
private void HandleDataChange(object sender, MyDataObject dataObj) { //Do your data validation or persistence in this method; if it fails, //throw a descriptive exception, which will prevent Form1 from closing. }
private void RelationshipSubMenu_MenuClicked(object sender, EventArgs e, RelationshipMenu rel, MyDataObject DataReportItem, DP_SearchRepository searchRepository) { //if (rel.Item1 == DataReportRelationshipType.Relationship) //{ //var searchRepository = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipManager.GetSearchDataItemByRelationship(DataReportItem.DataItem, rel.Item2, AgentUICoreMediator.GetAgentUICoreMediator.GetRequester()); if (RelatedDataReportArearequested != null) { RelatedDataReportArearequested(this, new DataReportAreaRequestedArg() { EntitiyID = rel.EntityID, Relationship = rel.Relationship, RelationshipTail = rel.EntityRelationshipTail, Title = rel.EntityName, SourceDataReportItem = DataReportItem, SearchRepository = searchRepository }); } //} }
private void SetRelationshipMenus(List <DataReportMenu> result, MyDataObject DataReportItem) {//با فرم ویو یک فانکشن شود List <RelationshipMenu> listRelationships = new List <RelationshipMenu>(); if (EntityDataView != null && EntityDataView.EntityDataViewRelationships.Any()) { foreach (var rel in EntityDataView.EntityDataViewRelationships) { //if (rel.RelationshipID != 0) //{ // var relationship = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipManager.GetRelationship(rel.RelationshipID); // var relationshipMenu = new RelationshipMenu(relationship, relationship.EntityID2 // , relationship.Entity2, relationship.Alias, rel.Group1, rel.Group2); // listRelationships.Add(relationshipMenu); //} if (rel.RelationshipTailID != 0) { var relationshipTail = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipManager.GetRelationshipTail(rel.RelationshipTailID, false); var relationshipMenu = new RelationshipMenu(relationshipTail, relationshipTail.TargetEntityID , relationshipTail.TargetEntityAlias, relationshipTail.EntityPath, rel.Group1, rel.Group2); listRelationships.Add(relationshipMenu); } } } else { //var allRelationships = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipManager.GetRelationshipsByEntityID(DataReportItem.DataItem.TargetEntityID); var allRelationships = Entity.Relationships; foreach (var relationship in allRelationships) { var relationshipMenu = new RelationshipMenu(relationship, relationship.EntityID2 , relationship.Entity2, relationship.Alias, "", ""); listRelationships.Add(relationshipMenu); } var allRelationshipTails = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipManager.GetRelationshipTails(DataReportItem.DataItem.TargetEntityID); foreach (var relationshipTail in allRelationshipTails) { var relationshipMenu = new RelationshipMenu(relationshipTail, relationshipTail.TargetEntityID , relationshipTail.TargetEntityAlias, relationshipTail.EntityPath, "", ""); listRelationships.Add(relationshipMenu); } } foreach (var rel in listRelationships) { if (rel.RelType == DataReportRelationshipType.Relationship) { if (AreaInitializer.CausingRelationship == null || AreaInitializer.CausingRelationship.PairRelationshipID != rel.Relationship.ID) { var searchRepository = AgentUICoreMediator.GetAgentUICoreMediator.RelationshipDataManager.GetSearchDataItemByRelationship(RelationshipSreachType.SecondSideBasedOnFirstRelationshhipColumn, DataReportItem.DataItem, rel.Relationship.ID); if (searchRepository != null) { var requester = AgentUICoreMediator.GetAgentUICoreMediator.GetRequester(); //سکوریتی داده اعمال میشود var existsRequest = new DR_SearchExistsRequest(requester); existsRequest.EntityID = rel.EntityID; existsRequest.SearchDataItems = searchRepository; var exists = AgentUICoreMediator.GetAgentUICoreMediator.requestRegistration.SendSearchExistsRequest(existsRequest); if (exists.ExistsResult) { rel.SearchRepository = searchRepository; rel.IsValid = true; } } } } } var validRelationships = listRelationships.Where(x => x.IsValid); if (validRelationships.Any()) { var relationshipMenu = new DataReportMenu(); relationshipMenu.Title = "روابط"; relationshipMenu.Type = DataReportMenuType.Relationship; result.Add(relationshipMenu); if (EntityDataView == null || !EntityDataView.EntityDataViewRelationships.Any()) { if (validRelationships.Count() > 8) { int index = 1; foreach (var item in validRelationships) { var cIndex = index / 5; item.Group1 = "Group" + (cIndex + 1); index++; } } } foreach (var item in validRelationships.GroupBy(x => new { x.Group1, x.Group2 })) { List <DataReportMenu> parentCollection = null; if (string.IsNullOrEmpty(item.Key.Group1)) { parentCollection = relationshipMenu.SubMenus; } else { DataReportMenu menuLevel1 = GetOrCreateMenu1(relationshipMenu.SubMenus, item.Key.Group1); parentCollection = menuLevel1.SubMenus; } if (string.IsNullOrEmpty(item.Key.Group2)) { // parentCollection = parentCollection; } else { DataReportMenu menuLevel2 = GetOrCreateMenu1(parentCollection, item.Key.Group2); parentCollection = menuLevel2.SubMenus; } foreach (var rel in item) { var relationshipSubMenu = new DataReportMenu(); relationshipSubMenu.Title = rel.EntityName; relationshipSubMenu.Tooltip = rel.Tooltip; relationshipSubMenu.MenuClicked += (sender, e) => RelationshipSubMenu_MenuClicked(sender, e, rel, DataReportItem, rel.SearchRepository); parentCollection.Add(relationshipSubMenu); } } } }