public static PurchaseOrderHeaderCharge CreatePurchaseOrderHeaderCharge(string dataAreaId,
                                                                                string purchaseOrderNumber,
                                                                                decimal chargeLineNumber,
                                                                                decimal proportionalChargeAmount,
                                                                                decimal chargePercentage,
                                                                                decimal fixedChargeAmount,
                                                                                decimal externalChargeAmount,
                                                                                global::Microsoft.Dynamics.DataEntities.PurchaseOrderHeaderV2 purchaseOrderHeaderV2,
                                                                                global::Microsoft.Dynamics.DataEntities.Currency currency)
        {
            PurchaseOrderHeaderCharge purchaseOrderHeaderCharge = new PurchaseOrderHeaderCharge();

            purchaseOrderHeaderCharge.dataAreaId               = dataAreaId;
            purchaseOrderHeaderCharge.PurchaseOrderNumber      = purchaseOrderNumber;
            purchaseOrderHeaderCharge.ChargeLineNumber         = chargeLineNumber;
            purchaseOrderHeaderCharge.ProportionalChargeAmount = proportionalChargeAmount;
            purchaseOrderHeaderCharge.ChargePercentage         = chargePercentage;
            purchaseOrderHeaderCharge.FixedChargeAmount        = fixedChargeAmount;
            purchaseOrderHeaderCharge.ExternalChargeAmount     = externalChargeAmount;
            if ((purchaseOrderHeaderV2 == null))
            {
                throw new global::System.ArgumentNullException("purchaseOrderHeaderV2");
            }
            purchaseOrderHeaderCharge.PurchaseOrderHeaderV2 = purchaseOrderHeaderV2;
            if ((currency == null))
            {
                throw new global::System.ArgumentNullException("currency");
            }
            purchaseOrderHeaderCharge.Currency = currency;
            return(purchaseOrderHeaderCharge);
        }
        public PurchaseOrderHeaderCharge Create(PurchaseOrderHeaderCharge pt)
        {
            pt.ObjectState = ObjectState.Added;
            _unitOfWork.Repository <PurchaseOrderHeaderCharge>().Insert(pt);

            return(pt);
        }
 public void Update(PurchaseOrderHeaderCharge pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <PurchaseOrderHeaderCharge>().Update(pt);
 }
 public PurchaseOrderHeaderCharge Add(PurchaseOrderHeaderCharge pt)
 {
     _unitOfWork.Repository <PurchaseOrderHeaderCharge>().Insert(pt);
     return(pt);
 }
 public void Delete(PurchaseOrderHeaderCharge pt)
 {
     _unitOfWork.Repository <PurchaseOrderHeaderCharge>().Delete(pt);
 }