Hi! Normally I would extract what the DataRow holds, and not pass the
whole Datarow object completely to another method.

It goes something like this:

    DataRow Row;
    Row = (DataRow) ds.Tables[0].Rows[0];

    String field1  = Row["MY_TABLEFIELD1"].ToString();
    String field2  = Row["MY_TABLEFIELD2"].ToString();

    ...
   ShippingUtility.sendShippedEmail(field1);   // or field2, whatever
field that you want processed.



Cheers!


Benj



On Aug 2, 7: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");
>
>             }
>
>         }
>
>     }
>
> }
>
> -

Reply via email to