Esempio n. 1
0
        public HttpResponseMessage GetMaintenanceInfo(string ProductInfoSearchDTO)
        {
            ProductInfoSearchDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <ProductInfoSearchDTO>(ProductInfoSearchDTO);
            ResultDTO <List <ProductInfoResultDTO> > actionresult = new ResultDTO <List <ProductInfoResultDTO> >();

            try
            {
                actionresult.Object       = _IProductServices.GetMaintenanceInfo(dto);
                actionresult.SubmitResult = true;
                actionresult.rows         = dto.rows;
                actionresult.page         = dto.page;
                actionresult.Count        = dto.Count;
            }
            catch (Exception ex)
            {
                actionresult.SubmitResult = false;
                actionresult.Message      = ex.Message;
            }
            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(actionresult),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        /// <summary>
        /// 得到维修产品清单
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static ResultData <List <ProductInfoModel> > GetMaintenanceInfoList(ProductInfoSearchDTO dto)
        {
            ResultData <List <ProductInfoModel> > result = null;

            result = GetAPI <ResultData <List <ProductInfoModel> > >(WebConfiger.MasterDataServicesUrl + "MaintenanceInfo?ProductInfoSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一条维修产品信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ResultData <ProductInfoModel> GetMaintenanceInfo(ProductInfoSearchDTO dto)
        {
            ResultData <ProductInfoModel> result = new ResultData <ProductInfoModel>();

            var resultlist = GetAPI <ResultData <List <ProductInfoModel> > >(WebConfiger.MasterDataServicesUrl + "MaintenanceInfo?ProductInfoSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            if (resultlist.Object != null && resultlist.Object.Count > 0)
            {
                result.Object       = resultlist.Object.First();
                result.SubmitResult = true;
            }
            else
            {
                result.Message = "此条信息不存在!";
            }

            return(result);
        }
Esempio n. 5
0
        public HttpResponseMessage GetReagentInfoList(string ProductInfoSearchDTO)
        {
            ProductInfoSearchDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <ProductInfoSearchDTO>(ProductInfoSearchDTO);
            ResultDTO <List <ProductInfoResultDTO> > actionresult = new ResultDTO <List <ProductInfoResultDTO> >();

            actionresult.Object       = _IIProductServices.GetReagentInfoList(dto);
            actionresult.SubmitResult = true;
            actionresult.Count        = dto.Count;

            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(actionresult),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
Esempio n. 6
0
        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);
        }