예제 #1
0
파일: POList.cs 프로젝트: rphatdad/AFI
        public void UpdatePO(PO PO)
        {
            // Initialize SPROC
            SqlConnection conn = new SqlConnection(ConnectionString);
            SqlCommand cmd = new SqlCommand("SPPOUpdate", conn);
            cmd.CommandType = CommandType.StoredProcedure;

            // Update Parameters
            cmd.Parameters.AddWithValue("@Id", PO.Id);
            cmd.Parameters.AddWithValue("@PoNumber", PO.PoNumber);
            cmd.Parameters.AddWithValue("@CustomerID", PO.CustomerID);
            cmd.Parameters.AddWithValue("@PartNumber", PO.PartNumber);
            cmd.Parameters.AddWithValue("@TrackingNumber", PO.TrackingNumber);
            cmd.Parameters.AddWithValue("@ReceiveDate", PO.ReceiveDate);
            cmd.Parameters.AddWithValue("@HotPart", PO.HotPart);
            cmd.Parameters.AddWithValue("@Color", PO.Color);
            cmd.Parameters.AddWithValue("@Comments", PO.Comments);
            cmd.Parameters.AddWithValue("@InitialQty", PO.InitialQty);
            cmd.Parameters.AddWithValue("@OnHandQty", PO.OnHandQty);
            cmd.Parameters.AddWithValue("@InventoryQty", PO.InventoryQty);
            cmd.Parameters.AddWithValue("@FabRejectQty", PO.FabRejectQty);
            cmd.Parameters.AddWithValue("@PaintRejectQty", PO.PaintRejectQty);
            cmd.Parameters.AddWithValue("@ShippedQty", PO.ShippedQty);
            cmd.Parameters.AddWithValue("@POStatus", PO.POStatus);
            cmd.Parameters.AddWithValue("@RcvComment", PO.RcvComment);
            cmd.Parameters.AddWithValue("@InvComment", PO.InvComment);
            cmd.Parameters.AddWithValue("@ShipComment", PO.ShipComment);
            cmd.Parameters.AddWithValue("@ShipTo", PO.ShipTo);
            cmd.Parameters.AddWithValue("@BillTo", PO.BillTo);
            if (PO.CloseDate == null)
            {
                cmd.Parameters.AddWithValue("@CloseDate", System.DBNull.Value);

            }
            else
            {
                cmd.Parameters.AddWithValue("@CloseDate", PO.CloseDate);
            }
            if (PO.LastShipDate == null)
            {
                cmd.Parameters.AddWithValue("@LastShipDate", System.DBNull.Value);

            }
            else
            {
                cmd.Parameters.AddWithValue("@LastShipDate", PO.LastShipDate);
            }
            cmd.Parameters.AddWithValue("@DaysAtAFI", PO.GetDaysatAFI());
            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
            reload();
        }