Ejemplo n.º 1
0
 public ClientBuildingAndBuildingPackage CreateBuilding(IModalDialogService modalDialogService, IServiceFactory serviceFactory,
     ClientPrimitive client)
 {
     var viewModel = new UpdateBuildingViewModel(modalDialogService, serviceFactory);
       //viewModel.Contractor = contractor;
       viewModel.BuildingAndClient = new ClientBuildingAndBuildingPackage();
       viewModel.BuildingAndClient.Building = new BuildingPrimitive();
       viewModel.BuildingAndClient.Client = client;
       viewModel.DialogMode = DialogMode.Create;
       ModalDialogHelper<UpdateBuilding>.ShowDialog(viewModel);
       if (!viewModel.IsCanceled)
       {
     return viewModel.BuildingAndClient;
       }
       return null;
 }
Ejemplo n.º 2
0
 public ClientPrimitive EditClient(IModalDialogService modalDialogService, IServiceFactory serviceFactory, ClientPrimitive client)
 {
     var viewModel = new UpdateClientViewModel(modalDialogService, serviceFactory);
       viewModel.Client = client;
       viewModel.DialogMode = DialogMode.Update;
       ModalDialogHelper<UpdateClient>.ShowDialog(viewModel);
       return viewModel.Client;
 }
Ejemplo n.º 3
0
        public static ClientPrimitive GetPrimitiveCopy(this ClientPrimitive primitiveToCopy)
        {
            if (primitiveToCopy == null) return null;

                ClientPrimitive primitive = new ClientPrimitive();

                primitive.Id = primitiveToCopy.Id;

                primitive.InternalName = primitiveToCopy.InternalName;

                primitive.NIP = primitiveToCopy.NIP;

                primitive.Name = primitiveToCopy.Name;

                primitive.City = primitiveToCopy.City;

                primitive.Street = primitiveToCopy.Street;

                primitive.ZIPCode = primitiveToCopy.ZIPCode;

                primitive.HouseNo = primitiveToCopy.HouseNo;

                primitive.Phone = primitiveToCopy.Phone;

                primitive.Deleted = primitiveToCopy.Deleted;

                primitive.Deactivated = primitiveToCopy.Deactivated;

                return primitive;
        }
Ejemplo n.º 4
0
        public static ClientPrimitive GetPrimitive(this Client entity)
        {
            ClientPrimitive primitive = new ClientPrimitive();

                primitive.Id = entity.Id;

                primitive.InternalName = entity.InternalName;

                primitive.NIP = entity.NIP;

                primitive.Name = entity.Name;

                primitive.City = entity.City;

                primitive.Street = entity.Street;

                primitive.ZIPCode = entity.ZIPCode;

                primitive.HouseNo = entity.HouseNo;

                primitive.Phone = entity.Phone;

                primitive.Deleted = entity.Deleted;

                primitive.Deactivated = entity.Deactivated;

                return primitive;
        }
Ejemplo n.º 5
0
 public void UndeleteClient(ClientPrimitive clientPrimitive)
 {
     try
       {
     //TODO: if is not used in any DeliveryNotes than delete.
     using (SmartWorkingEntities context = new SmartWorkingEntities())
     {
       Client car = context.Clients.Where(x => x.Id == clientPrimitive.Id).FirstOrDefault();
       if (car != null)
       {
     car.Deleted = null;
     context.SaveChanges();
       }
       else
       {
     throw new Exception("This car does not exist in db.");
       }
     }
       }
       catch (Exception e)
       {
     throw new FaultException<ExceptionDetail>(new ExceptionDetail(e), e.Message);
       }
 }