本文整理汇总了C#中LocalReport.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# LocalReport.Refresh方法的具体用法?C# LocalReport.Refresh怎么用?C# LocalReport.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalReport
的用法示例。
在下文中一共展示了LocalReport.Refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostRaceInvoice
public HttpResponseMessage PostRaceInvoice(int raceId)
{
var party = context.RaceEntries.Where(x => x.RaceId == raceId);
var data = party.Select(x=>new{RaceName=x.Race.RaceName,
CyclistFirstName = x.Person.FirstName,
CyclistSurname = x.Person.Surname,
CyclistIdNumber = x.Person.IdNumber,
CyclistDistance = x.Race.RaceDistance,
CyclistRaceCost = x}).ToList();
var report = new LocalReport { ReportPath = @".\RaceInvoice.rdlc" };
report.DataSources.Add(
new ReportDataSource("RaceInvoice", data));
report.Refresh();
return Export(report, "PDF");
}
示例2: CreateReportExt
public void CreateReportExt()
{
LocalReport report = new LocalReport();
string mimeType, encoding, fileExtension;
string[] streams;
Warning[] warnings;
int year = Int32.Parse(Session["year"].ToString());
report.SubreportProcessing += new SubreportProcessingEventHandler(ItemsSubreportProcessingEventHandler);
string username = User.Identity.Name;
UserInfos userinfos = UserInfos.getUserInfos(username);
int fermaid = GetFermaId(userinfos.UserCod);
if (fermaid != 0)
{
string[] parIds = { "g", "p", "c", "l", "s", "h", "u", "n", "z" };
string[] chartLabelsName = { "Grasime (g/100g)", "Proteine (g/100g)", "Cazeina (g/100g)", "Lactoza (g/100g)", "SUN (g/100g)", "pH", "Uree (mg/dl)", "NCSx1000", "Cantitate lapte (l)" };
string[] chartTitles = { "Grasime", "Proteine", "Cazeina",
"Lactoza", "SUN", "Ph",
"Uree", "NCS","Cantitate lapte"};
string[] um = { "g/100g", "g/100g", "g/100g", "g/100g", "g/100g", "pH", "mg/dl", "NCSx1000", "l" };
//controale
ReportDataSource rdsm = new ReportDataSource();
rdsm.Name = "SampleAnalizeExt";
List<SampleAnalizeExt> samplesext = SampleAnalize.GetSampleAnalizeExt(fermaid,year);
rdsm.Value = samplesext;
report.DataSources.Clear();
report.DataSources.Add(rdsm);
report.ReportPath = "ControlsSummaryExt.rdlc";
string datatestare = "Data: " + DateTime.Now.ToString("dd/MM/yyyy");
// set reports parameters
string title = userinfos.NumeFerma + " - " + "Cod exploatatie " + userinfos.UserCod;
ReportParameter pCod = new ReportParameter("CodExpl", userinfos.UserCod);
ReportParameter pData = new ReportParameter("DataExec", datatestare);
// ReportParameter pChartTitle = new ReportParameter("ChartTitle", chartTitles[i]);
// ReportParameter pChartLabelsName = new ReportParameter("ChartLabelsName", chartLabelsName[i]);
// ReportParameter pUm = new ReportParameter("Um", um[i]);
ReportParameter pTitle = new ReportParameter("Title", title);
ReportParameter pUsername = new ReportParameter("UserName", username);
string baseurl = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + ConfigurationManager.AppSettings["baseurl"];
ReportParameter pBaseurl = new ReportParameter("BaseUrl", baseurl);
ReportParameter[] p = { pCod, pData,pTitle,pBaseurl,pUsername };
report.SetParameters(p);
report.Refresh();
// write xls
string httppath = ConfigurationManager.AppSettings["httppath"]+userinfos.AsocId+"/" + year +"/";
//"/Downloads/";
string filepath = ConfigurationManager.AppSettings["filepath"]+userinfos.AsocId+"\\" + year +"\\";
if (!Directory.Exists(filepath))
{
Directory.CreateDirectory(filepath);
}
//"D:\\portal\\Downloads\\";
string path_raport_http = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath;
string fileid = chartTitles[0];
string fermaname = replace_special_car_null(userinfos.NumeFerma);
string raport_excel = userinfos.UserCod + "_" + fermaname +".xls";
string excel_file = filepath + raport_excel;
string excel_link = path_raport_http + raport_excel;
byte[] xls_content = report.Render("EXCEL", deviceInfoXls, out mimeType, out encoding, out fileExtension, out streams, out warnings);
File.WriteAllBytes(excel_file, xls_content);
//rename sheets
List<SampleAnalize> samples = SampleAnalize.GetSampleAnalize(fermaid, "",year);
using (StreamReader input = new StreamReader(excel_file))
{
HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(input.BaseStream));
if (workbook != null && samples.Count >0)
{
for (int count=0; count < samples.Count; count++)
workbook.SetSheetName(count, samples[count].Nrcontrol);
for (int count = 0; count < chartTitles.Length; count++)
{
string sheetname = chartTitles[count].Replace(" ", "");
workbook.SetSheetName(count + samples.Count, "Grafic" + sheetname);
}
// workbook.SetSheetName(1, "Detaliu date");
WriteExcel(excel_file, workbook);
}
}
//
ContentPlaceHolder holder = (ContentPlaceHolder)Master.FindControl("MainContent");
HyperLink hyper = (HyperLink)holder.FindControl("xlslink" + parIds[0]);
hyper.Visible = true;
hyper.NavigateUrl = excel_link;
hyper.Text = raport_excel;
ErrorMessage.Text = "";
}//fermaid >0
else
{
// ErrorMessage.Text = "Nu exista date pentru codul "+ userinfos.UserCod;
//.........这里部分代码省略.........
示例3: CreateReportAll
//.........这里部分代码省略.........
sample.Val = sample.Solide; break;
case 5:
sample.Val = sample.Ph; break;
case 6:
sample.Val = sample.Urea; break;
case 7:
sample.Val = sample.Ncs; break;
case 8:
sample.Val = sample.Cantitate; break;
default: break;
}
sample.Val = Math.Round(sample.Val, 2);
}
// create samplescontrol from samples
// set reports datasource
rds.Value = samples;
report.DataSources.Clear();
report.DataSources.Add(rds);
//
ReportDataSource rdsc = new ReportDataSource();
rdsc.Name = "SampleAnalizeControl";
List<SampleAnalizeControl> samplescontrol = SampleAnalize.getSampleAnalizeControl(samples,year);
rdsc.Value = samplescontrol;
report.DataSources.Add(rdsc);
// detaliu
ReportDataSource rdscrot = new ReportDataSource();
rdscrot.Name = "SampleAnalizeCrotalia";
List<SampleAnalizeCrotalia> samplescrot = SampleAnalize.getSampleAnalizeCrotalia(fermaid, i,year);
rdscrot.Value = samplescrot;
report.DataSources.Add(rdscrot);
//controale
ReportDataSource rdsm = new ReportDataSource();
rdsm.Name = "SampleAnalizeExt";
List<SampleAnalizeExt> samplesext = SampleAnalize.GetSampleAnalizeExt(fermaid,year);
rdsm.Value = samplesext;
report.DataSources.Add(rdsm);
report.ReportPath = "ControlsSummaryAll.rdlc";
string datatestare = "Data: " + DateTime.Now.ToString("dd/MM/yyyy");
// set reports parameters
string title = userinfos.NumeFerma + " - " + "Cod exploatatie " + userinfos.UserCod;
ReportParameter pCod = new ReportParameter("CodExpl", userinfos.UserCod);
ReportParameter pData = new ReportParameter("DataExec", datatestare);
ReportParameter pChartTitle = new ReportParameter("ChartTitle", chartTitles[i]);
ReportParameter pChartLabelsName = new ReportParameter("ChartLabelsName", chartLabelsName[i]);
ReportParameter pUm = new ReportParameter("Um", um[i]);
ReportParameter pTitle = new ReportParameter("Title", title);
ReportParameter pUsername = new ReportParameter("UserName", username);
string baseurl = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + ConfigurationManager.AppSettings["baseurl"];
ReportParameter pBaseurl = new ReportParameter("BaseUrl", baseurl);
ReportParameter[] p = { pCod, pData, pChartTitle, pChartLabelsName, pUm,pTitle,pUsername,pBaseurl };
report.SetParameters(p);
report.Refresh();
// write xls
string httppath = ConfigurationManager.AppSettings["httppath"];
//"/Downloads/";
string filepath = ConfigurationManager.AppSettings["filepath"];
//"D:\\portal\\Downloads\\";
string path_raport_http = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath;
string fileid = chartTitles[i];
if (i == 8) fileid = fileid.Substring(0, 4);
string raport_excel = "Grafic" + fileid + "_" + userinfos.UserCod + "_" + (DateTime.Now).ToString("ddMMyyyy") + ".xls";
string excel_file = filepath + raport_excel;
string excel_link = path_raport_http + raport_excel;
byte[] xls_content = report.Render("EXCEL", deviceInfoXls, out mimeType, out encoding, out fileExtension, out streams, out warnings);
File.WriteAllBytes(excel_file, xls_content);
//rename sheets
using (StreamReader input = new StreamReader(excel_file))
{
HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(input.BaseStream));
if (workbook != null)
{
workbook.SetSheetName(0, chartTitles[i]);
// workbook.SetSheetName(1, "Detaliu date");
WriteExcel(excel_file, workbook);
}
}
//
HyperLink hyper = (HyperLink)holder.FindControl("xlslink" + parIds[i]);
hyper.Visible = true;
hyper.NavigateUrl = excel_link;
hyper.Text = raport_excel;
ErrorMessage.Text = "";
} //checked
}//for
}//samplecount >0
}//fermaid >0
else
{
// ErrorMessage.Text = "Nu exista date pentru codul "+ userinfos.UserCod;
}
}
示例4: CreateReportExt
public void CreateReportExt(int year)
{
LocalReport report = new LocalReport();
string mimeType, encoding, fileExtension;
string[] streams;
Warning[] warnings;
Session["year"] = year;
report.SubreportProcessing += new SubreportProcessingEventHandler(ItemsSubreportProcessingEventHandler);
int fermaid = 0;
try { fermaid = Convert.ToInt32(FermaId.Text); }
catch { fermaid = 0; }
string username = Username.Text;
UserInfos userinfos = UserInfos.getUserInfos(username);
if (fermaid != 0)
{
string[] parIds = { "g", "p", "c", "l", "s", "h", "u", "n", "z" };
string[] chartLabelsName = { "Grasime (g/100g)", "Proteine (g/100g)", "Cazeina (g/100g)", "Lactoza (g/100g)", "SUN (g/100g)", "pH", "Uree (mg/dl)", "NCSx1000", "Cantitate lapte (l)" };
string[] chartTitles = { "Grasime", "Proteine", "Cazeina",
"Lactoza", "SUN", "Ph",
"Uree", "NCS","Cantitate lapte"};
string[] um = { "g/100g", "g/100g", "g/100g", "g/100g", "g/100g", "pH", "mg/dl", "NCSx1000", "l" };
//controale
ReportDataSource rdsm = new ReportDataSource();
rdsm.Name = "SampleAnalizeExt";
logger.Info(string.Format("CreateReportExt|getting samples"));
List<SampleAnalizeExt> samplesext = SampleAnalize.GetSampleAnalizeExt(fermaid, year);
logger.Info(string.Format("CreateReportExt|got {0} samples", samplesext.Count));
rdsm.Value = samplesext;
report.DataSources.Clear();
report.DataSources.Add(rdsm);
report.ReportPath = "ControlsSummaryExt.rdlc";
string datatestare = "Data: " + DateTime.Now.ToString("dd/MM/yyyy");
// set reports parameters
string title = FermaName.Text + " - " + "Cod exploatatie " + FermaCod.Text;
ReportParameter pCod = new ReportParameter("CodExpl", FermaCod.Text);
ReportParameter pData = new ReportParameter("DataExec", datatestare);
// ReportParameter pChartTitle = new ReportParameter("ChartTitle", chartTitles[i]);
// ReportParameter pChartLabelsName = new ReportParameter("ChartLabelsName", chartLabelsName[i]);
// ReportParameter pUm = new ReportParameter("Um", um[i]);
ReportParameter pTitle = new ReportParameter("Title", title);
ReportParameter pUsername = new ReportParameter("UserName", username);
string baseurl = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + ConfigurationManager.AppSettings["baseurl"];
ReportParameter pBaseurl = new ReportParameter("BaseUrl", baseurl);
ReportParameter[] p = { pCod, pData, pTitle, pBaseurl, pUsername };
report.SetParameters(p);
report.Refresh();
// write xls
string httppath = ConfigurationManager.AppSettings["httppath"] + userinfos.AsocId + "/" + year +"/";
//"/Downloads/";
string filepath = ConfigurationManager.AppSettings["filepath"] + userinfos.AsocId + "\\"+ year +"\\";
if (!Directory.Exists(filepath))
{
Directory.CreateDirectory(filepath);
}
//"D:\\portal\\Downloads\\";
string path_raport_http = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath;
string fermaname = replace_special_car_null(FermaName.Text);
string raport_excel = FermaCod.Text + "_" + fermaname + ".xls";
string excel_file = filepath + raport_excel;
string excel_link = path_raport_http + raport_excel;
// infomess.Text = infomess.Text + ";" + excel_file;
byte[] xls_content = report.Render("EXCEL", StaticData.DEVICE_INFO_XLS, out mimeType, out encoding, out fileExtension, out streams, out warnings);
File.WriteAllBytes(excel_file, xls_content);
logger.Info(string.Format("CreateReportExt|wrote excel file {0}", excel_file));
//rename sheets
List<SampleAnalize> samples = SampleAnalize.GetSampleAnalize(fermaid, "",year);
using (StreamReader input = new StreamReader(excel_file))
{
HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(input.BaseStream));
if (workbook != null && samples.Count > 0)
{
for (int count = 0; count < samples.Count; count++)
workbook.SetSheetName(count, samples[count].Nrcontrol);
for (int count = 0; count < chartTitles.Length; count++)
{
string sheetname = chartTitles[count].Replace(" ", "");
workbook.SetSheetName(count + samples.Count, "Grafic" + sheetname);
}
// workbook.SetSheetName(1, "Detaliu date");
WriteExcel(excel_file, workbook);
}
}
}
}
示例5: CreateReport
public void CreateReport()
{
Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator = ".";
logger.Info(string.Format("GetMostreFerma|CreateReport"));
LocalReport report = new LocalReport();
byte[] file;
string mimeType, encoding, fileExtension;
string[] streams;
Warning[] warnings;
long reportNumber;
ReportManager rManager = new ReportManager(ctx);
Report dalReport = rManager.GetOrCreateReport(FCCLReportType.Crotalii, ObjectId
, DropDownList1.SelectedItem.Text, TestDate, PrintDate, long.TryParse(TextBox3.Text, out reportNumber) ? (long?)reportNumber : null);
TextBox3.Text = dalReport.ReportNumber.ToString();
ReportDataSource rds = new ReportDataSource();
rds.Name = "MostreFabrica";
List<MostreFabrica> mostre = MostreFabrica.GetMostreFerma(DropDownList1.SelectedValue, DateTime.Parse(TextBox1.Text));
logger.Info(string.Format("GetMostreFerma|mostre cnt:{0}", mostre.Count));
rds.Value = mostre;
DateTime datatestare = DateTime.Parse(TextBox1.Text);
DateTime datatmin = datatestare;
DateTime datatmax = datatestare;
string datatesttitlu = datatestare.ToShortDateString();
DateTime datapmin = DateTime.MaxValue;
DateTime datapmax = DateTime.MinValue;
string dataprimtitlu;
string nrcomanda = "";
string combi = mostre[0].Combi;
foreach (MostreFabrica mf in mostre)
{
DateTime datamin = mf.DataTestare;
DateTime datamax = mf.DataTestareFinala;
if (mf.NrComanda.Trim() != "")
nrcomanda = mf.NrComanda.Trim();
if (DateTime.Compare(datamin, datatmin) < 0)
datatmin = datamin;
if (DateTime.Compare(datamax, datatmax) > 0)
datatmax = datamax;
if (DateTime.Compare(mf.DataPrimirii, datapmin) < 0)
datapmin = mf.DataPrimirii;
if (DateTime.Compare(mf.DataPrimirii, datapmax) > 0)
datapmax = mf.DataPrimirii;
}
if (datatmin != datatmax)
datatesttitlu = datatmin.ToShortDateString() + " - " + datatmax.ToShortDateString();
if (datapmin != datapmax)
dataprimtitlu = datapmin.ToShortDateString() + " si " + datapmax.ToShortDateString();
else
dataprimtitlu = datapmin.ToShortDateString();
rds.Value = mostre;
report.DataSources.Clear();
report.DataSources.Add(rds);
report.ReportPath = "ReportCrotalii.rdlc";
report.Refresh();
string fermaid = DropDownList1.SelectedValue;
string fermaname = DropDownList1.Items[DropDownList1.SelectedIndex].ToString();
// read fabrica
SqlConnection cnn = new SqlConnection(
ConfigurationManager.ConnectionStrings
["fccl2ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "SELECT Ferme_CCL.Cod,Ferme_CCL.Strada,Ferme_CCL.Numar,Ferme_CCL.Oras,Judete.Denloc "
+ "FROM Ferme_CCL,Judete WHERE Ferme_CCL.ID=" + fermaid
+ " AND Ferme_CCL.Judet=Judete.ID";
cnn.Open();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
string fermastrada = Convert.ToString(reader["Strada"]);
string fermanumar = Convert.ToString(reader["Numar"]);
string fermaoras = Convert.ToString(reader["Oras"]);
string fermajudet = Convert.ToString(reader["Denloc"]);
string fermacod = Convert.ToString(reader["Cod"]);
reader.Close();
cnn.Close();
cmd.CommandText = "SELECT Fabrici.Nume, Ferme_CCL.FabricaID from Ferme_CCL, Fabrici "
+ " WHERE Ferme_CCL.ID =" + fermaid + " AND Ferme_CCL.FabricaID = Fabrici.ID";
cnn.Open();
reader = cmd.ExecuteReader();
reader.Read();
//.........这里部分代码省略.........
示例6: CreateReport
public void CreateReport()
{
LocalReport report = new LocalReport();
byte[] file;
string mimeType, encoding, fileExtension;
string[] streams;
Warning[] warnings;
ReportDataSource rds = new ReportDataSource();
rds.Name = "MostreFabrica";
List<MostreFabrica> mostre = MostreFabrica.GetMostreFabrica(DropDownList1.SelectedValue, TextBox1.Text, TextBox2.Text);
string datatestare = TextBox1.Text;
string datatestare2 = TextBox2.Text;
rds.Value = mostre;
report.DataSources.Clear();
report.DataSources.Add(rds);
report.ReportPath = "ReportFabricaIntre4.rdlc";
report.Refresh();
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>29.7cm</PageWidth>" +
" <PageHeight>21cm</PageHeight>" +
" <MarginTop>0.0cm</MarginTop>" +
" <MarginLeft>0.1cm</MarginLeft>" +
" <MarginRight>0.1cm</MarginRight>" +
" <MarginBottom>0.5cm</MarginBottom>" +
"</DeviceInfo>";
string deviceInfoXls =
"<DeviceInfo>" +
" <OutputFormat>XLS</OutputFormat>" +
" <PageWidth>29.7cm</PageWidth>" +
" <PageHeight>21cm</PageHeight>" +
" <MarginTop>0.0cm</MarginTop>" +
" <MarginLeft>0.0cm</MarginLeft>" +
" <MarginRight>0.1cm</MarginRight>" +
" <MarginBottom>0.1cm</MarginBottom>" +
"</DeviceInfo>";
string fabricaid = DropDownList1.SelectedValue;
string fabricaname = DropDownList1.Items[DropDownList1.SelectedIndex].ToString();
// read fabrica
SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["fccl2ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "SELECT Fabrici.Strada,Fabrici.Numar,Fabrici.Oras,Judete.Denloc "
+ "FROM Fabrici,Judete WHERE Fabrici.ID=" + fabricaid + " AND Fabrici.Judet=Judete.ID";
cnn.Open();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
string fabricastrada = Convert.ToString(reader["Strada"]);
string fabricanumar = Convert.ToString(reader["Numar"]);
string fabricaoras = Convert.ToString(reader["Oras"]);
string fabricajudet = Convert.ToString(reader["Denloc"]);
reader.Close();
cnn.Close();
//set report parameters
string laborator = ddlLaborator.Items[ddlLaborator.SelectedIndex].ToString();
string responsabil = ddlResponsabil.Items[ddlResponsabil.SelectedIndex].ToString();
string combi = mostre[0].Combi;
ReportParameter pDatatestare = new ReportParameter("datatestare", datatestare);
ReportParameter pDatatestare2 = new ReportParameter("datatestare2", datatestare2);
ReportParameter pCombi = new ReportParameter("combi", combi);
ReportParameter pFabricanume = new ReportParameter("fabricanume", fabricaname);
ReportParameter pFabricastrada = new ReportParameter("fabricastrada", fabricastrada);
ReportParameter pFabricanumar = new ReportParameter("fabricanumar", fabricanumar);
ReportParameter pFabricaoras = new ReportParameter("fabricaoras", fabricaoras);
ReportParameter pFabricajudet = new ReportParameter("fabricajudet", fabricajudet);
ReportParameter pLaborator = new ReportParameter("laborator", laborator);
ReportParameter pResponsabil = new ReportParameter("responsabil", responsabil);
ReportParameter pVersiune = new ReportParameter("Versiune", new SettingManager(StaticDataHelper.FCCLDbContext).GetValueByName("ReportFabricaIntre4"));
ReportParameter[] p = { pDatatestare, pDatatestare2, pCombi, pFabricanume, pFabricastrada, pFabricanumar, pFabricaoras, pFabricajudet, pLaborator, pResponsabil, pVersiune };
report.SetParameters(p);
file = report.Render("PDF", deviceInfo, out mimeType, out encoding, out fileExtension, out streams, out warnings);
string httppath = StaticDataHelper.SettingsManager.CaleRapoarteHttp;
string filepath = StaticDataHelper.SettingsManager.CaleRapoarte;
fabricaname = replace_special_car_null(fabricaname);
string raport_name = "RaportFabrica" + datatestare.Replace("/", "_") + "_" + datatestare2.Replace("/", "_") + "_" + fabricaid + "-" + fabricaname + ".pdf";
string raport_excel = "RaportFabrica" + datatestare.Replace("/", "_") + "_" + datatestare2.Replace("/", "_") + "_" + fabricaid + "-" + fabricaname + ".xls";
string path_raport_http = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath;
string pdf_link = path_raport_http + @"Fabrici/" + raport_name;
string pdf_file = filepath + @"Fabrici/" + raport_name;
// writefile
string excel_link = path_raport_http + @"Fabrici/" + raport_excel;
//.........这里部分代码省略.........
示例7: RenderWorkOrderEquipExcelReport
private void RenderWorkOrderEquipExcelReport()
{
string strReportType = "Excel";
LocalReport objLocalReport;
ReportDataSource WorkOrderDataSource;
string mimeType;
string encoding;
string fileNameExtension;
string deviceInfo = "";
Warning[] warnings;
string[] streams;
objLocalReport = new LocalReport { ReportPath = Server.MapPath(Settings.ReportDirectory + "WorkOrderEquipment.rdlc") };
objLocalReport.SubreportProcessing += new SubreportProcessingEventHandler(MySubreportEventHandler);
//Give the reportdatasource a name so that we can reference it in our report designer
WorkOrderDataSource = new ReportDataSource("WorkOrders", WorkOrderCollection);
objLocalReport.DataSources.Add(WorkOrderDataSource);
objLocalReport.Refresh();
//The DeviceInfo settings should be changed based on the reportType
//http://msdn2.microsoft.com/en-us/library/ms155397.aspx
deviceInfo = string.Format(
"<DeviceInfo>" +
"<OmitDocumentMap>True</OmitDocumentMap>" +
"<OmitFormulas>True</OmitFormulas>" +
"<SimplePageHeaders>True</SimplePageHeaders>" +
"</DeviceInfo>", strReportType);
//Render the report
var renderedBytes = objLocalReport.Render(
strReportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
//Clear the response stream and write the bytes to the outputstream
//Set content-disposition to "attachment" so that user is prompted to take an action
//on the file (open or save)
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = mimeType;
Response.AddHeader("content-disposition", "attachment; filename=WorkOrderEquip" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + "." + fileNameExtension);
Response.BinaryWrite(renderedBytes);
Response.End();
}
示例8: CreateReport
//.........这里部分代码省略.........
if (DateTime.Compare(dt1, dt2) > 0)
datatmax = datamax;
}
// data primirii
if (dataprimirii != datapmin)
{
DateTime dt1 = new DateTime(Int32.Parse(dataprimirii.Substring(6, 4)), Int32.Parse(dataprimirii.Substring(3, 2)), Int32.Parse(dataprimirii.Substring(0, 2)));
DateTime dt2 = new DateTime(Int32.Parse(datapmin.Substring(6, 4)), Int32.Parse(datapmin.Substring(3, 2)), Int32.Parse(datapmin.Substring(0, 2)));
if (DateTime.Compare(dt1, dt2) < 0)
datapmin = dataprimirii;
}
if (dataprimirii != datapmax)
{
DateTime dt1 = new DateTime(Int32.Parse(dataprimirii.Substring(6, 4)), Int32.Parse(dataprimirii.Substring(3, 2)), Int32.Parse(dataprimirii.Substring(0, 2)));
DateTime dt2 = new DateTime(Int32.Parse(datapmax.Substring(6, 4)), Int32.Parse(datapmax.Substring(3, 2)), Int32.Parse(datapmax.Substring(0, 2)));
if (DateTime.Compare(dt1, dt2) > 0)
datapmax = dataprimirii;
}
}
if (datatmin != datatmax)
datatesttitlu = datatmin + " - " + datatmax;
if (datapmin != datapmax)
dataprimtitlu = datapmin + " si " + datapmax;
else
dataprimtitlu = datapmin;
// end dates interval
report.DataSources.Clear();
report.DataSources.Add(rds);
pos++;
report.ReportPath = "ReportFerme4.rdlc";
report.Refresh();
ReportParameter pDatatitlu = new ReportParameter("datatestare", datatesttitlu);
ReportParameter pDataprimirii = new ReportParameter("dataprimirii", dataprimtitlu);
ReportParameter pCombi = new ReportParameter("combi", combi);
ReportParameter pPos = new ReportParameter("pos", pos.ToString());
ReportParameter pCodferma = new ReportParameter("codferma", codferma);
ReportParameter pFermanume = new ReportParameter("fermanume", fermanume);
ReportParameter pFermaadresa = new ReportParameter("fermaadresa", fermaadresa);
ReportParameter pFermajudet = new ReportParameter("fermajudet", judet);
ReportParameter pFermaperscontact = new ReportParameter("fermaperscontact", fermaperscontact);
ReportParameter pFermatelcontact = new ReportParameter("fermatelcontact", fermatelcontact);
ReportParameter versiuneRaport = new ReportParameter("Versiune", new SettingManager(StaticDataHelper.FCCLDbContext).GetValueByName("ReportFerme4"));
ReportParameter[] p ={ pDatatitlu,pDataprimirii,pCombi,pDatab,pNrb,pFabricanume,pFabricastrada,pFabricanumar,pFabricaoras,pFabricajudet,pLaborator,pResponsabil,
pPos,pFermanume,pFermaadresa,pFermajudet,pCodferma,pFermaperscontact,pFermatelcontact, versiuneRaport};
report.SetParameters(p);
file = report.Render("PDF", deviceInfo, out mimeType, out encoding, out fileExtension, out streams, out warnings);
// read from date fixe!!!
fermanume = replace_special_car_null(fermanume);
string raport_name = "RaportFerma" + datatestare.Replace("/", "_") + "_" + fermacod + "-" + fermanume + ".pdf";
string raport_excel = "RaportFerma" + datatestare.Replace("/", "_") + "_" + fermacod + "-" + fermanume + ".xls";
string path_raport_http = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath;
string pdf_link = path_raport_http + @"Ferme/" + raport_name;
string pdf_file = filepath + @"Ferme/" + raport_name;
File.WriteAllBytes(pdf_file, file);
filelink.Url = pdf_link;
示例9: CreateReport
//.........这里部分代码省略.........
Warning[] warnings;
if (fermaid != 0)
{
List<SampleAnalize> samples = SampleAnalize.GetSampleAnalize(fermaid, crot, year);
if (samples.Count > 0)
{
//set current param
foreach (SampleAnalize sample in samples)
{
switch (i)
{
case 0:
sample.Val = sample.Grasime;
break;
case 1:
sample.Val = sample.Proteine;
break;
case 2:
sample.Val = sample.Caseina;
break;
case 3:
sample.Val = sample.Lactoza;
break;
case 4:
sample.Val = sample.Solide;
break;
case 5:
sample.Val = sample.Ph;
break;
case 6:
sample.Val = sample.Urea;
break;
case 7:
sample.Val = sample.Ncs;
break;
case 8:
sample.Val = sample.Cantitate;
break;
case 9:
sample.Val = 0;
if (sample.Proteine > 0)
sample.Val = sample.Grasime/sample.Proteine;
break;
default:
break;
}
sample.Val = Math.Round(sample.Val, 2);
}
//datasources
ReportDataSource rds = new ReportDataSource();
rds.Name = "SampleAnalize";
rds.Value = samples;
report.DataSources.Clear();
report.DataSources.Add(rds);
//
ReportDataSource rdsc = new ReportDataSource();
rdsc.Name = "SampleAnalizeControl";
List<SampleAnalizeControl> samplescontrol = SampleAnalize.getSampleAnalizeControl(samples, year);
rdsc.Value = samplescontrol;
report.DataSources.Add(rdsc);
//parameters
report.ReportPath = "GraficCrotalie.rdlc";
string datatestare = "Data: " + DateTime.Now.ToString("dd/MM/yyyy");
// set reports parameters
string title = userinfos.NumeFerma + " - " + "Cod exploatatie " + userinfos.UserCod;
ReportParameter pCod = new ReportParameter("CodExpl", title);
ReportParameter pData = new ReportParameter("DataExec", datatestare);
ReportParameter pChartTitle = new ReportParameter("ChartTitle",
chartTitles[i] + " - Nr. matricol: " + crot);
ReportParameter pChartLabelsName = new ReportParameter("ChartLabelsName", chartLabelsName[i]);
ReportParameter pUm = new ReportParameter("Um", um[i]);
ReportParameter[] p = {pCod, pData, pChartTitle, pChartLabelsName, pUm};
report.SetParameters(p);
report.Refresh();
string excel_file = filepath + raport_excel;
byte[] xls_content = report.Render("EXCEL", deviceInfoXls, out mimeType, out encoding,
out fileExtension, out streams, out warnings);
File.WriteAllBytes(excel_file, xls_content);
url = baseurl + raport_excel;
}
}
else
{
FailureText.Text = "Nu exista date pentru codul " + userinfos.UserCod + " si numarul matricol " + crot;
}
}
catch (Exception ex)
{
string err = ex.Message;
string trace = ex.StackTrace;
Logger.Error(trace + "|" + err);
}
return url;
}
示例10: BindHostingSpaceBandwidthOverusageDetailsReport
protected void BindHostingSpaceBandwidthOverusageDetailsReport(string reportName, LocalReport localReport)
{
// 1. Localize report
localReport.DisplayName = reportName;
localReport.LoadReportDefinition(
ReportingServicesUtils.LoadReportFromFile(
GetReportFullPath(reportName)
, reportName
, this
)
);
// 2. Update parameters
// Note: here we are always in Drill-through mode.
localReport.SetParameters(localReport.OriginalParametersToDrillthrough);
string hostingSpaceId = localReport.GetParameters()["HostingSpaceId"].Values[0];
List<ReportParameter> parameters = new List<ReportParameter>();
parameters.Add(
new ReportParameter(
ParameterBandwidthStartDate
, startDateCalendar.SelectedDate.ToString()
)
);
parameters.Add(
new ReportParameter(
ParameterBandwidthEndDate
, endDateCalendar.SelectedDate.ToString()
)
);
localReport.SetParameters(parameters);
//3. Update data
DataSet ds = ES.Services.Packages
.GetBandwidthOverusageDetailsReport(
PanelSecurity.SelectedUserId
, int.Parse(hostingSpaceId)
, startDateCalendar.SelectedDate
, endDateCalendar.SelectedDate
);
localReport.DataSources.Clear();
TranslateStatusField(ds.Tables["HostingSpace"]);
BindDataTableToReport(localReport, "OverusageReport_HostingSpace", ds.Tables["HostingSpace"]);
BindDataTableToReport(localReport, "OverusageReport_BandwidthOverusage", ds.Tables["BandwidthOverusage"]);
BindDataTableToReport(localReport, "OverusageReport_OverusageDetails", ds.Tables["OverusageDetails"]);
localReport.Refresh();
}
示例11: ObtenerPropuestaRPT
public Byte[] ObtenerPropuestaRPT(int id)
{
/* Carga de lista de datos */
var propuesta = modelEntity.SP_SAF_PROPUESTA_RPT(id).ToList();
equipoAuditoriaRpt = modelEntity.SP_SAF_EQUIPOAUDITORIA_RPT(id).ToList();
/* Creación de reporte */
const string reportPath = "~/Reports/rptPropuesta.rdlc";
var localReport = new LocalReport { ReportPath = Server.MapPath(reportPath) };
/* Seteando el datasource */
var dtPropuesta = new ReportDataSource("dtPropuesta") { Value = propuesta };
var dtEquipoAuditoria = new ReportDataSource("dtEquipoAuditoria") { Value = equipoAuditoriaRpt };
localReport.DataSources.Add(dtPropuesta);
localReport.DataSources.Add(dtEquipoAuditoria);
//localReport.SubreportProcessing += ReportePropuestaSubreportProcessingEventHandler;
localReport.Refresh();
//Configuración del reporte
string deviceInfoA4 = "<DeviceInfo>" +
" <OutputFormat>A4</OutputFormat>" +
" <PageWidth>21cm</PageWidth>" +
" <PageHeight>29.7cm</PageHeight>" +
" <MarginTop>1cm</MarginTop>" +
" <MarginLeft>1cm</MarginLeft>" +
" <MarginRight>1cm</MarginRight>" +
" <MarginBottom>1cm</MarginBottom>" +
"</DeviceInfo>";
string mimeType;
string encoding;
string fileNameExtension;
Warning[] warnings;
string[] streams;
var file = localReport.Render("pdf", deviceInfoA4, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
return file;
}
示例12: BindOverusageSummaryReport
/// <summary>
/// Loads Overusage summary report.
/// </summary>
/// <param name="reportName">Name of overusage summary report.</param>
/// <param name="localReport">
/// Instance or <see cref="LocalReport"/> class.
/// This instance serves as a container for report being loaded.
/// </param>
protected void BindOverusageSummaryReport(string reportName, LocalReport localReport)
{
// 1. Localize report
localReport.DisplayName = reportName;
localReport.LoadReportDefinition(
ReportingServicesUtils.LoadReportFromFile(
GetReportFullPath(reportName)
, reportName
, this
)
);
// 2. Update parameters
List<ReportParameter> parameters = new List<ReportParameter>();
parameters.Add(
new ReportParameter(
ParameterBandwidthStartDate
, startDateCalendar.SelectedDate.ToString()
)
);
parameters.Add(
new ReportParameter(
ParameterBandwidthEndDate
, endDateCalendar.SelectedDate.ToString()
)
);
localReport.SetParameters(parameters);
// 3. Update DataSet
DataSet report = ES.Services.Packages
.GetOverusageSummaryReport(
PanelSecurity.SelectedUserId
, PanelSecurity.PackageId
, startDateCalendar.SelectedDate
, endDateCalendar.SelectedDate
);
localReport.DataSources.Clear();
TranslateStatusField(report.Tables["HostingSpace"]);
// If you open reports DataSet file in XML and file <DataSets> node
// you will see the same names as applied to ReportDataSource(name, value) instances below
LoadDiskspaceOverusageData(report.Tables["HostingSpace"], report.Tables["DiskspaceOverusage"]);
LoadBandwidthOverusageData(report.Tables["HostingSpace"], report.Tables["BandwidthOverusage"]);
//
BindDataTableToReport(localReport, "OverusageReport_HostingSpace", report.Tables["HostingSpace"]);
BindDataTableToReport(localReport, "OverusageReport_DiskspaceOverusage", report.Tables["DiskspaceOverusage"]);
BindDataTableToReport(localReport, "OverusageReport_BandwidthOverusage", report.Tables["BandwidthOverusage"]);
BindDataTableToReport(localReport, "OverusageReport_OverusageDetails", report.Tables["OverusageDetails"]);
localReport.Refresh();
}
示例13: BindHostingSpaceDiskspaceOverusageDetailsReport
/// <summary>
/// Load a detailed diskspace report.
/// </summary>
/// <param name="reportName">Name of detailed diskspace report.</param>
/// <param name="localReport">
/// Instance or <see cref="LocalReport"/> class.
/// This instance serves as a container for report being loaded.
/// </param>
protected void BindHostingSpaceDiskspaceOverusageDetailsReport(string reportName, LocalReport localReport)
{
// 1. Localize report
localReport.DisplayName = reportName;
localReport.LoadReportDefinition(
ReportingServicesUtils.LoadReportFromFile(
GetReportFullPath(reportName)
, reportName
, this
)
);
// 2. Update parameters
// Note: here we are always in Drill-through mode.
localReport.SetParameters(localReport.OriginalParametersToDrillthrough);
string hostingSpaceId = localReport.GetParameters()["HostingSpaceId"].Values[0];
// 3. Update DataSet
DataSet report = ES.Services.Packages
.GetDiskspaceOverusageDetailsReport(
PanelSecurity.SelectedUserId
, int.Parse(hostingSpaceId)
);
localReport.DataSources.Clear();
TranslateStatusField(report.Tables["HostingSpace"]);
BindDataTableToReport(localReport, "OverusageReport_HostingSpace", report.Tables["HostingSpace"]);
BindDataTableToReport(localReport, "OverusageReport_DiskspaceOverusage", report.Tables["DiskspaceOverusage"]);
BindDataTableToReport(localReport, "OverusageReport_OverusageDetails", report.Tables["OverusageDetails"]);
localReport.Refresh();
}
示例14: DoPrinting
private void DoPrinting(DepartmentStockOut deptStockOut)
{
streamList = new List<Stream>();
// push data to local report
DeptStockOutInvoice = new LocalReport();
DeptStockOutInvoice.ReportEmbeddedResource = "AppFrameClient.Report.DepartmentStockOutInvoice.rdlc";
ReportDataSource DeptStockOutRDS = new ReportDataSource("AppFrameClient_ViewModel_DepartmentStockOutView");
BindingSource bdsHeader = new BindingSource();
DepartmentStockOutView deptSOView = new DepartmentStockOutViewMapper().Convert(deptStockOut);
deptSOView.EmployeeName = txtCustomerName.Text.Trim();
if(rdoWholesale.Checked)
{
deptSOView.StockOutKind = "BÁN SỈ";
}
else
{
deptSOView.StockOutKind = "BÁN LẺ";
}
bdsHeader.DataSource = deptSOView;
DeptStockOutRDS.Value = bdsHeader;
DeptStockOutInvoice.DataSources.Add(DeptStockOutRDS);
ReportDataSource DeptStockOutDetailRDS = new ReportDataSource("AppFrameClient_ViewModel_DepartmentStockOutDetailView");
BindingSource bdsDetails = new BindingSource();
DepartmentStockOutViewDetailMapper detailMapper = new DepartmentStockOutViewDetailMapper();
IList<DepartmentStockOutDetailView> viewList = new List<DepartmentStockOutDetailView>();
foreach (DepartmentStockOutDetail outDetail in deptStockOut.DepartmentStockOutDetails)
{
DepartmentStockOutDetailView detailView = detailMapper.Convert(outDetail);
if(rdoWholesale.Checked)
{
detailView.Price = outDetail.DepartmentPrice.WholeSalePrice;
}
else
{
detailView.Price = outDetail.DepartmentPrice.Price;
}
viewList.Add(detailView);
}
// remove duplicate
int count = viewList.Count;
for (int i = 0; i < count; i++ )
{
DepartmentStockOutDetailView detailView = viewList[i];
int last = count - 1;
while(last >i)
{
DepartmentStockOutDetailView otherView = viewList[last];
if(otherView.ProductName.Equals(detailView.ProductName))
//&& otherView.ColorName.Equals(detailView.ColorName) )
{
detailView.Quantity += otherView.Quantity;
detailView.GoodCount += otherView.GoodCount;
viewList.RemoveAt(last);
count -= 1;
}
last -= 1;
}
}
bdsDetails.DataSource = viewList;
DeptStockOutDetailRDS.Value = bdsDetails;
DeptStockOutInvoice.DataSources.Add(DeptStockOutDetailRDS);
// do printing
streamList.Clear();
//const string printerName = "Epson TM-T88IV";
string printerName = ClientSetting.PrinterName;
PrintDocument printDoc = new PrintDocument();
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
MessageBox.Show(String.Format("Can't find printer \"{0}\".", printerName));
return;
}
PageSettings pageSettings = printDoc.PrinterSettings.DefaultPageSettings;
pageSettings.PrinterResolution.X = 180;
pageSettings.PrinterResolution.Y = 180;
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>8.2in</PageWidth>" +
" <PageHeight>5.5in</PageHeight>" +
" <DpiX>180</DpiX>" +
" <DpiY>180</DpiY>" +
" <MarginTop>0.0in</MarginTop>" +
" <MarginLeft>0.0in</MarginLeft>" +
" <MarginRight>0.0in</MarginRight>" +
" <MarginBottom>0.0in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
if (DeptStockOutInvoice == null)
{
return;
}
DeptStockOutInvoice.Refresh();
//.........这里部分代码省略.........
示例15: reportViewer1_Drillthrough
/// <summary>
/// Handles drilldown report events
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void reportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
{
_localReport = (LocalReport)e.Report;
OnReportDrilledThrough(e);
byte[] rdlBytes = Encoding.UTF8.GetBytes(_reportInfo.ReportDefinition);
System.IO.MemoryStream stream = new System.IO.MemoryStream(rdlBytes);
_localReport.LoadReportDefinition(stream);
RunReport();
if (!_bDisplayedError)
_localReport.Refresh();
}