static public ArrayList Read(IDataReader reader) { ArrayList aCustomerOrderRowList = new ArrayList(); while (reader.Read()) { CustomerOrderRow aCustomerOrderRow = new CustomerOrderRow(); int i = 0; aCustomerOrderRow.ClientIdentity = reader.GetString(i++); aCustomerOrderRow.OrderNumber = reader.GetString(i++); aCustomerOrderRow.OrderSequence = reader.GetInt32(i++); aCustomerOrderRow.SubSequence = reader.GetInt32(i++); aCustomerOrderRow.LinePosition = reader.GetInt32(i++); aCustomerOrderRow.LineSequence = reader.GetInt32(i++); aCustomerOrderRow.LineKitPosition = reader.GetInt32(i++); aCustomerOrderRow.LineStatus = reader.GetString(i++); aCustomerOrderRow.OrderedQuantity = Convert.ToDouble(reader.GetDecimal(i++)); aCustomerOrderRow.PickedQuantity = Convert.ToDouble(reader.GetDecimal(i++)); aCustomerOrderRow.DiscrepancyQuantity = Convert.ToDouble(reader.GetDecimal(i++)); aCustomerOrderRow.DiscrepancyCode = reader.GetString(i++); aCustomerOrderRow.DiscrepancyText = reader.GetString(i++); aCustomerOrderRow.ExternalDiscrepancyCode = reader.GetString(i++); aCustomerOrderRowList.Add(aCustomerOrderRow); } reader.Close(); return(aCustomerOrderRowList); }
static public ArrayList MakeTestData() { ArrayList aCustomerOrderRowList = new ArrayList(); for (int i = 0; i < 10; i++) { CustomerOrderRow aCustomerOrderRow = new CustomerOrderRow(); aCustomerOrderRow.ClientIdentity = "IMISTD"; aCustomerOrderRow.OrderNumber = "1234"; aCustomerOrderRow.OrderSequence = i; aCustomerOrderRow.SubSequence = i; aCustomerOrderRow.LinePosition = i; aCustomerOrderRow.LineSequence = i; aCustomerOrderRow.LineKitPosition = i; aCustomerOrderRow.LineStatus = "AB"; aCustomerOrderRow.OrderedQuantity = 1; aCustomerOrderRow.PickedQuantity = 2; aCustomerOrderRow.DiscrepancyQuantity = 3; aCustomerOrderRow.DiscrepancyCode = "DC"; aCustomerOrderRow.DiscrepancyText = "Disp"; aCustomerOrderRow.ExternalDiscrepancyCode = "ExtDisp"; aCustomerOrderRowList.Add(aCustomerOrderRow); } return(aCustomerOrderRowList); }
public CustomerOrderInfoDoc GetCustomerOrderInfo( string PartnerName, string LanguageId, string ClientIdentity, string OrderNumber, Nullable <int> OrderSequence) { if ((PartnerName == "") || (PartnerName == null)) { // test mode! CustomerOrderInfoDoc testres = new CustomerOrderInfoDoc(); ArrayList aCustomerOrderList = CustomerOrder.MakeTestData(); ArrayList aCustomerWorkOrderList = CustomerWorkOrder.MakeTestData(); ArrayList aDepartureList = Departure.MakeTestData(); ArrayList aOrderQuantitiesList = OrderQuantities.MakeTestData(); ArrayList aCustomerOrderRowList = CustomerOrderRow.MakeTestData(); testres.aCustomerOrderList = aCustomerOrderList.ToArray(typeof(CustomerOrder)) as CustomerOrder[]; testres.aCustomerWorkOrderList = aCustomerWorkOrderList.ToArray(typeof(CustomerWorkOrder)) as CustomerWorkOrder[]; testres.aDepartureList = aDepartureList.ToArray(typeof(Departure)) as Departure[]; testres.aOrderQuantitiesList = aOrderQuantitiesList.ToArray(typeof(OrderQuantities)) as OrderQuantities[]; testres.aCustomerOrderRowList = aCustomerOrderRowList.ToArray(typeof(CustomerOrderRow)) as CustomerOrderRow[]; return(testres); } CustomerOrderInfoDoc res = new CustomerOrderInfoDoc(); using (DBHelper dbHelper = new DBHelper(PartnerName)) { try { WebServicesQuery pkg = new WebServicesQuery(dbHelper.GetDataBase()); IDataReader aCustomerOrderRdr = null; IDataReader aCustomerWorkOrderRdr = null; IDataReader aDepartureRdr = null; IDataReader aOrderQuantitiesRdr = null; IDataReader aCustomerOrderRowRdr = null; pkg.Getcustomerorderinfo(ClientIdentity, OrderNumber, OrderSequence, LanguageId, out aCustomerOrderRdr, out aCustomerWorkOrderRdr, out aDepartureRdr, out aOrderQuantitiesRdr, out aCustomerOrderRowRdr); ArrayList aCustomerOrderList = CustomerOrder.Read(aCustomerOrderRdr); ArrayList aCustomerWorkOrderList = CustomerWorkOrder.Read(aCustomerWorkOrderRdr); ArrayList aDepartureList = Departure.Read(aDepartureRdr); ArrayList aOrderQuantitiesList = OrderQuantities.Read(aOrderQuantitiesRdr); ArrayList aCustomerOrderRowList = CustomerOrderRow.Read(aCustomerOrderRowRdr); res.aCustomerOrderList = aCustomerOrderList.ToArray(typeof(CustomerOrder)) as CustomerOrder[]; res.aCustomerWorkOrderList = aCustomerWorkOrderList.ToArray(typeof(CustomerWorkOrder)) as CustomerWorkOrder[]; res.aDepartureList = aDepartureList.ToArray(typeof(Departure)) as Departure[]; res.aOrderQuantitiesList = aOrderQuantitiesList.ToArray(typeof(OrderQuantities)) as OrderQuantities[]; res.aCustomerOrderRowList = aCustomerOrderRowList.ToArray(typeof(CustomerOrderRow)) as CustomerOrderRow[]; dbHelper.GetDataBase().Commit(); } catch (Exception e) { try { dbHelper.GetDataBase().Rollback(); } catch (Exception) { } Exception InternalError = new Exception("DataError: Error processing data", e); throw (InternalError); } } return(res); }