/// <summary>
        /// 得到所有产品型号信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static List <ProductModelResultModel> GetProductModel(ProductModelSearchDTO dto)
        {
            List <ProductModelResultModel> result = null;

            result = GetAPI <List <ProductModelResultModel> >(WebConfiger.MasterDataServicesUrl + "ProductModel?ProductModelSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(result);
        }
Beispiel #2
0
        public void TestMethod3()
        {
            //查询产品型号
            ProductModelSearchDTO        dto  = new ProductModelSearchDTO();
            List <ProductModelResultDTO> list = _IProductServices.GetProductModel(dto);

            //产品型号新增
            ProductModelOperateDTO dto1 = new ProductModelOperateDTO();

            dto1.ProductModelName = "测试产品型号Test";
            dto1.IsActive         = true;
            dto1.CreateUser       = "******";
            dto1.CreateTime       = DateTime.Now;
            bool bl = _IProductServices.AddProductModel(dto1);

            Assert.IsTrue(bl);

            //查询产品型号
            ProductModelSearchDTO dto2 = new ProductModelSearchDTO();

            dto2.SearchText = "测试产品型号Test";
            List <ProductModelResultDTO> list1 = _IProductServices.GetProductModel(dto2);

            //修改产品型号
            ProductModelOperateDTO dto3 = new ProductModelOperateDTO();

            dto3.ProductModelID   = list1.Select(s => s.ProductModelID).FirstOrDefault();
            dto3.ProductModelName = "修改测试产品型号Test";
            dto3.ModifyUser       = "******";
            dto3.ModifyTime       = DateTime.Now;
            bool bl1 = _IProductServices.UpdateProductModel(dto3);

            Assert.IsTrue(bl1);

            //停启用产品型号
            ProductModelOperateDTO dto4 = new ProductModelOperateDTO();

            dto4.ProductModelID = list1.Select(s => s.ProductModelID).FirstOrDefault();
            dto4.IsActive       = true;
            dto4.ModifyUser     = "******";
            dto4.ModifyTime     = DateTime.Now;
            bool bl2 = _IProductServices.StopEnableProductModel(dto4);

            Assert.IsTrue(bl2);

            //删除产品型号
            ProductModelOperateDTO dto5 = new ProductModelOperateDTO();

            dto5.ProductModelID = list1.Select(s => s.ProductModelID).FirstOrDefault();
            bool bl3 = _IProductServices.DeleteProductModel(dto5);

            Assert.IsTrue(bl3);
        }
Beispiel #3
0
        public HttpResponseMessage GetProductModel(string ProductModelSearchDTO)
        {
            ProductModelSearchDTO        dto  = TransformHelper.ConvertBase64JsonStringToDTO <ProductModelSearchDTO>(ProductModelSearchDTO);
            List <ProductModelResultDTO> user = _IProductServices.GetProductModel(dto);

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

            return(result);
        }
Beispiel #4
0
        public void TestMethod1()
        {
            //查询
            ProductModelSearchDTO dto = new ProductModelSearchDTO();
            string dtostr             = Common.TransformHelper.ConvertDTOTOBase64JsonString(dto);
            var    pp = ProductModelController.GetProductModel(dtostr);

            //新增
            ProductModelOperateDTO dto1 = new ProductModelOperateDTO();

            dto1.ProductModelName = "测试产品型号Test";
            dto1.IsActive         = true;
            dto1.CreateUser       = "******";
            dto1.CreateTime       = DateTime.Now;
            var                pp1        = ProductModelController.AddProductModel(dto1);
            string             strResult1 = pp1.Content.ReadAsStringAsync().Result;
            ResultDTO <object> bl         = JsonConvert.DeserializeObject <ResultDTO <object> >(strResult1);

            Assert.IsTrue(bl.SubmitResult);

            //查询
            ProductModelSearchDTO dto2 = new ProductModelSearchDTO();

            dto2.SearchText = "测试产品型号Test";
            string dto2str    = Common.TransformHelper.ConvertDTOTOBase64JsonString(dto2);
            var    pp2        = ProductModelController.GetProductModel(dto2str);
            string strResult2 = pp2.Content.ReadAsStringAsync().Result;
            List <ProductModelResultDTO> list1 = JsonConvert.DeserializeObject <List <ProductModelResultDTO> >(strResult2);

            //修改
            ProductModelOperateDTO dto3 = new ProductModelOperateDTO();

            dto3.UpType           = 1;
            dto3.ProductModelID   = list1.Select(s => s.ProductModelID).FirstOrDefault();
            dto3.ProductModelName = "修改测试产品型号Test";
            dto3.ModifyUser       = "******";
            dto3.ModifyTime       = DateTime.Now;
            var                pp3        = ProductModelController.UpdateStopEnableProductModel(dto3);
            string             strResult3 = pp3.Content.ReadAsStringAsync().Result;
            ResultDTO <object> bl1        = JsonConvert.DeserializeObject <ResultDTO <object> >(strResult3);

            Assert.IsTrue(bl1.SubmitResult);

            //停启用
            ProductModelOperateDTO dto5 = new ProductModelOperateDTO();

            dto5.UpType         = 2;
            dto5.ProductModelID = list1.Select(s => s.ProductModelID).FirstOrDefault();
            dto5.IsActive       = true;
            dto5.ModifyUser     = "******";
            dto5.ModifyTime     = DateTime.Now;
            var                pp5        = ProductModelController.UpdateStopEnableProductModel(dto5);
            string             strResult5 = pp5.Content.ReadAsStringAsync().Result;
            ResultDTO <object> bl5        = JsonConvert.DeserializeObject <ResultDTO <object> >(strResult5);

            Assert.IsTrue(bl5.SubmitResult);

            //删除
            ProductModelOperateDTO dto4 = new ProductModelOperateDTO();

            dto4.ProductModelID = list1.Select(s => s.ProductModelID).FirstOrDefault();
            string             dto4str    = Common.TransformHelper.ConvertDTOTOBase64JsonString(dto4);
            var                pp4        = ProductModelController.DeleteProductModel(dto4str);
            string             strResult4 = pp4.Content.ReadAsStringAsync().Result;
            ResultDTO <object> bl2        = JsonConvert.DeserializeObject <ResultDTO <object> >(strResult4);

            Assert.IsTrue(bl2.SubmitResult);
        }