On 8/2/09, 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");
>
>             }
>
>         }
>
>     }
>
>  }
>
>
>
>  -

Why are you using datarow as parameter just pass a single string. Just
create a composite  string which is combination of many string as you
want separated by a special character. Where you want to extract your
data just use [string].split('separator character') and catch the
output in a string array and use the array as you want. As you are
beginner it will be more easy for you.
                                             Just try. If you are
still getting problem then mail me again i will send you an example.
                                                Best of Luck.

Reply via email to