public static TransactionHistory CreateTransaction(PartInfo partInfo, string dealerCode, long actWarehouse, long? toWarehouse, DateTime transDate, string transCode, int cost, int qty, string comment, string invNo, long? vendorId)
        {
            //var db = new PartDataContext(); // must create another data context
            var db = DCFactory.GetDataContext<PartDataContext>();
            var trans = new TransactionHistory
            {
                ActualCost = cost,
                CreatedBy = UserHelper.Username,
                CreatedDate = DateTime.Now,
                DealerCode = dealerCode,
                InvoiceNumber = invNo,
                PartInfoId = partInfo.PartInfoId,
                Quantity = qty,
                TransactionCode = transCode,
                TransactionComment = comment,
                TransactionDate = transDate,
                SecondaryWarehouseId = toWarehouse,
                VendorId = vendorId,
                WarehouseId = actWarehouse,
            };

            db.TransactionHistories.InsertOnSubmit(trans);
            return trans;
        }
 private void detach_TransactionHistories(TransactionHistory entity)
 {
     this.SendPropertyChanging();
     entity.PartInfo = null;
 }
 private void detach_TransactionHistories1(TransactionHistory entity)
 {
     this.SendPropertyChanging();
     entity.Warehouse1 = null;
 }
 private void attach_TransactionHistories(TransactionHistory entity)
 {
     this.SendPropertyChanging();
     entity.Dealer = this;
 }
 private void detach_TransactionHistories(TransactionHistory entity)
 {
     this.SendPropertyChanging();
     entity.SystemData = null;
 }
 private void attach_TransactionHistories1(TransactionHistory entity)
 {
     this.SendPropertyChanging("TransactionHistories1");
     entity.Warehouse1 = this;
 }
 private void detach_TransactionHistories(TransactionHistory entity)
 {
     this.SendPropertyChanging("TransactionHistories");
     entity.Vendor = null;
 }
 private void attach_TransactionHistories(TransactionHistory entity)
 {
     this.SendPropertyChanging("TransactionHistories");
     entity.SystemData = this;
 }
 private void attach_TransactionHistories(TransactionHistory entity)
 {
     this.SendPropertyChanging("TransactionHistories");
     entity.PartInfo = this;
 }