本文整理汇总了C#中ParameterValues.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterValues.Clear方法的具体用法?C# ParameterValues.Clear怎么用?C# ParameterValues.Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterValues
的用法示例。
在下文中一共展示了ParameterValues.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnExecute_Click
private void btnExecute_Click(object sender, EventArgs e)
{
ReportDocument report = new ReportDocument();
report.Load(this.filePath);
report.SetDatabaseLogon(userName, password, server, db);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
//order no
crParameterDiscreteValue.Value = txtFilter.Text;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["orderNo"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//start date
crParameterDiscreteValue.Value = dtpStartDate.Value;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["startDate"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//end date
crParameterDiscreteValue.Value = dtpEndDate.Value;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["endDate"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = server;
crConnectionInfo.DatabaseName = db;
crConnectionInfo.UserID = userName;
crConnectionInfo.Password = password;
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo.ConnectionInfo = crConnectionInfo;
TableLogOnInfos logOnInfos = new TableLogOnInfos();
logOnInfos.Add(logOnInfo);
crystalReportViewer.LogOnInfo = logOnInfos;
crystalReportViewer.ReportSource = report;
crystalReportViewer.Refresh();
}
示例2: FrmVisualizadorContrato_Load
private void FrmVisualizadorContrato_Load(object sender, EventArgs e)
{
//ReportDocument report = new ReportDocument();
//report.Load("C:\\Users\\João\\Documents\\Video Aulas\\Canal Professor Drausion\\1° Temporada\\KISNER_EVENTOS\\Apresentacao\\Relatorios\\Contrato\\RelContrato.rpt");
//string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
//report.Load("\\Relatorios\\Contrato\\RelContrato.rpt");
Relatorios.Contrato.RelContrato report = new Relatorios.Contrato.RelContrato();
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = codEvento;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["ParCodEvento"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
//trabalhando com os brinquedos escolhidos pelo usuário! Usando DataSet
/*Relatorios.Contrato.DsEventoBrinquedo eb = new Relatorios.Contrato.DsEventoBrinquedo();
DataTable brinquedos = eb.Tables.Add("DtBrinquedo");
brinquedos.Columns.Add("codBrinquedo", Type.GetType("System.Int32"));
brinquedos.Columns.Add("nome", Type.GetType("System.String"));
BrinquedoColecao bc = new BrinquedoColecao();
*/
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crystalReportViewer1.ReportSource = report;
crystalReportViewer1.Refresh();
}
示例3: button1_Click
private void button1_Click(object sender, EventArgs e)
{
try
{
ReportDocument crystalrpt = new ReportDocument();
crystalrpt.Load(@"C:\Users\Lahkrome\Desktop\Beta Sinergia\alfa2_Sinergia\CrystalReport.rpt");
//crystalReportViewer1.ReportSource = crystalrpt;
//crystalReportViewer1.Refresh();
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = textBox1.Text;
crParameterFieldDefinitions = crystalrpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["ProductName"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crystalReportViewer1.ReportSource = crystalrpt;
crystalReportViewer1.Refresh();
}
catch (Exception ex)
{
MessageBox.Show("Error"+ex);
}
}
示例4: load_pass
private void load_pass(CrystalReportPass crystal, string val)
{
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = val;
crParameterFieldDefinitions = crystal.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["idresep"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
}
示例5: load_pass
private void load_pass(transaksiugd crystal, string val)
{
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = val;
crParameterFieldDefinitions = crystal.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["pasien"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
}
示例6: fmProjectCosting_Load
private void fmProjectCosting_Load(object sender, EventArgs e)
{
crystalReportViewer1.Top = 0;
try
{
ReportDocument cryRpt = new ReportDocument();
string dir = System.IO.Directory.GetCurrentDirectory();
dir = "Default_ProjectCost.rpt";
cryRpt.Load(dir);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = orderid;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["orderid"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crystalReportViewer1.ReportSource = cryRpt;
//crystalReportViewer1.RefreshReport();
}
catch (LogOnException)
{
MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
}
catch (DataSourceException)
{
MessageBox.Show("An error has occurred while connecting to the database.");
}
catch (EngineException ex)
{
MessageBox.Show (ex.Message);
}
}
示例7: setReport
private void setReport(string[] discretes, string[] values, ReportDocument reportSource)
{
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
for (int i = 0; i < discretes.Length; i++)
{
crParameterDiscreteValue.Value = values[i];
crParameterFieldDefinitions = reportSource.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions[discretes[i]];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
}
crystalReportViewer1.ReportSource = reportSource;
crystalReportViewer1.Refresh();
}
示例8: button1_Click
private void button1_Click(object sender, EventArgs e)
{
CrystalReport5 xxx = new CrystalReport5();
xxx.DataSourceConnections[0].SetConnection("THANH\\SQLEXPRESS","Po",true);
MessageBox.Show(xxx.DataSourceConnections[0].DatabaseName);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterFieldDefinitions crParameterFieldDefinitions1;
ParameterFieldDefinition crParameterFieldDefinition1;
ParameterValues crParameterValues1 = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
ParameterDiscreteValue crParameterDiscreteValue1 = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = "1001";
crParameterFieldDefinitions = xxx.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@Store_ID"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterDiscreteValue1.Value = textBox1.Text;
crParameterFieldDefinitions1 = xxx.DataDefinition.ParameterFields;
crParameterFieldDefinition1 = crParameterFieldDefinitions1["@Invoice_Number"];
crParameterValues1 = crParameterFieldDefinition1.CurrentValues;
crParameterValues1.Clear();
crParameterValues1.Add(crParameterDiscreteValue1);
crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);
xxx.PrintToPrinter(1, true, 1, 1);
crystalReportViewer1.ReportSource = xxx;
}
示例9: setReport
private void setReport(string[] discretes, string[] values, ReportDocument reportSource)
{
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
reportSource.SetDatabaseLogon(dbo.getDatabaseInformationLogon()[2], dbo.getDatabaseInformationLogon()[3], dbo.getDatabaseInformationLogon()[0], dbo.getDatabaseInformationLogon()[1]);
for (int i = 0; i < discretes.Length; i++)
{
crParameterDiscreteValue.Value = values[i];
crParameterFieldDefinitions = reportSource.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions[discretes[i]];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
}
crv.ReportSource = reportSource;
crv.Refresh();
}
示例10: button54_Click
private void button54_Click(object sender, EventArgs e)
{
if(myCash1.listInvoiceItem.Rows.Count != 0)
{
FrmPay frmPay = new FrmPay();
frmPay.textBox1.Text = frmPay.textBox2.Text = String.Format("{0:0,0}", Convert.ToDecimal(myCash1.label_Total.Text));
if(frmPay.ShowDialog() == DialogResult.OK)
{
myCash1.invoiceTotal.Rows[0]["Amt_Tendered"] = frmPay.tienTra;
myCash1.invoiceTotal.Rows[0]["Amt_Change"] = frmPay.tienThoi;
myCash1.invoiceTotal.Rows[0]["Status"] = "C";
myCash1.invoiceTotal.Rows[0]["Payment_Method"] = frmPay.hinhThucTra;
if(frmPay.hinhThucTra == "CA")
{
myCash1.invoiceTotal.Rows[0]["CA_Amount"] = Convert.ToDecimal(myCash1.label_Total.Text);
}
else if (frmPay.hinhThucTra == "CC")
{
myCash1.invoiceTotal.Rows[0]["CC_Amount"] = Convert.ToDecimal(myCash1.label_Total.Text);
}
else if (frmPay.hinhThucTra == "DC")
{
myCash1.invoiceTotal.Rows[0]["DC_Amount"] = Convert.ToDecimal(myCash1.label_Total.Text);
}
myCash1.invoiceTotal.Rows[0]["Cashier_ID"] = StaticClass.cashierId;
getGui.DeleteInvoiceItemized(StaticClass.storeId, this.invoiceNum);
if (myCash1.listInvoiceItem.Rows.Count == 0)
{
myCash1.invoiceTotal.Rows[0][15] = "V";
getGui.CloseTable(StaticClass.storeId, invoiceNum);
}
else
{
foreach (DataRow c in myCash1.listInvoiceItem.Rows)
{
getGui.UpdateInvoiceItemized(StaticClass.storeId, invoiceNum, c[2].ToString(), c[3].ToString(), c[12].ToString(), c[1].ToString(), c[6].ToString(), c[7].ToString(), c[8].ToString(), c[5].ToString(), c[19].ToString());
}
}
UpdateInvoiceTotals();
getGui.DeleteInvoiceOnhold(StaticClass.storeId,invoiceNum);
SendToKitchen();
this.Dispose();
formLayout.FrmLayout_Load(null, null);
formLogin.RequestMess("UpdateForm");
Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, "Hóa đơn");
if (!(printer == null || printer.Details == "NONE" || printer.Disable == true))
{
Re_ThanhToan xxx = new Re_ThanhToan();
xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterFieldDefinitions crParameterFieldDefinitions1;
ParameterFieldDefinition crParameterFieldDefinition1;
ParameterValues crParameterValues1 = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
ParameterDiscreteValue crParameterDiscreteValue1 = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = StaticClass.storeId;
crParameterFieldDefinitions = xxx.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@Store_ID"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterDiscreteValue1.Value = invoiceNum;
crParameterFieldDefinitions1 = xxx.DataDefinition.ParameterFields;
crParameterFieldDefinition1 = crParameterFieldDefinitions1["@Invoice_Number"];
crParameterValues1 = crParameterFieldDefinition1.CurrentValues;
crParameterValues1.Clear();
crParameterValues1.Add(crParameterDiscreteValue1);
xxx.PrintOptions.PrinterName = printer.Details;
crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);
xxx.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
xxx.PrintToPrinter(1, false, 0, 0);
}
}
}
else
{
Alert.Show("Hóa đơn chưa có hàng",Color.Red);
}
}
示例11: button51_Click
private void button51_Click(object sender, EventArgs e)
{
getGui.DeleteInvoiceItemized(StaticClass.storeId, this.invoiceNum);
if (myCash1.listInvoiceItem.Rows.Count == 0)
{
myCash1.invoiceTotal.Rows[0][15] = "V";
getGui.CloseTable(StaticClass.storeId, invoiceNum);
}
else
{
myCash1.invoiceTotal.Rows[0][57] = Convert.ToInt32(myCash1.invoiceTotal.Rows[0][57]) + 1;
foreach (DataRow c in myCash1.listInvoiceItem.Rows)
{
getGui.UpdateInvoiceItemized(StaticClass.storeId, invoiceNum, c[2].ToString(), c[3].ToString(), c[12].ToString(), c[1].ToString(), c[6].ToString(), c[7].ToString(), c[8].ToString(), c[5].ToString(), c[19].ToString());
}
}
UpdateInvoiceTotals();
SendToKitchen();
if (myCash1.listInvoiceItem.Rows.Count != 0)
{
Printer printer = serviceGet.GetPrinterByName(StaticClass.storeId, StaticClass.stationId, "Hóa đơn");
if(!(printer == null || printer.Details == "NONE" || printer.Disable == true))
{
CrystalReport5 xxx = new CrystalReport5();
xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterValues crParameterValues = new ParameterValues();
ParameterFieldDefinitions crParameterFieldDefinitions1;
ParameterValues crParameterValues1 = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
ParameterDiscreteValue crParameterDiscreteValue1 = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = StaticClass.storeId;
crParameterFieldDefinitions = xxx.DataDefinition.ParameterFields;
ParameterFieldDefinition crParameterFieldDefinition = crParameterFieldDefinitions["@Store_ID"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterDiscreteValue1.Value = invoiceNum;
crParameterFieldDefinitions1 = xxx.DataDefinition.ParameterFields;
ParameterFieldDefinition crParameterFieldDefinition1 = crParameterFieldDefinitions1["@Invoice_Number"];
crParameterValues1 = crParameterFieldDefinition1.CurrentValues;
crParameterValues1.Clear();
crParameterValues1.Add(crParameterDiscreteValue1);
crParameterFieldDefinition1.ApplyCurrentValues(crParameterValues1);
xxx.DataSourceConnections[0].SetConnection(StaticClass.serverName, StaticClass.databaseName, true);
xxx.PrintOptions.PrinterName = printer.Details;
xxx.PrintOptions.ApplyPageMargins(new PageMargins(1, 2, 1, 0));
xxx.PrintToPrinter(1, false, 0, 0);
}
}
this.Dispose();
formLayout.FrmLayout_Load(null, null);
}
示例12: Form2_Load
private void Form2_Load(object sender, EventArgs e)
{
crystalReportViewer1.Top = 0;
try
{
ReportDocument cryRpt = new ReportDocument();
string dir = System.IO.Directory.GetCurrentDirectory(); dir = "Default_WorkOrder.rpt";
cryRpt.Load(dir);
/*ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = MysqlInterface.host;
crConnectionInfo.DatabaseName = MysqlInterface.dbase;
crConnectionInfo.UserID = MysqlInterface.user;
crConnectionInfo.Password = MysqlInterface.password;
crConnectionInfo.AllowCustomConnection = true;
Tables crTables;
crTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
TableLogOnInfo myTableLogonInfo = crTable.LogOnInfo;
myTableLogonInfo.ConnectionInfo.DatabaseName = MysqlInterface.dbase;
myTableLogonInfo.ConnectionInfo.UserID = MysqlInterface.user;
myTableLogonInfo.ConnectionInfo.Password = MysqlInterface.password;
myTableLogonInfo.ConnectionInfo.ServerName = MysqlInterface.host;
crTable.ApplyLogOnInfo(myTableLogonInfo);
}
*/
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = orderid;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["orderid"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
}
catch (LogOnException)
{
MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
}
catch (DataSourceException)
{
MessageBox.Show("An error has occurred while connecting to the database.");
}
catch (EngineException ex)
{
MessageBox.Show(ex.Message);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
}
示例13: btSendQuote_Click
private void btSendQuote_Click(object sender, EventArgs e)
{
try
{
MySqlDataReader rdr = null;
string email = "";
string contact = "";
string qry = "select c.email, c.contact from customer c where c.ID = '" + cbCustomer.Text + "';";
rdr = MysqlInterface.DoQuery(qry);
while (rdr.Read())
{
email = rdr.GetString(0);
contact = rdr.GetString(1);
}
string orderid = tbOrderId.Text;
ReportDocument cryRpt = new ReportDocument();
string dir = System.IO.Directory.GetCurrentDirectory();
dir = "Quote.rpt";
cryRpt.Load(dir);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = orderid;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["orderid"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, "quotations//quote-" + orderid + ".pdf");
Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
string directory = Directory.GetCurrentDirectory();
orderid = tbOrderId.Text;
directory = directory + "\\quotations\\quote-" + orderid + ".pdf";
mailItem.Attachments.Add(directory);
mailItem.Subject = "Pinnacle Glass Doors - Quote# " + orderid;
mailItem.To = email;
string name = contact;
if (contact != "")
{
int pos = name.IndexOf(' ');
if (pos != -1)
name = name.Substring(0, pos);
}
mailItem.Body = "Hi " + name + ",\n\n" + "Here is the quote you requested. Please let me know if you would like to proceed with the order" +
"\n\nThank You,\n\n" + Globals.USER_NAME;
mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
mailItem.Display(true);
//crystalReportViewer1.ReportSource = cryRpt;
//crystalReportViewer1.RefreshReport();
}
catch (LogOnException)
{
MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
}
catch (DataSourceException)
{
MessageBox.Show("An error has occurred while connecting to the database.");
}
catch (EngineException ex)
{
MessageBox.Show(ex.Message);
}
}
示例14: btSendConfirm_Click
private void btSendConfirm_Click(object sender, EventArgs e)
{
try
{
MySqlDataReader rdr = null;
string email = "";
string contact = "";
string qry = "select co.contact_email, co.contact_name from customer c inner join contact co on co.owner_id = c.id where c.id = '" +
cbCustomer.Text + "' and co.contact_name = '" + cbContact.Text + "';";
rdr = MysqlInterface.DoQuery(qry);
while (rdr.Read())
{
if (!rdr.IsDBNull(0)) email = rdr.GetString(0);
if (!rdr.IsDBNull(1)) contact = rdr.GetString(1);
}
string orderid = tbOrderId.Text;
ReportDocument cryRpt = new ReportDocument();
string dir = System.IO.Directory.GetCurrentDirectory();
dir = "Confirmation.rpt";
cryRpt.Load(dir);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = orderid;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["orderid"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, "confirmations//confirmation-" + orderid + ".pdf");
Outlook.Application outlookApp = new Outlook.Application();
Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
string directory = Directory.GetCurrentDirectory();
orderid = tbOrderId.Text;
string po = tbCustPO.Text;
directory = directory + "\\confirmations\\confirmation-" + orderid + ".pdf";
mailItem.Attachments.Add(directory);
mailItem.Subject = "Pinnacle Glass Doors - Confirmation# " + orderid + " - PO# " + po;
mailItem.To = email;
string name = contact;
if (contact != "")
{
int pos = name.IndexOf(' ');
if (pos != -1)
name = name.Substring(0, pos);
}
mailItem.Body = "Hi " + name + ",\n\n" + "Attached is a confirmation of your purchase order " + po + "." +
"\n\nThank You,\n\n" + Globals.USER_NAME;
mailItem.Importance = Outlook.OlImportance.olImportanceNormal;
try
{ mailItem.Display(true); }
catch
(Exception) { }
//crystalReportViewer1.ReportSource = cryRpt;
//crystalReportViewer1.RefreshReport();
}
catch (LogOnException)
{
MessageBox.Show("Incorrect Logon Parameters. Check your user name and password.");
}
catch (DataSourceException)
{
MessageBox.Show("An error has occurred while connecting to the database.");
}
catch (EngineException ex)
{
MessageBox.Show(ex.Message);
}
}
示例15: ImprimirRelPed
public void ImprimirRelPed()
{
try
{
//Instancio o FormConsulta
FrmConPDV x = (FrmConPDV)_pdv;
if (x.rdbped.Checked)
{
//Instancio o Relatorio
RptConPDV objRptConPDV = new RptConPDV();
//Instancio o Dataset
COMERCIALDataSet oDataset = new COMERCIALDataSet();
Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
//Crio a Conexão
SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);
//Abro a conexão
sqlcon.Open();
//Recebo a String SQL feita na tela de consulta
string StringConnection = x.pesquisar();
SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);
//Localizo o datatable criado no dataset
dtAdapter.Fill(oDataset, "RelPedido");
objRptConPDV.SetDataSource(oDataset);
//Passo parametro para relatorio no caso somente o de pedido tem parametro
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = "PDV";
crParameterFieldDefinitions = objRptConPDV.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Tipo"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//atribiu o resultado ao CristalReportView
crstlRprtVwrRel.DisplayGroupTree = false;
crstlRprtVwrRel.ReportSource = objRptConPDV;
}
else
{
//Instancio o Relatorio
RptConPDV objRptConPDV = new RptConPDV();
//Instancio o Dataset
COMERCIALDataSet oDataset = new COMERCIALDataSet();
Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
//Crio a Conexão
SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Comercial.Properties.Settings.COMERCIALConnectionString"].ConnectionString);
//Abro a conexão
sqlcon.Open();
//Recebo a String SQL feita na tela de consulta
string StringConnection = x.pesquisar();
SqlDataAdapter dtAdapter = new SqlDataAdapter(StringConnection, sqlcon);
//Localiso o datateble criado no dataset
dtAdapter.Fill(oDataset, "RelPedido");
objRptConPDV.SetDataSource(oDataset);
//Passo parametro para relatorio no caso somente o de pedido tem parametro
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = "prd";
crParameterFieldDefinitions = objRptConPDV.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Tipo"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//atribiu o resultado ao CristalReportView
crstlRprtVwrRel.DisplayGroupTree = false;
crstlRprtVwrRel.ReportSource = objRptConPDV;
}
}
catch (Exception ex)
{
throw ex;
//.........这里部分代码省略.........