Exemple #1
0
        private void ProcessObjects(object[,] valueArray,string sheetName)
        {
            Voucher voucher = new Voucher(sheetName);

            // Get upper bounds for the array.
            int n = valueArray.GetUpperBound(0);
            int m = valueArray.GetUpperBound(1);

            // Use for-loops to iterate over the array elements.
            // Begins on i = 2 because we want to ignore de 1st row (column name)
            for (int i = 2; i <= n; i++)
            {
                for (int j = 1; j <= m; j++)
                {
                    switch(j)
                    {
                        case 1:
                            voucher.RazonSocial = (string)valueArray[i, j];
                            break;
                        case 2:
                            voucher.VendorDocNum = (string)valueArray[i, j];
                            break;
                        case 3:
                            voucher.txtField = (string)valueArray[i, j];
                            break;
                        case 4:
                            voucher.DocNum = (string)valueArray[i, j];
                            break;
                        case 10:
                            voucher.taxDetPerc = (double)valueArray[i, j];
                            break;
                        case 12:
                            voucher.documentDate = (DateTime)valueArray[i, j];
                            break;
                        case 14:
                            voucher.postingDate = (DateTime)valueArray[i, j];
                            break;
                        case 15:
                            voucher.taxAmount = (double)valueArray[i, j];
                            break;
                        case 17:
                            voucher.taxableAmount = (double)valueArray[i, j];
                            break;
                    }

                    /*
                    if ((j >= 1 & j <= 3) | j == 10 | j == 12 | j == 14 | j == 15 | j == 17)
                    {
                        System.Type type = valueArray[i, j].GetType();

                        if (type == typeof(string))
                        {
                            string value = (string)valueArray[i, j];
                            Console.WriteLine(value);
                        }
                        else if(type == typeof(DateTime))
                        {
                            DateTime value = (DateTime)valueArray[i, j];
                            Console.WriteLine(value.ToShortDateString());
                        }
                        else if (type == typeof(double))
                        {
                            double value = (double)valueArray[i, j];
                            Console.WriteLine(value);
                        }
                    }*/
                }
            }

            voucher.print();
        }
Exemple #2
0
        private void ProcessObjects(object[,] valueArray, string sheetName)
        {
            Voucher voucher = new Voucher(sheetName);

            // Get upper bounds for the array.
            int n = valueArray.GetUpperBound(0);
            int m = valueArray.GetUpperBound(1);

            // Use for-loops to iterate over the array elements.
            // Begins on i = 2 because we want to ignore de 1st row (column name)
            for (int i = 2; i <= n; i++)
            {
                for (int j = 1; j <= m; j++)
                {
                    switch (j)
                    {
                    case 1:
                        voucher.RazonSocial = (string)valueArray[i, j];
                        break;

                    case 2:
                        voucher.VendorDocNum = (string)valueArray[i, j];
                        break;

                    case 3:
                        voucher.txtField = (string)valueArray[i, j];
                        break;

                    case 4:
                        voucher.DocNum = (string)valueArray[i, j];
                        break;

                    case 10:
                        voucher.taxDetPerc = (double)valueArray[i, j];
                        break;

                    case 12:
                        voucher.documentDate = (DateTime)valueArray[i, j];
                        break;

                    case 14:
                        voucher.postingDate = (DateTime)valueArray[i, j];
                        break;

                    case 15:
                        voucher.taxAmount = (double)valueArray[i, j];
                        break;

                    case 17:
                        voucher.taxableAmount = (double)valueArray[i, j];
                        break;
                    }

                    /*
                     * if ((j >= 1 & j <= 3) | j == 10 | j == 12 | j == 14 | j == 15 | j == 17)
                     * {
                     *  System.Type type = valueArray[i, j].GetType();
                     *
                     *  if (type == typeof(string))
                     *  {
                     *      string value = (string)valueArray[i, j];
                     *      Console.WriteLine(value);
                     *  }
                     *  else if(type == typeof(DateTime))
                     *  {
                     *      DateTime value = (DateTime)valueArray[i, j];
                     *      Console.WriteLine(value.ToShortDateString());
                     *  }
                     *  else if (type == typeof(double))
                     *  {
                     *      double value = (double)valueArray[i, j];
                     *      Console.WriteLine(value);
                     *  }
                     * }*/
                }
            }

            voucher.print();
        }
Exemple #3
0
 public PdfManager(int t, Voucher v)
 {
     type    = t;
     voucher = v;
 }
Exemple #4
0
 public PdfManager(int t,Voucher v)
 {
     type = t;
     voucher = v;
 }