本文整理汇总了C#中Report.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Report.GetType方法的具体用法?C# Report.GetType怎么用?C# Report.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Report
的用法示例。
在下文中一共展示了Report.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAsSharedFrom
public decimal CreateAsSharedFrom(Report parentReport , Report.SharingEnum subscriberSharing)
{
if(this.Owner==parentReport.Owner)
throw new Exception("Cannot share to same user");
parentReport.LoadHeader();
if(subscriberSharing==Report.SharingEnum.None)
throw new Exception("Wrong sharing option");
if(parentReport.SharingStatus!=Report.SharingEnum.None)
throw new Exception("Shared report cannot be source of other shared report");
decimal newReportId=0;
System.Type reportType=parentReport.GetType();
// ----------------------------------------
if(reportType==typeof(OlapReport))
{
FI.DataAccess.OlapReports dacObj=DataAccessFactory.Instance.GetOlapReportsDA();
newReportId=dacObj.CreateSharedReport(parentReport.ID, this.Owner.ID, (int)subscriberSharing );
}
else if(reportType==typeof(StorecheckReport))
{
FI.DataAccess.StorecheckReports dacObj=DataAccessFactory.Instance.GetStorecheckReportsDA();
newReportId=dacObj.CreateSharedReport(parentReport.ID , this.Owner.ID, (int)subscriberSharing );
}
else if(reportType==typeof(CustomSqlReport))
{
FI.DataAccess.CustomSqlReports dacObj=DataAccessFactory.Instance.GetCustomSqlReportsDA();
newReportId=dacObj.CreateSharedReport(parentReport.ID , this.Owner.ID, (int)subscriberSharing );
}
else if(reportType==typeof(CustomMdxReport))
{
FI.DataAccess.CustomMdxReports dacObj=DataAccessFactory.Instance.GetCustomMdxReportsDA();
newReportId=dacObj.CreateSharedReport(parentReport.ID , this.Owner.ID, (int)subscriberSharing );
}
// ----------------------------------------
// update max
if( ((int)parentReport._maxSubscriberSharing)<((int)subscriberSharing))
parentReport._maxSubscriberSharing=subscriberSharing;
return newReportId;
}
示例2: SendReport
public void SendReport(Report report , Contact[] contacts , Report.ExportFormat Format, DateTime getCachedFrom, out bool isFromCache)
{
isFromCache=false;
if(report.IsProxy)
throw new Exception("Report cannot be Proxy");
if(contacts.Length==0)
return;
string fileNamePattern=report.GetType().Name + "_" + report.ID.ToString() + "_";
string fileName=fileNamePattern + DateTime.Now.ToString("yyyyMMddHHmmss") + "." + Format.ToString();
string cacheLookupFileName=fileNamePattern + getCachedFrom.ToString("yyyyMMddHHmmss") + "." + Format.ToString();
string filePath=null;
string reportString=null;
// lookup cached report
string[] lookupPaths=Directory.GetFiles(FI.Common.AppConfig.TempDir, fileNamePattern + "*." + Format.ToString());
if(lookupPaths!=null)
{
foreach(string path in lookupPaths)
{
string file=Path.GetFileName(path);
if(file.Length==cacheLookupFileName.Length && file.CompareTo(cacheLookupFileName)>0)
{
filePath=FI.Common.AppConfig.TempDir+ @"\" + file;
isFromCache=true;
break;
}
}
}
if(filePath==null)
{
filePath=FI.Common.AppConfig.TempDir+ @"\" + fileName;
report.Export(filePath, Format);
}
foreach(Contact cnt in contacts)
{
if(Format==Report.ExportFormat.HTML && reportString==null)
{
if(cnt.DistributionFormat==Contact.DistributionFormatEnum.MessageBody || cnt.DistributionFormat==Contact.DistributionFormatEnum.Body_And_Attachment)
{
StreamReader sr=new StreamReader(filePath, System.Text.Encoding.Unicode, true);
if(sr!=null)
{
reportString=sr.ReadToEnd();
sr.Close();
}
}
}
//send via email
try
{
if(cnt.IsProxy)
cnt.Fetch();
// message object
OpenSmtp.Mail.MailMessage msg=new OpenSmtp.Mail.MailMessage();
msg.From=new OpenSmtp.Mail.EmailAddress(FI.Common.AppConfig.SmtpSender);
msg.To.Add(new OpenSmtp.Mail.EmailAddress(cnt.EMail));
msg.Subject=report.Name + " (" + report.Description + ")";
// attachment if ordered or report is not html
if(cnt.DistributionFormat==Contact.DistributionFormatEnum.Attachment ||
cnt.DistributionFormat==Contact.DistributionFormatEnum.Body_And_Attachment ||
Format!=Report.ExportFormat.HTML)
{
OpenSmtp.Mail.Attachment att=new OpenSmtp.Mail.Attachment(filePath);
//att.Encoding=System.Web.Mail.MailEncoding.UUEncode;
msg.Attachments.Add(att);
}
// message body (if retport is html)
if(Format==Report.ExportFormat.HTML &&
(cnt.DistributionFormat==Contact.DistributionFormatEnum.MessageBody ||
cnt.DistributionFormat==Contact.DistributionFormatEnum.Body_And_Attachment))
{
msg.HtmlBody=reportString;
}
// msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "0"); //This is crucial. put 0 there
// msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 90);
OpenSmtp.Mail.SmtpConfig.LogToText=false;
OpenSmtp.Mail.Smtp smtp=new OpenSmtp.Mail.Smtp();
smtp.SendTimeout=600;
smtp.Host=FI.Common.AppConfig.SmtpServer;
if(FI.Common.AppConfig.SmtpUserName!=null && FI.Common.AppConfig.SmtpUserName!="")
{
smtp.Username=FI.Common.AppConfig.SmtpUserName;
smtp.Password=FI.Common.AppConfig.SmtpPassword;
}
smtp.SendMail(msg);
// System.Web.Mail.SmtpMail.SmtpServer=FI.Common.AppConfig.SmtpServer;
// System.Web.Mail.SmtpMail.Send(msg);
}
catch(Exception exc)
//.........这里部分代码省略.........
示例3: GetUsersWithChildReports
public FI.Common.Data.FIDataTable GetUsersWithChildReports(Report ParentReport)
{
FI.Common.Data.FIDataTable table=null;
if(ParentReport.GetType()==typeof(OlapReport))
{
FI.DataAccess.OlapReports dacObj=DataAccessFactory.Instance.GetOlapReportsDA();
table=dacObj.ReadUsersWithChildReports(ParentReport.ID , this.GetReportTypeCode(ParentReport.GetType()));
}
else if(ParentReport.GetType()==typeof(StorecheckReport))
{
FI.DataAccess.StorecheckReports dacObj=DataAccessFactory.Instance.GetStorecheckReportsDA();
table=dacObj.ReadUsersWithChildReports(ParentReport.ID , this.GetReportTypeCode(ParentReport.GetType()));
}
else if(ParentReport.GetType()==typeof(CustomSqlReport))
{
FI.DataAccess.CustomSqlReports dacObj=DataAccessFactory.Instance.GetCustomSqlReportsDA();
table=dacObj.ReadUsersWithChildReports(ParentReport.ID , this.GetReportTypeCode(ParentReport.GetType()));
}
else if(ParentReport.GetType()==typeof(CustomMdxReport))
{
FI.DataAccess.CustomMdxReports dacObj=DataAccessFactory.Instance.GetCustomMdxReportsDA();
table=dacObj.ReadUsersWithChildReports(ParentReport.ID , this.GetReportTypeCode(ParentReport.GetType()));
}
else
{
throw new NotSupportedException();
}
return table;
}
示例4: DeleteSharedReport
public void DeleteSharedReport(Report parentReport, Report childReport)
{
System.Type reportType=childReport.GetType();
if(parentReport.GetType()!=reportType)
throw new Exception("Parent and child report type mismatch");
short maxSurscriberSharing=0;
// delete child report states
childReport._DeleteStates();
// ----------------------------------------
if(reportType==typeof(OlapReport))
{
FI.DataAccess.OlapReports dacObj=DataAccessFactory.Instance.GetOlapReportsDA();
dacObj.DeleteSharedReport(parentReport.ID , childReport.ID, ref maxSurscriberSharing);
}
else if(reportType==typeof(StorecheckReport))
{
FI.DataAccess.StorecheckReports dacObj=DataAccessFactory.Instance.GetStorecheckReportsDA();
dacObj.DeleteSharedReport(parentReport.ID , childReport.ID, ref maxSurscriberSharing);
}
else if(reportType==typeof(CustomSqlReport))
{
FI.DataAccess.CustomSqlReports dacObj=DataAccessFactory.Instance.GetCustomSqlReportsDA();
dacObj.DeleteSharedReport(parentReport.ID , childReport.ID, ref maxSurscriberSharing);
}
else if(reportType==typeof(CustomMdxReport))
{
FI.DataAccess.CustomMdxReports dacObj=DataAccessFactory.Instance.GetCustomMdxReportsDA();
dacObj.DeleteSharedReport(parentReport.ID , childReport.ID, ref maxSurscriberSharing);
}
else
throw new NotSupportedException();
// ----------------------------------------
childReport._sharing=Report.SharingEnum.None;
parentReport._maxSubscriberSharing=(Report.SharingEnum)maxSurscriberSharing;
}
示例5: IsDBUpdated
private void IsDBUpdated()
{
if (Session["ReportsDatabaseIsOutdated"] == null
|| ((bool)Session["ReportsDatabaseIsOutdated"]))
{
Report objReport = new Report();
var filtersSummaryProperty = objReport.GetType().GetProperty("FiltersSummary");
if (filtersSummaryProperty == null)
{
pnlFilter.Enabled = false;
string noteMsg = "You can't use Report Filters. Please, contact your administrator to update the database.";
pnlFilter.ToolTip = noteMsg;
Session["ReportsDatabaseIsOutdated"] = true;
ucResultMsgBar.ShowResultMsg(false, noteMsg);
}else
Session["ReportsDatabaseIsOutdated"] = false;
}
}
示例6: ConvertToDataSet
// SchemaQuery.Report to System.Data.DataSet convertor
// Method written by SAP employee for some reason not included in Afaria API, let's not touch this
public static DataSet ConvertToDataSet(Report report)
{
DataSet dataSet = new DataSet();
if (report != null)
{
if (report.GetType() == typeof(ReportDefault))
{
ReportDefault reportDefault = (ReportDefault)report;
List<object> rowValue = new List<object>();
DataTable dataTable;
if (reportDefault.Tables != null)
{
foreach (ReportTable reportTable in reportDefault.Tables)
{
dataTable = new DataTable(reportTable.Name);
if (reportTable.Columns != null)
{
foreach (ReportColumn column in reportTable.Columns)
{
switch (column.DataType)
{
case ReportDataType.Binary:
dataTable.Columns.Add(column.Name, typeof(Byte[]));
break;
case ReportDataType.Boolean:
dataTable.Columns.Add(column.Name, typeof(Boolean));
break;
case ReportDataType.Byte:
dataTable.Columns.Add(column.Name, typeof(Byte));
break;
case ReportDataType.Guid:
dataTable.Columns.Add(column.Name, typeof(Guid));
break;
case ReportDataType.DateTime:
dataTable.Columns.Add(column.Name, typeof(DateTime));
break;
case ReportDataType.DateTimeOffset:
dataTable.Columns.Add(column.Name, typeof(DateTimeOffset));
break;
case ReportDataType.Decimal:
dataTable.Columns.Add(column.Name, typeof(Decimal));
break;
case ReportDataType.Float:
dataTable.Columns.Add(column.Name, typeof(Double));
break;
case ReportDataType.Integer:
dataTable.Columns.Add(column.Name, typeof(Int64));
break;
case ReportDataType.String:
dataTable.Columns.Add(column.Name, typeof(String));
break;
case ReportDataType.TimeSpan:
dataTable.Columns.Add(column.Name, typeof(TimeSpan));
break;
case ReportDataType.UnsignedInteger:
dataTable.Columns.Add(column.Name, typeof(UInt64));
break;
case ReportDataType.Unknown:
default:
throw new Exception("Unexpected data type");
}
if (!string.IsNullOrWhiteSpace(column.QualifiedName))
{
if (!dataTable.ExtendedProperties.Contains(column.Name))
{
dataTable.ExtendedProperties.Add(column.Name, column.QualifiedName);
}
}
}
foreach (ReportRow row in reportTable.Rows)
{
rowValue.Clear();
foreach (ReportData data in row.Data)
{
if (data != null)
{
if (data.GetType() == typeof(ReportBinary))
{
rowValue.Add(((ReportBinary)data).Value);
}
else if (data.GetType() == typeof(ReportBoolean))
{
rowValue.Add(((ReportBoolean)data).Value);
}
else if (data.GetType() == typeof(ReportByte))
{
rowValue.Add(((ReportByte)data).Value);
}
else if (data.GetType() == typeof(ReportDateTime))
{
rowValue.Add(((ReportDateTime)data).Value);
}
else if (data.GetType() == typeof(ReportDateTimeOffset))
{
//.........这里部分代码省略.........
示例7: GetEditableRoot
//public static TypeServiceProxy GetTypeServiceInstance(string baseAddress)
//{
// if (_typeServiceClient == null)
// {
// _typeServiceClient = new TypeServiceProxy(GetNewBinding(baseAddress), GetEndpointAddress(baseAddress, TypeServiceName));
// foreach (OperationDescription op in _typeServiceClient.ChannelFactory.Endpoint.Contract.Operations)
// {
// var dataContractBehavior = op.Behaviors[typeof(DataContractSerializerOperationBehavior)] as DataContractSerializerOperationBehavior;
// if (dataContractBehavior != null)
// dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue;
// }
// _typeServiceClient.ChannelFactory.Open();
// }
// return _typeServiceClient;
//}
//public static ShellServiceProxy GetShellServiceInstance(string baseAddress)
//{
// if (_shellServiceClient == null)
// {
// _shellServiceClient = new ShellServiceProxy(GetNewBinding(baseAddress), GetEndpointAddress(baseAddress, ShellServiceName));
// _shellServiceClient.ChannelFactory.Open();
// }
// return _shellServiceClient;
//}
//public static ReportBuilderServiceProxy GetReportBuilderServiceInstance(string baseAddress)
//{
// if (_reportBuilderServiceClient == null)
// {
// _reportBuilderServiceClient = new ReportBuilderServiceProxy(GetNewBinding(baseAddress), GetEndpointAddress(baseAddress, ReportBuilderServiceName));
// _reportBuilderServiceClient.ChannelFactory.Open();
// }
// return _reportBuilderServiceClient;
//}
#endregion
#region Private Helpers
#region GetEditableRoot
/// <summary>
/// Gets the editable root.
/// </summary>
/// <param name="currentReport">The current report.</param>
private void GetEditableRoot(Report currentReport)
{
if (currentReport.GetType().Name != "DetailEasyReportPortrait")
return;
SetIdentity(currentReport);
_item = TheDynamicTypeManager.GetEditableRoot<IEditableRoot>(_processName, _itemId);
}