本文整理汇总了C#中System.Data.DataSet.GetXml方法的典型用法代码示例。如果您正苦于以下问题:C# System.Data.DataSet.GetXml方法的具体用法?C# System.Data.DataSet.GetXml怎么用?C# System.Data.DataSet.GetXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataSet
的用法示例。
在下文中一共展示了System.Data.DataSet.GetXml方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataSetTest
public static void DataSetTest()
{
System.Data.DataSet ds = new System.Data.DataSet();
ds.Tables.Add(new System.Data.DataTable());
ds.Tables[0].Columns.Add(new System.Data.DataColumn() { DataType = typeof(DateTime), DateTimeMode = System.Data.DataSetDateTime.Unspecified });
System.Data.DataRow dr = ds.Tables[0].NewRow();
dr[0] = new DateTime(2015, 6, 25, 12, 00, 10, 0);
ds.Tables[0].Rows.Add(dr);
string xxxx = ds.GetXml();
}
示例2: AddMergeData
private static string AddMergeData(string tag, int recipientCount)
{
string[] domains = new string[] { "aol.com", "yahoo.com", "gmail.com", "hotmail.com" };
//string[] domains = new string[] { "scott.com", "scott.com", "scott.com", "scott.com" };
string emailFormat = "{0}." + tag + "@{1}";
System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add(new System.Data.DataColumn("recipid"));
dt.Columns.Add(new System.Data.DataColumn("listquality"));
dt.Columns.Add(new System.Data.DataColumn("name"));
dt.Columns.Add(new System.Data.DataColumn("email"));
dt.Columns.Add(new System.Data.DataColumn("amount"));
dt.Columns.Add(new System.Data.DataColumn("ticketInfo"));
dt.Columns.Add(new System.Data.DataColumn("replyto"));
dt.Columns.Add(new System.Data.DataColumn("sentfrom"));
dt.Columns.Add(new System.Data.DataColumn("sentfromdisplay"));
System.Data.DataRow dr = null;
Random ran = new Random(1000);
string id = "0";
for (int i = 0; i < recipientCount; i++)
{
dr = dt.NewRow();
id = ran.Next().ToString();
int quarter = (int)(recipientCount * .25);
if (i <= quarter)
{
dr.ItemArray = new Object[] { id, "3", "scott carnley", string.Format(emailFormat, i.ToString(), domains[0]), "$345.45", "One ticket for the greatest show on earth.", "[email protected]", "[email protected]", "Administrator" };
}
else if (i <= (quarter * 2))
{
dr.ItemArray = new Object[] { id, "3", "scott carnley", string.Format(emailFormat, i.ToString(), domains[1]), "$345.45", "One ticket for the greatest show on earth.", "[email protected]", "[email protected]", "Administrator" };
}
else if (i <= (quarter * 3))
{
dr.ItemArray = new Object[] { id, "3", "scott carnley", string.Format(emailFormat, i.ToString(), domains[2]), "$345.45", "One ticket for the greatest show on earth.", "[email protected]", "[email protected]", "Administrator" };
}
else if (i <= recipientCount)
{
dr.ItemArray = new Object[] { id, "3", "scott carnley", string.Format(emailFormat, i.ToString(), domains[3]), "$345.45", "One ticket for the greatest show on earth.", "[email protected]", "[email protected]", "Administrator" };
}
dt.Rows.Add(dr);
}
dt.DefaultView.Sort = "recipid asc";
System.Data.DataSet ds = new System.Data.DataSet();
ds.Tables.Add(dt.DefaultView.ToTable());
return ds.GetXml();
}
示例3: AddData
private void AddData()
{
if (_proxy == null) throw new ApplicationException("Proxy not initiated.");
System.Data.DataSet ds = new System.Data.DataSet();
ds.Tables.Add(new System.Data.DataTable());
ds.Tables[0].Columns.Add(new System.Data.DataColumn("M"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("N"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("E"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("F.15.0.0."));
Console.WriteLine("Add data...");
int totalSize = 0;
do
{
System.Data.DataRow dr = ds.Tables[0].NewRow();
dr["M"] = Guid.NewGuid().ToString();
dr["N"] = "Scott";
dr["E"] = "[email protected]";
dr["F.15.0.0."] = "data has been merged.";
totalSize += CalculateRowSize(dr.ItemArray);
if (totalSize <= MAX_CHUNK_SIZE)
{
ds.Tables[0].Rows.Add(dr);
}
else
{
break;
}
} while (true);
SubmitGeneralPurposeEmailChunkRequest r = new SubmitGeneralPurposeEmailChunkRequest();
r.CompressedMergeData = CompressData(ds.GetXml());
//r.MergeData = ds.GetXml();
r.JobIdentity = this.Jobid.ToString();
Console.WriteLine("Submitting chunk...");
SubmitGeneralPurposeEmailChunkReply reply = _proxy.SubmitGeneralPurposeEmailChunk(r);
Console.WriteLine("Chunk submitted");
}
示例4: Execute
public bool Execute()
{
if (_proxy == null) throw new ApplicationException("Proxy not initiated.");
if (this.JobData == null) { this.JobData = new Processors.BBCS.InlineEmailJob(); }
System.Data.DataSet ds = new System.Data.DataSet();
ds.Tables.Add(new System.Data.DataTable());
ds.Tables[0].Columns.Add(new System.Data.DataColumn("M"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("N"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("E"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("F.15.0.0."));
//do
//{
// System.Data.DataRow dr = ds.Tables[0].NewRow();
// dr["M"] = Guid.NewGuid().ToString();
// dr["N"] = "Scott";
// dr["E"] = "[email protected]";
// dr["F.15.0.0."] = "data has been merged.";
// totalSize += CalculateRowSize(dr.ItemArray);
// if (totalSize <= MAX_CHUNK_SIZE)
// {
// ds.Tables[0].Rows.Add(dr);
// }
// else
// {
// break;
// }
//} while (true);
System.Data.DataRow dr = ds.Tables[0].NewRow();
dr["M"] = Guid.NewGuid().ToString();
dr["N"] = "Tomas";
dr["E"] = "[email protected]";
dr["F.15.0.0."] = "data has been merged";
ds.Tables[0].Rows.Add(dr);
SubmitGeneralPurposeEmailRequest req = new SubmitGeneralPurposeEmailRequest();
req.UniqueIDFieldName = "M";
req.EmailDisplayNameFieldName = "N";
req.EmailAddressFieldName = "E";
req.EmailContentText = "Iowa test inline";
req.EmailContentHTML = @"<html><body><h3>Blackbaud testing</h3><p>$$merge$$</p></body></html>";
req.SentFromAddr = "[email protected]";
req.SentFromDisplay = "Blackbaud Test";
req.MergeToken = "$$";
req.Subject = "Iowa test inline";
req.ForwardDSN = false;
req.ForwardDSNSpecified = true;
req.JobDescription = "Blackbaud Test Email";
req.CompressedMergeData = CompressData(ds.GetXml());
//req.OrganizationID = this.JobData.OrgId;
req.ConsumerStartDate = DateTime.Now;
req.ConsumerStartDateSpecified = true;
req.ConsumerEndDate = DateTime.Now;
req.ConsumerEndDateSpecified = true;
req.ReturnReceipt = false;
req.ReturnReceiptSpecified = true;
req.Source = 1;
req.SourceSpecified = true;
req.EndOfStream = true;
req.EndOfStreamSpecified = true;
req.Type = 0;
req.TypeSpecified = true;
using (_proxy)
{
SubmitGeneralPurposeEmailReply reply = _proxy.SubmitGeneralPurposeEmailJob(req);
return (reply.JobStatus == 1);
}
}
示例5: StartChunk
private void StartChunk()
{
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
string content;
using (System.IO.StreamReader strm = new System.IO.StreamReader(assembly.GetManifestResourceStream("Processors.BBCS.SOAP.GeneralPurpose.Iowa.Content.html")))
{
content = strm.ReadToEnd();
}
if (_proxy == null) throw new ApplicationException("Proxy not initiated.");
System.Data.DataSet ds = new System.Data.DataSet();
ds.Tables.Add(new System.Data.DataTable());
ds.Tables[0].Columns.Add(new System.Data.DataColumn("M"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("N"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("E"));
ds.Tables[0].Columns.Add(new System.Data.DataColumn("F.15.0.0."));
Console.WriteLine("loading data");
int totalSize = 0;
do
{
System.Data.DataRow dr = ds.Tables[0].NewRow();
dr["M"] = Guid.NewGuid().ToString();
dr["N"] = "Scott";
dr["E"] = "[email protected]";
dr["F.15.0.0."] = "data has been merged.";
totalSize += CalculateRowSize(dr.ItemArray);
if (totalSize <= MAX_CHUNK_SIZE)
{
ds.Tables[0].Rows.Add(dr);
}
else
{
break;
}
} while (true);
StartChunkedGeneralPurposeEmailJobRequest req = new StartChunkedGeneralPurposeEmailJobRequest();
req.JobIdentity = this.Jobid.ToString();
req.UniqueIDFieldName = "M";
req.EmailDisplayNameFieldName = "N";
req.EmailAddressFieldName = "E";
req.EmailContentText = "Blackbaud test email";
req.EmailContentHTML = content;//@"<html><body><h3>Blackbaud testing</h3><p>$$merge$$</p></body></html>";
req.SentFromAddr = "[email protected]";
req.SentFromDisplay = "Blackbaud Test";
req.MergeToken = "$$";
req.Subject = "Iowa Test";
req.ForwardDSN = false;
req.ForwardDSNSpecified = true;
req.JobDescription = "Blackbaud Test Email";
req.CompressedMergeData = CompressData(ds.GetXml());
req.MergeData = "<xml>some dataa</xml>"; //ds.GetXml();
req.OrganizationID = 123;
req.OrganizationIDSpecified = true;
req.ConsumerStartDate = DateTime.Now;
req.ConsumerStartDateSpecified = true;
req.ConsumerEndDate = DateTime.Now;
req.ConsumerEndDateSpecified = true;
req.ReturnReceipt = false;
req.ReturnReceiptSpecified = true;
req.Source = 1;
req.SourceSpecified = true;
req.Type = 0;
req.TypeSpecified = true;
Console.WriteLine("Submitting start chunk.");
StartChunkedGeneralPurposeEmailJobReply reply = _proxy.StartChunkedGeneralPurposeEmailJob(req);
Console.WriteLine("Start chunk submitted.");
}