partial void UpdateContactProcurement(ContactProcurement instance);
 partial void DeleteContactProcurement(ContactProcurement instance);
 partial void InsertContactProcurement(ContactProcurement instance);
		private void detach_ContactProcurements(ContactProcurement entity)
		{
			this.SendPropertyChanging();
			entity.Auction = null;
		}
		private void attach_ContactProcurements(ContactProcurement entity)
		{
			this.SendPropertyChanging();
			entity.Procurer = this;
		}
        private void SetupEditViewData(ContactProcurement contactProcurement)
        {
            int? auctionId = null;
            int? categoryId = null;
            int? procurerId = null;

            if (contactProcurement != null)
            {
                auctionId = contactProcurement.Auction_ID;
                categoryId = contactProcurement.Procurement.Category_ID;
                procurerId = contactProcurement.Procurer_ID;
            }

            ViewData["Auction_ID"] = GetAuctionSelectList(auctionId);
            ViewData["Category_ID"] = GetCategoriesSelectList(categoryId);
            ViewData["Procurer_ID"] = GetProcurerSelectList(procurerId);
            ViewData["CertificateOptions"] = GetCertificateSelectListItems();
            ViewData["ItemNumberPrefixes"] = SetupItemNumberPrefixSelectListItems();
        }
        private ActionResult CreateNewProcurement(FormCollection collection)
        {
            SetupCreateViewData(collection["ProcurementType"]);
            var procurementType = collection["procurementType"];

            try
            {
                var newProcurement = Repository.GetNewProcurement();
                var newContactProcurement = new ContactProcurement();
                newProcurement.ContactProcurement = newContactProcurement;

                UpdateModel(newProcurement,
                    ProcurementColumns());

                UpdateModel(newProcurement.ContactProcurement,
                    ContactProcurementColumns());

                newProcurement.ItemNumber = collection["ItemNumberPrefix"] + " - " + collection["ItemNumberSuffix"];

                SetupProcurementDonors(newProcurement, collection);

                if (collection["procurementType"] != null)
                    newProcurement.ProcurementType_ID =
                        Repository.GetProcurementTypeByName(collection["procurementType"]).ProcurementType_ID;

                Repository.AddProcurement(newProcurement);

                return RedirectToAction(procurementType);
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);

                throw;
            }
        }