Ejemplo n.º 1
0
        /// <summary>
        /// 得到产品类型
        /// </summary>
        /// <returns></returns>
        public static List <ProductTypeResultDTO> GetProductTypeList(ProductTypeSearchDTO dto)
        {
            List <ProductTypeResultDTO> result = null;

            result = GetAPI <List <ProductTypeResultDTO> >(WebConfiger.MasterDataServicesUrl + "ProductType?ProductTypeSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(result);
        }
        public ActionResult Search([FromBody] ProductTypeSearchDTO model)
        {
            Expression <Func <ProductType, bool> > filter = x => !string.IsNullOrWhiteSpace(x.Id);

            if (!string.IsNullOrWhiteSpace(model.Description))
            {
                filter = filter.AndOrCustom(
                    x => x.Description.ToUpper().Contains(model.Description.ToUpper()),
                    model.Condition.Equals(ActionDto.AND));
            }

            var producttypes = this.service.Search(filter);

            return(Ok(producttypes));
        }
Ejemplo n.º 3
0
        public HttpResponseMessage GetProductTypeList(string ProductTypeSearchDTO)
        {
            ProductTypeSearchDTO        dto          = TransformHelper.ConvertBase64JsonStringToDTO <ProductTypeSearchDTO>(ProductTypeSearchDTO);
            List <ProductTypeResultDTO> actionresult = new List <ProductTypeResultDTO>();

            actionresult = _IIProductServices.GetProductTypeList(dto);

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

            return(result);
        }
Ejemplo n.º 4
0
        public void TestMethod4()
        {
            //查询产品类型
            ProductTypeSearchDTO        dto  = new ProductTypeSearchDTO();
            List <ProductTypeResultDTO> list = _IProductServices.GetProductTypeList(dto);

            //产品类型新增
            ProductTypeOperateDTO dto1 = new ProductTypeOperateDTO();

            dto1.ProductTypeName = "测试产品类型Test";
            dto1.ProductTypeAB   = "cscplxTest";
            dto1.OracleName      = "ON测试产品类型Test";
            dto1.CreateUser      = "******";
            dto1.CreateTime      = DateTime.Now;
            bool bl = _IProductServices.AddProductType(dto1);

            Assert.IsTrue(bl);

            //查询产品类型
            ProductTypeSearchDTO dto2 = new ProductTypeSearchDTO();

            dto2.SearchText = "测试产品类型Test";
            List <ProductTypeResultDTO> list1 = _IProductServices.GetProductTypeList(dto2);

            //修改产品类型
            ProductTypeOperateDTO dto3 = new ProductTypeOperateDTO();

            dto3.ProductTypeID   = list1.Select(s => s.ProductTypeID).FirstOrDefault();
            dto1.ProductTypeName = "修改测试产品类型Test";
            dto1.ProductTypeAB   = "cscplxTest";
            dto1.OracleName      = "修改ON测试产品类型Test";
            dto3.ModifyUser      = "******";
            dto3.ModifyTime      = DateTime.Now;
            bool bl1 = _IProductServices.UpdateProductType(dto3);

            Assert.IsTrue(bl1);

            //删除产品类型
            ProductTypeSearchDTO dto5 = new ProductTypeSearchDTO();

            dto5.ProductTypeID = list1.Select(s => s.ProductTypeID).FirstOrDefault();
            bool bl3 = _IProductServices.DeleteProductType(dto5);

            Assert.IsTrue(bl3);
        }
Ejemplo n.º 5
0
        public void TestMethod1()
        {
            //产品类型
            //新增
            ProductTypeSearchDTO searchdto = new ProductTypeSearchDTO();
            var searchdtostr = TransformHelper.ConvertDTOTOBase64JsonString(searchdto);

            testcontroller.GetProductTypeList(searchdtostr);
            ProductTypeOperateDTO adddto = new ProductTypeOperateDTO();

            adddto.ProductTypeName = "单元测试产品类型名称";
            var addresultstr = testcontroller.AddProductType(adddto).Content.ReadAsStringAsync().Result;
            var addresult    = JsonConvert.DeserializeObject <ResultDTO <object> >(addresultstr);
            var resultlist1  = JsonConvert.DeserializeObject <List <ProductTypeResultDTO> >(testcontroller.GetProductTypeList(searchdtostr).Content.ReadAsStringAsync().Result);
            var target       = resultlist1.Where(m => m.ProductTypeName == "单元测试产品类型名称").FirstOrDefault();

            Assert.IsNotNull(target);

            //修改
            adddto.ProductTypeID   = target.ProductTypeID;
            adddto.ProductTypeName = "修改单元测试产品类型名称";
            var updateresultstr = testcontroller.UpdateProductType(adddto).Content.ReadAsStringAsync().Result;
            var updateresult    = JsonConvert.DeserializeObject <ResultDTO <object> >(updateresultstr);

            var resultlist2str = testcontroller.GetProductTypeList(searchdtostr).Content.ReadAsStringAsync().Result;
            var resultlist2    = JsonConvert.DeserializeObject <List <ProductTypeResultDTO> >(resultlist2str);

            target = resultlist2.Where(m => m.ProductTypeName == "修改单元测试产品类型名称").FirstOrDefault();
            Assert.IsNotNull(target);

            //删除
            ProductTypeSearchDTO deletedto = new ProductTypeSearchDTO();

            deletedto.ProductTypeID = target.ProductTypeID;
            var deletedtostr    = TransformHelper.ConvertDTOTOBase64JsonString(deletedto);
            var deleteresultstr = testcontroller.DeleteProductType(deletedtostr).Content.ReadAsStringAsync().Result;
            var deleteresult    = JsonConvert.DeserializeObject <ResultDTO <object> >(deleteresultstr);
            var resultlist3str  = testcontroller.GetProductTypeList(searchdtostr).Content.ReadAsStringAsync().Result;
            var resultlist3     = JsonConvert.DeserializeObject <List <ProductTypeResultDTO> >(resultlist3str);

            target = resultlist3.Where(m => m.ProductTypeID == target.ProductTypeID).FirstOrDefault();
            Assert.IsNull(target);
        }
Ejemplo n.º 6
0
        public HttpResponseMessage DeleteProductType(string ProductTypeSearchDTO)
        {
            ProductTypeSearchDTO dto          = TransformHelper.ConvertBase64JsonStringToDTO <ProductTypeSearchDTO>(ProductTypeSearchDTO);
            ResultDTO <object>   actionresult = new ResultDTO <object>();

            try
            {
                actionresult.SubmitResult = _IIProductServices.DeleteProductType(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);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 删除产品类型
        /// </summary>
        /// <returns></returns>
        public static ResultData <object> DeleteProductType(ProductTypeSearchDTO dto)
        {
            ResultData <object> blResult = DeleteAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "ProductType?ProductTypeSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(blResult);
        }