-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass1.cs
More file actions
113 lines (112 loc) · 3.64 KB
/
Copy pathClass1.cs
File metadata and controls
113 lines (112 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// using Ascon.Pilot.ProjectionsRepository;
// using Ascon.Pilot.ClientCore.Search;
// using System.Linq;
// using System.Collections.Generic;
// using Ascon.Pilot.Core;
// using Ascon.Pilot.DataClasses;
// using Ascon.Pilot.Client.Search;
// using Ascon.Pilot.Common.Search;
// using Ascon.Pilot.Pilot.Reports;
// using DevExpress.XtraReports.Parameters;
//
// ReportContext _context = new ReportContext();
//
// private void PilotReport_DataSourceDemanded(object sender, EventArgs e)
// {
// MessagesDetailReport.DataMember = "Messages";
//
// LongRunning.Start(this, () =>
// {
// var project = Parameters["Project"].Value as RObject;
// if (project == null)
// throw new ReportException("Проект не выбран");
//
// if (project.Type.Name == SystemTypes.SHORTCUT)
// {
// project = GetRealObject(project);
// Parameters["Project"].Value = project;
// }
//
// var documentTypes = _context.GetTypes().Where(x => x.HasFiles).Select(x => x.Id).ToArray();
// var objectsBuilder = QueryBuilder.CreateObjectQueryBuilder();
// objectsBuilder.Must(ObjectFields.TypeId.BeAnyOf(documentTypes));
// var documents = _context.GetObjects(objectsBuilder, project.Id)
// .Select(x => ToReportDocument(x))
// .Where(x => x != null)
// .ToList();
// DataSource = documents;
// });
// }
//
// private RObject GetRealObject(RObject shortCutObj)
// {
// object idValue;
// Guid realObjId;
// shortCutObj.Attributes.TryGetValue(SystemAttributes.SHORTCUT_OBJECT_ID, out idValue);
// if (Guid.TryParse(idValue.ToString(), out realObjId))
// {
// var realObj = _context.GetObject(realObjId);
// if (!realObj.IsInRecycleBin)
// return realObj;
// }
//
// throw new ReportException(
// "Не удалось получить проект, на который ссылается ярлык. Возможно проект находится в корзине.");
// }
//
// private ReportDocument ToReportDocument(RObject obj)
// {
// var document = new ReportDocument
// {
// Title = GetTitle(obj),
// ParentId = obj.Parent.Id,
// ParentTitle = GetTitle(obj.Parent)
// };
// var messages = _context.LoadMessages(obj.Id, DateTime.MinValue, DateTime.MaxValue, int.MaxValue);
//
// foreach (var chatMessage in messages)
// if (chatMessage.Type == (int)RMessageType.TextMessage)
// document.Messages.Add(ToReportMessage(chatMessage));
//
// return document;
// }
//
// private ReportMessage ToReportMessage(RChatMessage message)
// {
// var textEditHistory = message.RelatedMessages
// .Where(x => x.Type == (int)RMessageType.EditTextMessage)
// .OrderBy(x => x.Date);
//
// return new ReportMessage
// {
// UserName = message.Creator.DisplayName,
// Date = message.Date,
// Text = textEditHistory.Any() ? textEditHistory.Last().Text : message.Text
// };
// }
//
// public class ReportDocument
// {
// public ReportDocument()
// {
// Messages = new List<ReportMessage>();
// }
//
// public string Title { get; set; }
// public Guid ParentId { get; set; }
// public string ParentTitle { get; set; }
// public List<ReportMessage> Messages { get; set; }
// }
//
// public class ReportMessage
// {
// public string UserName { get; set; }
// public DateTime Date { get; set; }
// public string Text { get; set; }
// }
//
//
// private string GetTitle(RObject obj)
// {
// return string.Format("{0}({1})", obj.Title, obj.Type.Title);
// }