public GetLongIdResponse DoesMaterialNameExist(string materialName) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesMaterialNameExist(materialName); return(response); }
public GetLongIdResponse DoesFoliageExist(FoliageDTO foliage) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesFoliageExist(foliage); return(response); }
public GetLongIdResponse ImportFoliage(ImportFoliageRequest request) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.ImportFoliage(request); return(response); }
public GetLongIdResponse DoesPlantExist(PlantDTO plantDTO) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesPlantExist(plantDTO); return(response); }
public GetLongIdResponse ImportImage(AddImageRequest request) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.AddPlantImage(request.imgBytes); return(response); }
public GetLongIdResponse ServiceCodeIsNotUnique(string serviceCode) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.ServiceCodeIsNotUnique(serviceCode); return(response); }
public GetLongIdResponse DoesPlantTypeExist(string plantType) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesPlantTypeExist(plantType); return(response); }
public GetLongIdResponse ImportContainer(ImportContainerRequest request) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.ImportContainer(request); return(response); }
public GetLongIdResponse DoesServiceCodeExist(ServiceCodeDTO serviceCodeDTO) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesServiceCodeExist(serviceCodeDTO); return(response); }
public GetLongIdResponse DoesContainerExist(ContainerDTO container) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesContainerExist(container); return(response); }
public GetLongIdResponse DoesContainerNameExist(string containerName) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesContainerNameExist(containerName); return(response); }
public GetLongIdResponse ImportMaterial(ImportMaterialRequest request) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.ImportMaterial(request); return(response); }
public GetLongIdResponse DoesMaterialExist(MaterialDTO material) { GetLongIdResponse response = new GetLongIdResponse(); response.returnedId = inventoryManager.DoesMaterialExist(material); return(response); }
private long ImportImage(string fileName) { long newImageId = 0; try { byte[] ImageData; FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); ImageData = br.ReadBytes((int)fs.Length); br.Close(); fs.Close(); AddImageRequest request = new AddImageRequest(); request.imgBytes = ImageData; string jsonData = JsonConvert.SerializeObject(request); StringContent content = new StringContent(jsonData, Encoding.UTF8, "application/json"); string result = Post("ImportImage", content); GetLongIdResponse r = JsonConvert.DeserializeObject <GetLongIdResponse>(result); newImageId = r.returnedId; } catch (Exception ex) { } return(newImageId); }
private void ImportMaterial(KeyValuePair <int, List <ExcelRowData> > kvp, ExcelPicture img) { //check for presence of plantName - add if not present long materialNameId = 0; int column = columnIndicesAndNames.Where(a => a.Value == "NAME").Select(b => b.Key).First(); string materialName = rowData[kvp.Key].Where(a => a.column == column).Select(b => b.data).FirstOrDefault() as string; string result = Get("DoesMaterialNameExist", "materialName=" + materialName); GetLongIdResponse r = JsonConvert.DeserializeObject <GetLongIdResponse>(result); materialNameId = r.returnedId; column = columnIndicesAndNames.Where(a => a.Value == "SIZE").Select(b => b.Key).First(); string materialSize = rowData[kvp.Key].Where(a => a.column == column).Select(b => b.data).FirstOrDefault() as string; //check for presence of plantType - add if not present long materialTypeId = 0; column = columnIndicesAndNames.Where(a => a.Value == "TYPE").Select(b => b.Key).First(); string materialType = rowData[kvp.Key].Where(a => a.column == column).Select(b => b.data).FirstOrDefault() as string; result = Get("DoesMaterialTypeExist", "materialType=" + materialType); r = JsonConvert.DeserializeObject <GetLongIdResponse>(result); materialTypeId = r.returnedId; ////using cost, retail, plantName and plant Type, check for presence of service code - add if not present //ServiceCodeDTO serviceCode = GetServiceCodeDTO(kvp); //string jsonData = JsonConvert.SerializeObject(serviceCode); //var content = new StringContent(jsonData, Encoding.UTF8, "application/json"); //result = Post("DoesServiceCodeExist", content); long serviceCodeId = 0; column = columnIndicesAndNames.Where(a => a.Value == "CODE").Select(b => b.Key).First(); string serviceCode = rowData[kvp.Key].Where(a => a.column == column).Select(b => b.data).FirstOrDefault() as string; result = Get("ServiceCodeIsNotUnique", "serviceCode=" + serviceCode); r = JsonConvert.DeserializeObject <GetLongIdResponse>(result); serviceCodeId = r.returnedId; //check for presence of plant - add if not present long materialId = 0; MaterialDTO materialDTO = GetMaterialDTO(kvp); string jsonData = JsonConvert.SerializeObject(materialDTO); StringContent content = new StringContent(jsonData, Encoding.UTF8, "application/json"); result = Post("DoesMaterialExist", content); r = JsonConvert.DeserializeObject <GetLongIdResponse>(result); materialId = r.returnedId; //check for presence of inventory - add if not present ImportMaterialRequest request = new ImportMaterialRequest(); //add image if present if (img != null) { ImageConverter imgCon = new ImageConverter(); request.imageBytes = (byte[])imgCon.ConvertTo(img.Image, typeof(byte[])); } //create DTO - send to service - backend will do the hookup request.MaterialSize = materialSize; request.AddMaterialRequest.Material.MaterialSize = materialSize; if (materialNameId == 0) { request.MaterialName = materialName; } else { request.AddMaterialRequest.Material.MaterialNameId = materialNameId; } if (materialTypeId == 0) { request.MaterialType = materialType; } else { request.AddMaterialRequest.Material.MaterialTypeId = materialTypeId; } request.ServiceCode = GetServiceCodeDTO(kvp); if (serviceCodeId > 0) { ServiceCodeDTO original = GetServiceCodeById(serviceCodeId); UpdateServiceCode(original, request.ServiceCode); request.ServiceCode = original; request.ServiceCode.ServiceCodeId = serviceCodeId; request.AddMaterialRequest.Inventory.ServiceCodeId = serviceCodeId; } jsonData = JsonConvert.SerializeObject(request); content = new StringContent(jsonData, Encoding.UTF8, "application/json"); Post("ImportMaterial", content); }