I don't understand your intention, but I think you should do some thing as
you do in the method 'processsShippingInfoAPA()':
- Get a DataSet: DataSet ds = ....
- Then, walk through the DataSet to get each DataRow:
foreach (DataRow rs in ds.Tables[0].Rows)
{....}
On Sun, Aug 2, 2009 at 6:46 AM, DotnetBeginner <[email protected]> wrote:
>
> Hi Guys,
>
> Pleas help out, I know this is very small , but i am not getting.I am
> trying to call a method with data row as a parameter.
>
>
> Here is the code.
>
>
> I am calling the method sendShippedEmail(DataRow rs)in this
> program.cs but i dont know how to pass that datarow rs while calling
> this method in program.cs
>
>
>
> ---------------PROGRAM.CS---------------------------
>
> using System;
>
> using System.Collections.Generic;
>
> using System.Text;
>
> using System.Data.SqlClient;
>
> using System.Data;
>
>
>
> namespace ShippingApp
>
> {
>
> class Program
>
> {
>
> static void Main(string[] args)
>
> {
>
> try
>
> {
>
> DataRow ds = new
>
>
>
> ShippingUtility.sendShippedEmail(------------
> HERE IS MY DOUBT HELP ME----------------- );
>
> }
>
> catch(Exception ex)
>
> {
>
> ErrorHelper.logErrorToEventlog(ex, "Main Error!!!!");
>
> }
>
> }
>
> }
>
> }
>
>
> -----------------------------SHIPPING APPLICATION--------------------
>
> namespace ShippingApp
>
> {
>
> public class ShippingUtility
>
> {
>
> public static void processsShippingInfoAPA()
>
> {
>
> // Program starts here
>
> //string xmlFileUrl = "";
>
> int customerno = int.Parse
> ( Properties.Settings.Default.APACustomerNo);
>
> //customerno = int.Parse(ConfigurationManager.AppSettings
> ["APACustomerNo"]);
>
> // DateTime tdate = DateTime.Today.AddDays(-34).Date;
>
> DateTime tdate = DateTime.Today.AddDays(-1).Date;
>
> DataSet ds = AOD.Shipments.getShippedOrders(customerno,
> tdate);
>
> if (ds != null)
>
> {
>
> foreach (DataRow rs in ds.Tables[0].Rows)
>
> {
>
> ShippingUtility.sendShippedEmail(rs);
>
> }
>
> }
>
> }
>
>
> ------
>
>
>
> public static void sendShippedEmail(DataRow rs)
>
> {
>
> try
>
> {
>
> //get updated shipped xml
>
> string xmlFileUrl =
> Properties.Settings.Default.BackUPShippingFilePath + rs["CustOrderID"]
> + "_shipped.xml";
>
>
>
> XmlTextReader reader = null;
>
> reader = new XmlTextReader(xmlFileUrl);
>
> XmlDocument myXmlDoc = new XmlDocument();
>
> myXmlDoc.Load(reader);
>
>
>
> //Call method to send shipping email
>
> AOD.MailHelper.sendShippedEmail(myXmlDoc,
> Properties.Settings.Default.emailTemplatePath, rs);
>
> AOD.Shipments.setOrderStatusToConfirmedEmailSent(rs);
>
> Console.Write("Shipping was sucessful");
>
> }
>
> catch(Exception ex)
>
> {
>
> ErrorHelper.logErrorToEventlog(ex,
> "ShippingUtility.sendShippedEmail");
>
> }
>
> }
>
> }
>
> }
>
>
>
> -
--
kidVN