public static YellowstonePathology.Business.ClientOrder.Model.ShipmentListItemCollection GetShipmentListItemCollection(int clientId) { YellowstonePathology.Business.ClientOrder.Model.ShipmentListItemCollection resultCollection = new YellowstonePathology.Business.ClientOrder.Model.ShipmentListItemCollection(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = " Select * from tblShipment where ClientId = @ClientId and (ShipDate is null or datediff(dd, ShipDate, getdate()) < 8) order by ShipDate Desc"; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value = clientId; using (SqlConnection cn = new SqlConnection(ServerSqlConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.ClientOrder.Model.ShipmentListItem shipmentListItem = new YellowstonePathology.Business.ClientOrder.Model.ShipmentListItem(); YellowstonePathology.Business.Domain.Persistence.DataReaderPropertyWriter propertyWriter = new Business.Domain.Persistence.DataReaderPropertyWriter(dr); shipmentListItem.WriteProperties(propertyWriter); resultCollection.Add(shipmentListItem); } } } return resultCollection; }
public static YellowstonePathology.Business.ClientOrder.Model.ShipmentListItemCollection GetShipmentListItemCollection(int clientId) { YellowstonePathology.Business.ClientOrder.Model.ShipmentListItemCollection resultCollection = new YellowstonePathology.Business.ClientOrder.Model.ShipmentListItemCollection(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = " Select * from tblShipment where ClientId = @ClientId and (ShipDate is null or datediff(dd, ShipDate, getdate()) < 8) order by ShipDate Desc"; cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value = clientId; using (SqlConnection cn = new SqlConnection(ServerSqlConnectionString)) { cn.Open(); cmd.Connection = cn; using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { YellowstonePathology.Business.ClientOrder.Model.ShipmentListItem shipmentListItem = new YellowstonePathology.Business.ClientOrder.Model.ShipmentListItem(); YellowstonePathology.Business.Domain.Persistence.DataReaderPropertyWriter propertyWriter = new Business.Domain.Persistence.DataReaderPropertyWriter(dr); shipmentListItem.WriteProperties(propertyWriter); resultCollection.Add(shipmentListItem); } } } return(resultCollection); }
private void GetShipments() { YellowstonePathology.YpiConnect.Proxy.ClientOrderServiceProxy proxy = new Proxy.ClientOrderServiceProxy(); this.m_ShipmentListItemCollection = proxy.GetShipmentListItemCollection(YellowstonePathology.YpiConnect.Contract.Identity.ApplicationIdentity.Instance.WebServiceAccount.PrimaryClientId); NotifyPropertyChanged("ShipmentListItemCollection"); }