public void Return_Deep_Part() { IPartsService repo = new PartsService(new BadgerDataModel()); var part = repo.Find(1); Assert.IsTrue(part != null); }
public void Add_Resource_To_Part() { IPartsService repo = new PartsService(new BadgerDataModel()); PartDetailDTO part = new PartDetailDTO(); part.UnitCost = 1.25m; part.ItemDescription = "Master Widjet 1023"; part.ItemName = "MW-1023"; part.PartNum = "MW-10034"; part.MarkUp = 1.25m; part.Waste = 2.0m; part.Weight = 12.25m; part.UID = 1; part.ManuId = 245; part.Location = "AC23"; part.Obsolete = false; part.Sku = "1023847A990"; ResourceDto resource = new ResourceDto { ResourceDescription = "Chipman Home Network", CurrentVersion = 1, Data = File.ReadAllBytes(@"C:\Users\Rich.DESIGNSYNTHESIS\Documents\chipmanHomeNetwork.sdr") }; part.Resources.Add(resource); repo.InsertOrUpdate(part, "Richard Young"); Assert.IsTrue(1 == 1); }
public void SetContext(BadgerDataModel context) { ctx = context; _partService = new PartsService(ctx); tvPartTypes.AfterSelect += TvPartTypes_AfterSelect; LoadTree(); }
public void Return_Part_Catergories_AND_Parttypes() { IPartsService repo = new PartsService(new BadgerDataModel()); var category = repo.GetPartCategories(); Assert.IsTrue(category != null); }
public void EditPart_ShouldSaveNewPartCorrectly() { var options = GetDbOptions("EditPart_Database"); var dummyPart = new Part() { Make = "Dummy", Model = "Part" }; using (var context = new RiderDBContext(options)) { context.Parts.Add(dummyPart); context.SaveChanges(); } Assert.Equal("Part", dummyPart.Model); Assert.Equal("Dummy", dummyPart.Make); dummyPart.Make = "Edited Make"; dummyPart.Model = "Edited Model"; Part actual; using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.EditPart(dummyPart); } Assert.Equal("Edited Model", actual.Model); Assert.Equal("Edited Make", actual.Make); }
public void GetPlayerPartByPartId_ShoudlReturnCorrectPlayerParts() { var options = GetDbOptions("GetPlayerPartByPartId_Database"); var dummyPlayer = new Player() { UserName = "******" }; var dummyPart1 = new Part() { Id = 1 }; var dummyPart2 = new Part() { Id = 2 }; var dummyPlayerPart1 = new PlayerParts() { Id = 12, Player = dummyPlayer, Part = dummyPart1 }; var dummyPlayerPart2 = new PlayerParts() { Id = 21, Player = dummyPlayer, Part = dummyPart2 }; using (var context = new RiderDBContext(options)) { context.PlayerParts.Add(dummyPlayerPart1); context.PlayerParts.Add(dummyPlayerPart2); context.SaveChanges(); } PlayerParts actual; using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetPlayerPartByPartId("Dummy", 2); } Assert.Equal(21, actual.Id); using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetPlayerPartByPartId("Dummy", 1); } Assert.Equal(12, actual.Id); using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetPlayerPartByPartId("Dummy", 3); } Assert.Null(actual); }
private Supplier ConvertIntToClass(AddPartVM src) { var service = new PartsService(); var suplier = service.Contex.Suppliers.Find(src.SupplierId); service.Contex.Dispose(); return(suplier); }
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; // calculate something for us to return int length = (activity.Text ?? string.Empty).Length; // direct to corresponding the interface if (activity.Text.ToUpper() == "SALES") { ISalesService obj = new SalesService(); await obj.Service(context, result); } else if (activity.Text.ToUpper() == "SERVICE") { IServiceService obj = new ServiceService(); await obj.Service(context, result); } else if (activity.Text.ToUpper() == "PARTS") { IPartsService obj = new PartsService(); await obj.Service(context, result); } else if (activity.Text.ToUpper() == "MENU") { // Main menu Activity reply = activity.CreateReply($"Please choose one of the departments you want to reach:"); reply.Type = ActivityTypes.Message; reply.TextFormat = TextFormatTypes.Plain; reply.SuggestedActions = new SuggestedActions() { Actions = new List <CardAction>() { new CardAction() { Title = "Sales", Type = ActionTypes.ImBack, Value = "SALES" }, new CardAction() { Title = "Service", Type = ActionTypes.ImBack, Value = "SERVICE" }, new CardAction() { Title = "Parts", Type = ActionTypes.ImBack, Value = "PARTS" } } }; await context.PostAsync(reply); } else { await context.PostAsync($"You have entered an invalid option. Please try again or type \"Menu\" to display the menu:"); } context.Wait(MessageReceivedAsync); }
public void GetPartById_ShouldReturnCorrectPart() { var options = GetDbOptions("GetPartById_Database"); var dummyPart1 = new Part() { Id = 2, Make = "dummyMake2", Model = "DummyModel2" }; var dummyPart2 = new Part() { Id = 4, Make = "dummyMake4", Model = "DummyModel4" }; var dummyPart3 = new Part() { Id = 6, Make = "dummyMake6", Model = "DummyModel6" }; using (var context = new RiderDBContext(options)) { context.Parts.Add(dummyPart1); context.Parts.Add(dummyPart2); context.Parts.Add(dummyPart3); context.SaveChanges(); } Part actual; using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetPartById(2); } Assert.True(actual.Id == 2); Assert.True(actual.Make == "dummyMake2"); Assert.True(actual.Model == "DummyModel2"); using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetPartById(6); } Assert.True(actual.Id == 6); Assert.True(actual.Make == "dummyMake6"); Assert.True(actual.Model == "DummyModel6"); using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetPartById(22); } Assert.True(actual == null); }
public bool Execute(ActionCallingContext oActionCallingContext) { Progress oProgress = new Progress("Состояние экспорта"); oProgress.SetAllowCancel(true); #region Прогресс бар 1 oProgress.BeginPart(60.0, ""); oProgress.SetActionText("Получение данных из проекта.."); oProgress.SetNeededSteps(1); oProgress.Step(1); #endregion //выбрать текущий проект SelectionSet Set = new SelectionSet(); Project CurrentProject = Set.GetCurrentProject(true); //пути файлов string exportXMLPath = CurrentProject.ProjectDirectoryPath + @"\Temp.xml"; string exportFilePath = CurrentProject.ProjectDirectoryPath + @"\DOC\Спецификация по шкафам.xlsx"; //выгрузка в XML PartsService partsService = new PartsService(); partsService.ExportPartsList(CurrentProject, exportXMLPath, 0); oProgress.EndPart(false); #region Прогресс бар 2 oProgress.BeginPart(25.0, ""); oProgress.SetActionText("Сортировка.."); oProgress.SetNeededSteps(1); oProgress.Step(1); #endregion //загрузка в лист ListOfDevices listOfDevices = new ListOfDevices(); List <Part> devices = listOfDevices.GetAllDevices(exportXMLPath); var partsFiltered = from p in devices where ((p.PartNo != "None") && (p.Quantity != 0) && (p.PartNo != "Шильд")) orderby p.PartNo select p; oProgress.EndPart(false); #region Прогресс бар 3 oProgress.BeginPart(15.0, ""); oProgress.SetActionText("Экспорт в Excel.."); oProgress.SetNeededSteps(1); oProgress.Step(1); #endregion XLSSerializer serializer = new XLSSerializer(); serializer.Serialize(exportFilePath, partsFiltered.ToList()); oProgress.EndPart(true); return(true); }
private ICollection <Part> ConvertAreaToParts(AddCarBM src) { var service = new PartsService(); var result = new List <Part>(); foreach (var itemId in src.Parts) { var tempPart = service.Contex.Parts.Find(int.Parse(itemId)); result.Add(tempPart); } service.Contex.Dispose(); return(result); }
public Main() { InitializeComponent(); dgProductGrid.AutoGenerateColumns = false; dgSubAssemblies.AutoGenerateColumns = false; ctx = new ProductionContext(); _unitsService = new ProductService(ctx); _jobService = new JobService(ctx); dgProductGrid.DataSource = bsProducts; dgSubAssemblies.DataSource = bsSubassemlies; // ----------------Wire Events------------------ this.Activated += Main_Activated; bsProducts.AddingNew += BsProducts_AddingNew; bsProducts.ListChanged += BsProducts_ListChanged; bsSubassemlies.AddingNew += BsSubassemlies_AddingNew; if (Knoodle.Properties.Settings.Default.LastSelectedJob != default) { _selectedJob = _jobService.GetDeepJob(Knoodle.Properties.Settings.Default.LastSelectedJob); LoadProducts(_selectedJob.JobID); } partsService = new PartsService(); partsService.LoadParts(); foreach (var p in partsService.Parts) { SourceMaterial mat = new SourceMaterial() { ItemID = p.Key }; mat.ItemID = p.Key; mat.MarkUp = p.Value.MarkUp.GetValueOrDefault(); mat.MaterialDescription = p.Value.ItemDescription; mat.MaterialName = p.Value.ItemName; mat.SupplierID = p.Value.SupplierID.GetValueOrDefault(); mat.UOM = p.Value.UID.GetValueOrDefault(); mat.Waste = p.Value.Waste.GetValueOrDefault(); mat.Weight = p.Value.Weight.GetValueOrDefault(); PartDictionary.PartSource.Add(mat.ItemID, mat); } int k = PartDictionary.PartSource.Count(); this.toolStripStatusLabel1.Text = String.Format("Parts Loaded : {0}", k.ToString()); }
public void GetAllParts_ShoudlReturnAllParts() { var options = GetDbOptions("GetAllParts_Database"); var actual = new List <Part>(); using (var context = new RiderDBContext(options)) { var bikesService = new PartsService(context); actual = bikesService.GetAllParts().ToList(); } Assert.True(actual.Count() == 0); var dummyPart1 = new Part() { Id = 2 }; var dummyPart2 = new Part() { Id = 4 }; var dummyPart3 = new Part() { Id = 6 }; using (var context = new RiderDBContext(options)) { context.Parts.Add(dummyPart1); context.Parts.Add(dummyPart2); context.Parts.Add(dummyPart3); context.SaveChanges(); } using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetAllParts().ToList(); } Assert.True(actual.Count() == 3); Assert.Contains(actual, x => x.Id == 2); Assert.Contains(actual, x => x.Id == 4); Assert.Contains(actual, x => x.Id == 6); }
public void SetDataSource(BadgerDataModel context, int partID) { ctx = context; partService = new PartsService(ctx); units = partService.Units(); // Load the Unit Combo ---- cboUnitOfMeasure.DisplayMember = "Uom"; cboUnitOfMeasure.ValueMember = "UID"; cboUnitOfMeasure.DataSource = units; loadData(7991); bsPart.ListChanged += BsPart_ListChanged; bsResources.ListChanged += BsResources_ListChanged; BindPart(); }
private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e) { IPartsService partService = new PartsService(_context); string foundBarCode = e.ValueRead.ToString(); if (foundBarCode != string.Empty) { int key = int.Parse(foundBarCode); var inv = partService.Find(key); if (inv != null) { Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = inv; })); Invoke(new MethodInvoker(() => { this.label1.Text = foundBarCode + " : Found"; })); } else { Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = null; })); Invoke(new MethodInvoker(() => { this.label1.Text = foundBarCode + " : No Match Found"; })); } } }
private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e) { IPartsService partService = new PartsService(_context); string foundBarCode = e.ValueRead.ToString(); if (foundBarCode != string.Empty) { if (_part != null) { _part.Sku = foundBarCode; //Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = inv; })); Invoke(new MethodInvoker(() => { this.txtSKU.Text = foundBarCode; })); } else { // Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = null; })); Invoke(new MethodInvoker(() => { this.txtSKU.Text = String.Empty; })); } barCodeReader.OnBarCodeRead -= Reader_OnBarCodeRead; } }
// Ctor ---------------------------- public SupplierOrdersControl(BadgerDataModel ctx) { InitializeComponent(); this.dgOrderItems.AutoGenerateColumns = false; _context = ctx; supService = new SuppliersService(ctx); labelService = new LabelService(); jobService = new JobsService(ctx); // Wireup the events -------------------------------------------------------------- txtSearchSuppliers.TextChanged += (txtJobSearch_TextChanged); this.lbSuppliers.SelectedIndexChanged += lbSuppliers_SelectedIndexChanged; lvSuppliersOrders.SelectedIndexChanged += lvSuppliersOrders_SelectedIndexChanged; //--------------------------------------------------------------------------------- ordersService = new OrdersService(ctx); lineItemService = new LineItemsService(ctx); txtSearchSuppliers.Text = (Properties.Settings.Default.LastSupplierSearch != string.Empty) ? Properties.Settings.Default.LastSupplierSearch : string.Empty; suppliers = supService.SuppliersWithOpenOrders(); this.lbSuppliers.DisplayMember = "SupplierName"; this.lbSuppliers.DataSource = suppliers; partsService = new PartsService(ctx); }
public void AddPart_ShouldAddPart() { var options = GetDbOptions("AddPart_Database"); var dummyPart = new Part(); Part actual; using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.AddPart(dummyPart); } var partsActual = new List <Part>(); using (var context = new RiderDBContext(options)) { partsActual = context.Parts.ToList(); } Assert.Equal(dummyPart, actual); Assert.Contains(partsActual, x => x.Id == dummyPart.Id); }
public void GetAllPlayerPartsByUserName_ShoudlReturnCorrectPlayerParts() { var options = GetDbOptions("GetAllPlayerPartsByUserName_Database"); var dummPlayer1 = new Player() { UserName = "******" }; var dummPlayer2 = new Player() { UserName = "******" }; var dummyPart1 = new Part() { Id = 1 }; var dummyPart2 = new Part() { Id = 2 }; var dummyPart3 = new Part() { Id = 3 }; var dummyPlayerPart1 = new PlayerParts() { Player = dummPlayer1, Part = dummyPart1 }; var dummyPlayerPart2 = new PlayerParts() { Player = dummPlayer1, Part = dummyPart2 }; var dummyPlayerPart3 = new PlayerParts() { Player = dummPlayer2, Part = dummyPart3 }; using (var context = new RiderDBContext(options)) { context.PlayerParts.Add(dummyPlayerPart1); context.PlayerParts.Add(dummyPlayerPart2); context.PlayerParts.Add(dummyPlayerPart3); context.SaveChanges(); } List <PlayerParts> actual; using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetAllPlayerPartsByUserName("Dummy1").ToList(); } Assert.True(actual.Count() == 2); Assert.Contains(actual, x => x.Id == dummyPlayerPart1.Id); Assert.Contains(actual, x => x.Id == dummyPlayerPart2.Id); using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetAllPlayerPartsByUserName("Dummy2").ToList(); } Assert.True(actual.Count() == 1); Assert.Contains(actual, x => x.Id == dummyPlayerPart3.Id); using (var context = new RiderDBContext(options)) { var partsService = new PartsService(context); actual = partsService.GetAllPlayerPartsByUserName("Dummy").ToList(); } Assert.True(actual.Count() == 0); }
public CarsController() { this.partsService = new PartsService(new EfGenericRepository <Part>(Data.Context())); this.carsService = new CarsService(new EfGenericRepository <Car>(Data.Context()), this.partsService); }
public PartsController() { this.service = new PartsService(); }
public PartsController(FSXAPIDBContext context) { _service = new PartsService(context); }
public PartsController() { this.service = new PartsService(Data.Context); }
public Factory(RobotService robotService, PartsService partsService) { _robotService = new RobotService(); _partsService = new PartsService(); _carService = new CarService(); }