Example #1
0
    public static InvoiceInfoDetails Invoice_GetInfo2( int orderID )
    {
        InvoiceInfoDetails details = new InvoiceInfoDetails();

        DbCommand cmd = DataAccess.CreateCommand();
        cmd.CommandText = "Invoice_GetInfo2";

        DbParameter param = cmd.CreateParameter();
        param.ParameterName = "@orderID";
        param.Value = orderID;
        param.DbType = DbType.Int32;
        cmd.Parameters.Add(param);

        cmd.Connection.Open();
        DbDataReader reader = cmd.ExecuteReader();

        //try
        //{
            while (reader.Read())
            {
                if (!reader.IsDBNull(0))
                    details.InvoiceID = reader.GetInt32(0) + 1;
                //if (!reader.IsDBNull(1))
                  //  details.OrderID = reader.GetInt32(1);
                //details.OrderID = Int32.Parse(reader["orderID"].ToString());
                if (!reader.IsDBNull(1))
                    details.Company = reader.GetString(1);
                if (!reader.IsDBNull(2))
                    details.Balance = reader.GetDecimal(2).ToString();
            }
            reader.Close();
        //}
        //catch (Exception ex)
        //{
           //     Utilities.LogError(ex);
           //     throw;
           // }
           // finally
           // {
            cmd.Connection.Close();
           // }

        return details;
    }
Example #2
0
    public static InvoiceInfoDetails Invoice_GetInfo1()
    {
        InvoiceInfoDetails details = new InvoiceInfoDetails();

        DbCommand cmd = DataAccess.CreateCommand();
        cmd.CommandText = "Invoice_GetInfo";
        cmd.Connection.Open();
        DbDataReader reader = cmd.ExecuteReader();

        try
        {
           while (reader.Read())
            {
               if (!reader.IsDBNull(0))
                    details.InvoiceID = reader.GetInt32(0) + 1;
               if (!reader.IsDBNull(1))
                   details.OrderID = reader.GetInt32(1);
                   //details.OrderID = Int32.Parse(reader["orderID"].ToString());
               if (!reader.IsDBNull(2))
                    details.Company = reader.GetString(2);
               if (!reader.IsDBNull(3))
                   details.Balance = reader.GetDecimal(3).ToString();
            }
            reader.Close();
        }
        catch (Exception ex)
        {
            Utilities.LogError(ex);
            throw;
        }
        finally
        {
            cmd.Connection.Close();
        }

        return details;
    }