public HttpResponseMessage UpdateReagentInfo(ProductInfoOperateDTO dto) { ResultDTO <object> actionresult = new ResultDTO <object>(); try { if (dto.UpType == 1)//正常修改 { actionresult.SubmitResult = _IIProductServices.UpdateReagentInfo(dto); } else if (dto.UpType == 2)//停启用 { actionresult.SubmitResult = _IIProductServices.StartOrStopReagentInfo(dto); } } catch (Exception e) { actionresult.SubmitResult = false; actionresult.Message = e.Message; } HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(actionresult), System.Text.Encoding.GetEncoding("UTF-8"), "application/json") }; return(result); }
public HttpResponseMessage UpdateStopEnableMaintenanceInfo(ProductInfoOperateDTO dto) { ResultDTO <object> resultdto = new ResultDTO <object>(); try { if (dto.UpType == 1)//正常修改 { resultdto.SubmitResult = _IProductServices.UpdateMaintenanceInfo(dto); } if (dto.UpType == 2)//停启用 { resultdto.SubmitResult = _IProductServices.StopEnableMaintenanceInfo(dto); } } catch (Exception ex) { resultdto.SubmitResult = false; resultdto.Message = ex.Message; } HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(resultdto), System.Text.Encoding.GetEncoding("UTF-8"), "application/json") }; return(result); }
public void TestMethod1() { //产品类型 //新增 ProductInfoSearchDTO searchdto = new ProductInfoSearchDTO(); searchdto.page = 1; searchdto.rows = 1; var searchdtostr = TransformHelper.ConvertDTOTOBase64JsonString(searchdto); testcontroller.GetReagentInfoList(searchdtostr); ProductInfoOperateDTO adddto = new ProductInfoOperateDTO(); adddto.ProductID = Guid.NewGuid(); adddto.ArtNo = "单元测试试剂产品货号"; adddto.CreateTime = DateTime.Now; adddto.IsMaintenance = false; adddto.ProductName = "单元测试试剂产品名称"; var addresultstr = testcontroller.AddReagentInfo(adddto).Content.ReadAsStringAsync().Result; var addresult = JsonConvert.DeserializeObject <ResultDTO <object> >(addresultstr); searchdto.rows = 10; searchdto.SearchText = "单元测试试剂产品名称"; searchdtostr = TransformHelper.ConvertDTOTOBase64JsonString(searchdto); var resultlist1str = testcontroller.GetReagentInfoList(searchdtostr).Content.ReadAsStringAsync().Result; var resultlist1 = JsonConvert.DeserializeObject <ResultDTO <List <ProductInfoResultDTO> > >(resultlist1str).Object; var target = resultlist1.Where(m => m.ProductName == "单元测试试剂产品名称").FirstOrDefault(); Assert.IsNotNull(target); //修改 adddto.ProductID = target.ProductID; adddto.ProductName = "修改单元测试试剂产品名称"; adddto.IsMaintenance = false; adddto.UpType = 1; var updateresultstr = testcontroller.UpdateReagentInfo(adddto).Content.ReadAsStringAsync().Result; var updateresult = JsonConvert.DeserializeObject <ResultDTO <object> >(updateresultstr); searchdto.SearchText = "修改单元测试试剂产品名称"; searchdtostr = TransformHelper.ConvertDTOTOBase64JsonString(searchdto); var resultlist2str = testcontroller.GetReagentInfoList(searchdtostr).Content.ReadAsStringAsync().Result; var resultlist2 = JsonConvert.DeserializeObject <ResultDTO <List <ProductInfoResultDTO> > >(resultlist2str).Object; target = resultlist2.Where(m => m.ProductName == "修改单元测试试剂产品名称").FirstOrDefault(); Assert.IsNotNull(target); //删除 ProductInfoOperateDTO deletedto = new ProductInfoOperateDTO(); deletedto.ProductID = target.ProductID; var deletedtostr = TransformHelper.ConvertDTOTOBase64JsonString(deletedto); var deleteresultstr = testcontroller.DeleteReagentInfo(deletedtostr).Content.ReadAsStringAsync().Result; var deleteresult = JsonConvert.DeserializeObject <ResultDTO <object> >(deleteresultstr); var resultlist3str = testcontroller.GetReagentInfoList(searchdtostr).Content.ReadAsStringAsync().Result; var resultlist3 = JsonConvert.DeserializeObject <ResultDTO <List <ProductInfoResultDTO> > >(resultlist3str).Object; target = resultlist3.Where(m => m.ProductID == target.ProductID).FirstOrDefault(); Assert.IsNull(target); }
/// <summary> /// 维修产品停启用 /// </summary> /// <param name="dto"></param> /// <returns></returns> public static ResultData <object> ChangeStatusMaintenanceInfo(ProductInfoOperateDTO dto) { ResultData <object> result = null; result = PutAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "MaintenanceInfo", dto); return(result); }
/// <summary> /// 停启用试剂产品 /// </summary> /// <returns></returns> public static ResultData <object> StartOrStopReagentInfo(ProductInfoOperateDTO dto) { ResultData <object> result = null; result = PutAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "ReagentInfo", dto); return(result); }
/// <summary> /// 删除试剂产品 /// </summary> /// <returns></returns> public static ResultData <object> DeleteReagentInfo(ProductInfoOperateDTO dto) { ResultData <object> result = null; result = DeleteAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "ReagentInfo?ProductInfoOperateDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto)); return(result); }
public HttpResponseMessage AddReagentInfo(ProductInfoOperateDTO dto) { ResultDTO <object> actionresult = new ResultDTO <object>(); try { actionresult.SubmitResult = _IIProductServices.AddReagentInfo(dto); } catch (Exception e) { actionresult.SubmitResult = false; actionresult.Message = e.Message; } HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(actionresult), System.Text.Encoding.GetEncoding("UTF-8"), "application/json") }; return(result); }
public HttpResponseMessage DeleteMaintenanceInfo(string ProductInfoOperateDTO) { ResultDTO <object> resultdto = new ResultDTO <object>(); try { ProductInfoOperateDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <ProductInfoOperateDTO>(ProductInfoOperateDTO); resultdto.SubmitResult = _IProductServices.DeleteMaintenanceInfo(dto); } catch (Exception ex) { resultdto.SubmitResult = false; resultdto.Message = ex.Message; } HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(resultdto), System.Text.Encoding.GetEncoding("UTF-8"), "application/json") }; return(result); }
public void TestMethod1() { //查询试剂产品 ProductInfoSearchDTO dto = new ProductInfoSearchDTO(); dto.page = 1; dto.rows = 1; List <ProductInfoResultDTO> list = _IProductServices.GetReagentInfoList(dto); //产品试剂产品 ProductInfoOperateDTO dto1 = new ProductInfoOperateDTO(); dto1.ProductID = Guid.NewGuid(); dto1.ArtNo = "测试货号Test"; dto1.ProductName = "测试试剂产品Test"; dto1.RemarkDes = "测试备注Test"; dto1.ReagentTest = "测试测试数Test"; dto1.ReagentSize = "测试规格Test"; dto1.ReagentProject = "测试项目Test"; dto1.IsMaintenance = false; dto1.IsActive = true; dto1.CreateUser = "******"; dto1.CreateTime = DateTime.Now; bool bl = _IProductServices.AddReagentInfo(dto1); Assert.IsTrue(bl); //查询试剂产品 ProductInfoSearchDTO dto2 = new ProductInfoSearchDTO(); dto2.SearchText = "测试试剂产品Test"; dto2.page = 1; dto2.rows = 1; List <ProductInfoResultDTO> list1 = _IProductServices.GetReagentInfoList(dto2); //修改试剂产品 ProductInfoOperateDTO dto3 = new ProductInfoOperateDTO(); dto3.ProductID = list1.Select(s => s.ProductID).FirstOrDefault(); dto3.ArtNo = "修改测试货号Test"; dto3.ProductName = "修改测试试剂产品Test"; dto3.RemarkDes = "修改测试备注Test"; dto3.ReagentTest = "修改测试测试数Test"; dto3.ReagentSize = "修改测试规格Test"; dto3.ReagentProject = "修改测试项目Test"; dto3.IsMaintenance = false; dto3.IsActive = true; dto1.ModifyUser = "******"; dto1.ModifyTime = DateTime.Now; bool bl1 = _IProductServices.UpdateReagentInfo(dto3); Assert.IsTrue(bl1); //停启用试剂产品 ProductInfoOperateDTO dto4 = new ProductInfoOperateDTO(); dto4.ProductID = list1.Select(s => s.ProductID).FirstOrDefault(); dto4.IsActive = true; dto4.ModifyUser = "******"; dto4.ModifyTime = DateTime.Now; bool bl2 = _IProductServices.StartOrStopReagentInfo(dto4); Assert.IsTrue(bl2); //删除试剂产品 ProductInfoOperateDTO dto5 = new ProductInfoOperateDTO(); dto5.ProductID = list1.Select(s => s.ProductID).FirstOrDefault(); bool bl3 = _IProductServices.DeleteReagentInfo(dto5); Assert.IsTrue(bl3); }