public long AddTool(ToolRepresentation tool) { using (ISQLConnection dataSource = DataSource) { return(dataSource.AddTool(RepresentationConverter.convertTool(tool))); } }
public void UpdateTool(ToolRepresentation tool) { using (ISQLConnection datasource = DataSource) { datasource.UpdateTool(RepresentationConverter.convertTool(tool)); } }
public NewTool_ViewModel() { if (!this.IsInDesignMode) { newTool = new ToolRepresentation() { ValidationRules = new ToolValidationRules() }; newTool.toolStatus = new ToolStatusRepresentation() { id = 1 }; newTool.fromDate = DateTime.Today; newTool.defaultDeposit = 0; } }
public static ToolRepresentation convertTool(Tools tool) { ToolRepresentation convertedTool = new ToolRepresentation() { id = tool.toolID, defaultDeposit = tool.defaultDeposit, fromDate = tool.fromDate, IDNumber = tool.IDNumber, isDeleted = tool.isDeleted, rentCounter = tool.rentCounter, rentPrice = tool.rentPrice, serialNumber = tool.serialNumber, toolManufacturer = tool.toolManufacturer, toolName = tool.toolName, toolStatus = RepresentationConverter.convertToolStatus(tool.ToolStatuses) }; return(convertedTool); }
public static Tools convertTool(ToolRepresentation tool) { Tools convertedTool = new Tools() { toolID = tool.id, defaultDeposit = tool.defaultDeposit, fromDate = tool.fromDate, IDNumber = tool.IDNumber, isDeleted = tool.isDeleted, rentCounter = tool.rentCounter, rentPrice = tool.rentPrice, serialNumber = tool.serialNumber, toolManufacturer = tool.toolManufacturer, toolName = tool.toolName, toolStatusID = tool.toolStatus.id }; return(convertedTool); }
private void BuildSearchToolWindow() { if (toolPickerUC == null) { toolPickerUC = new searchTool(); toolPicker_VM = toolPickerUC.DataContext as searchTool_ModelView; } toolPickerWindow = new Window() { Content = toolPickerUC, Title = "Gép választó", SizeToContent = SizeToContent.WidthAndHeight }; toolPicker_VM.ToolSelected += (s, a) => { ToolRepresentation tool = s as ToolRepresentation; tool.ValidationRules = new ToolValidationRules(); viewModel.selectedTool = tool; toolPickerWindow.Hide(); }; }
public static void Send(ToolRepresentation t) { Messenger.Default.Send(t, MessageTypes.toolModified); }
public NewRent_SubTab() { CustomerSelector UCCustomerSelector; ToolSelector UCToolSelector; InitializeComponent(); UCCustomerSelector = new CustomerSelector(OperationTypeEnum.Rental); grdCustomer.Children.Add(UCCustomerSelector); UCToolSelector = new ToolSelector(); grdToolSelect.Children.Add(UCToolSelector); var UCNewRent = new NewRent(); grdNewRent.Children.Add(UCNewRent); UCCustomerSelector.customerPicker_VM.CustomerSelected += (s, a) => { CustomerBaseRepresentation customer = (CustomerBaseRepresentation)s; UCNewRent.newRent_VM.newRental.customer = customer; UCNewRent.newRent_VM.newRental.discount = customer.defaultDiscount; UCCustomerSelector.expCustomer.IsExpanded = false; }; UCCustomerSelector.viewModel.contactSelected += (s, a) => { UCNewRent.newRent_VM.newRental.contact = (PersonRepresentation)s; }; UCToolSelector.toolPicker_VM.ToolSelected += (s, a) => { ToolRepresentation tool = s as ToolRepresentation; tool.ValidationRules = new ToolValidationRules(); UCNewRent.newRent_VM.newRental.tool = tool; }; UCNewRent.newRent_VM.RentGroupChanged += (s, a) => { RentalGroup_Representation rentalGroup = s as RentalGroup_Representation; if (rentalGroup.rentals.Count() != 0) { ((CustomerSelector_ViewModel)UCCustomerSelector.DataContext).isReadonly = true; } else { ((CustomerSelector_ViewModel)UCCustomerSelector.DataContext).isReadonly = false; } ((ToolSelector_ViewModel)UCToolSelector.DataContext).selectedTool = null; }; UCNewRent.newRent_VM.RentalGroupFinalizationRequested += (s, a) => { NewRentGroupWindow rg = new NewRentGroupWindow((RentalGroup_Representation)s); NewRentGroup_ViewModel newRentGroup_VM = rg.DataContext as NewRentGroup_ViewModel; newRentGroup_VM.rentGroupAccepted += (so, ar) => { UCNewRent.newRent_VM.newRentalGroup = new RentalGroup_Representation(); UCCustomerSelector.viewModel.selectedCustomer = null; UCToolSelector.viewModel.selectedTool = null; rg.Close(); }; newRentGroup_VM.rentGroupCancelled += (so, ar) => { rg.Close(); }; rg.Show(); }; }