public static MaterialAndContractorsPackage GetPackageCopy(this MaterialAndContractorsPackage source) { MaterialAndContractorsPackage package = new MaterialAndContractorsPackage(); package.Material = source.Material.GetPrimitiveCopy(); package.Deliverer = source.Deliverer.GetPrimitiveCopy(); package.Producer = source.Producer.GetPrimitiveCopy(); return package; }
/// <summary> /// Opens dialog for creating the recipe component. /// </summary> /// <param name="modalDialogService">The modal dialog service.</param> /// <param name="serviceFactory">The service factory.</param> /// <param name="recipe">The recipe for which the <see cref="RecipeComponent"/>s will be added.</param> /// <returns></returns> public RecipeComponentPrimitive CreateRecipeComponent(IModalDialogService modalDialogService, IServiceFactory serviceFactory, RecipePrimitive recipePrimitive, MaterialAndContractorsPackage materialAndContractorsPackage) { var viewModel = new UpdateRecipeComponentViewModel(modalDialogService, serviceFactory); viewModel.RecipeComponent = new RecipeComponentPrimitive(); viewModel.RecipeComponent.Recipe_Id = recipePrimitive.Id; viewModel.MaterialAndContractors = materialAndContractorsPackage; viewModel.DialogMode = DialogMode.Create; ModalDialogHelper<UpdateRecipeComponent>.ShowDialog(viewModel); if (!viewModel.IsCanceled) { return viewModel.RecipeComponent; } return null; }
public MaterialAndContractorsPackage EditMaterial(IModalDialogService modalDialogService, IServiceFactory serviceFactory, MaterialAndContractorsPackage selectedMaterial) { var viewModel = new UpdateMaterialViewModel(modalDialogService, serviceFactory); viewModel.MaterialAndContractors = selectedMaterial; viewModel.DialogMode = DialogMode.Update; ModalDialogHelper<UpdateMaterial>.ShowDialog(viewModel); return viewModel.MaterialAndContractors; }
public static MaterialAndContractorsPackage GetMaterialAndContractorsPackage(this Material material) { MaterialAndContractorsPackage result = new MaterialAndContractorsPackage(); if (material != null) { result.Material = material.GetPrimitive(); if (material.Producer != null) { result.Producer = material.Producer.GetPrimitive(); } if (material.Deliverer != null) { result.Deliverer = material.Deliverer.GetPrimitive(); } } return result; }