public ActionResult PrintTravelCard_US(string ItemID) { ItemID = ItemID.ToUpper(); int count = 0; bool canedit = CanUserEdit(); if (ItemID.Length > 0) { GetUserInfo(); string name = username.ToLower().Trim(); TravelCardViewModel viewModel = new TravelCardViewModel { UserSetting = _usersettingRepository.UserSetting.FirstOrDefault(a => a.UserName == name), PartSetUp = _partsetupRepository.PartSetUp.FirstOrDefault(x => x.PartID == ItemID), ItemID = ItemID, CanUserEdit = canedit, }; viewModel.Plant = _plantRepository.Plant.FirstOrDefault(a => a.PlantCodeID == viewModel.UserSetting.PlantCodeID); string plant = viewModel.Plant.PlantCode; // viewModel.Component = _componentsRepository.GetByID(ItemID,plant); viewModel.Part = _partsRepository.GetByID(ItemID, plant); // viewModel.Component.Where(a => a.Id != ItemID); // viewModel.ParentComponent = _componentsRepository.GetParentComponentByID(viewModel.ItemID, plant); count = viewModel.Part.Count(); if (count > 0) { if (viewModel.PartSetUp == null) { var message = "A Travel Card for this part could not be found.<br > Please contact the quality department."; ViewData["NoResultMessage"] = message; } return(View("PrintTravelCard_US", viewModel)); } if (count == 0) { var message = "Your search returned no results. Please try again."; ViewData["NoResultMessage"] = message; ViewData["PartID"] = ItemID; return(View("PrintTravelCard_US", viewModel)); } } return(View()); }
public void CanRetrievePartDetails() { //this is a test of the parts repository testPart = new Part(); string plantid = "06"; Part = partsRepository.GetByID("1073000", plantid); string partdesc = Part.Select(x => x.ALTDESC).FirstOrDefault(); if (partdesc.Length > 0) { Assert.IsNotNull(partdesc); } }
public string GetComponentName(IPartsRepository <Part> partsRepository_, string partid) { GetUserInfo(); string name = username.ToString().Trim(); var viewModel = new TravelCardViewModel { UserSetting = _usersettingRepository.UserSetting.FirstOrDefault(a => a.UserName == name), }; viewModel.Plant = _plantRepository.Plant.FirstOrDefault(a => a.PlantCodeID == viewModel.UserSetting.PlantCodeID); string plant = viewModel.Plant.PlantCode; var componentdescription = partsRepository_.GetByID(partid, plant); string componenttextdescription = componentdescription.Select(x => x.ITMDESC).ToString(); return(componenttextdescription); }