public static bool UpdatePickup(RSReportsDataset.PickupTableRow pickup) { // bool updated = false; RSReportsServiceClient client = new RSReportsServiceClient(); try { Pickup p = new Pickup(); p.RecordID = !pickup.IsRecordIDNull() ? pickup.RecordID : 0; p.Driver = !pickup.IsDriverNull() ? pickup.Driver : ""; p.RouteName = !pickup.IsRt_NameNull() ? pickup.Rt_Name : ""; p.CustomerID = !pickup.IsCustomer_IDNull() ? pickup.Customer_ID : ""; p.CustomerName = !pickup.IsCustomerNameNull() ? pickup.CustomerName : ""; p.CustomerType = !pickup.IsCustTypeNull() ? pickup.CustType : ""; p.CustomerAddress = !pickup.IsAddressNull() ? pickup.Address : ""; p.CustomerCity = !pickup.IsCityNull() ? pickup.City : ""; p.CustomerState = !pickup.IsStateNull() ? pickup.State : ""; p.CustomerZip = !pickup.IsZipNull() ? pickup.Zip : ""; p.ActualOrderSize = !pickup.IsActOrdSizeNull() ? pickup.ActOrdSize : 0; p.ActualOrderWeight = !pickup.IsActOrdLbsNull() ? pickup.ActOrdLbs : 0; p.UnscheduledPickup = !pickup.IsUnsched_PUNull() ? pickup.Unsched_PU : ""; p.Comments = !pickup.IsCommentsNull() ? pickup.Comments : ""; p.ActualCommodity = !pickup.IsActCmdtyNull() ? pickup.ActCmdty : ""; updated = client.UpdatePickup(p); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <RoadshowFault> rfe) { client.Abort(); throw new ApplicationException(rfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(updated); }
public static bool UpdatePickups(RSReportsDataset pickups) { // bool ret = false; if (pickups.HasChanges()) { RSReportsDataset _pickups = (RSReportsDataset)pickups.GetChanges(DataRowState.Modified); for (int i = 0; i < _pickups.PickupTable.Rows.Count; i++) { RSReportsDataset.PickupTableRow pickup = _pickups.PickupTable[i]; bool changed = UpdatePickup(pickup); } pickups.AcceptChanges(); } ret = true; return(ret); }