/// <summary> /// 得到经销商类别 /// </summary> /// <param name="dto"></param> /// <returns></returns> public static List <DistributorTypeResultDTO> GetDistributorTypeList(DistributorTypeSearchDTO dto) { List <DistributorTypeResultDTO> result = null; result = GetAPI <List <DistributorTypeResultDTO> >(WebConfiger.MasterDataServicesUrl + "DistributorType?DistributorTypeSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto)); return(result); }
public void TestMethod1() { //查询 DistributorTypeSearchDTO dto = new DistributorTypeSearchDTO(); string dtostr = Common.TransformHelper.ConvertDTOTOBase64JsonString(dto); var pp = DistributorTypeController.GetDepartmentList(dtostr); //新增 DistributorTypeOperateDTO dto1 = new DistributorTypeOperateDTO(); dto1.DistributorTypeName = "测试类别Test"; dto1.CreateUser = "******"; dto1.CreateTime = DateTime.Now; var pp1 = DistributorTypeController.AddDistributorType(dto1); string strResult1 = pp1.Content.ReadAsStringAsync().Result; ResultDTO <object> bl = JsonConvert.DeserializeObject <ResultDTO <object> >(strResult1); Assert.IsTrue(bl.SubmitResult); //查询 DistributorTypeSearchDTO dto2 = new DistributorTypeSearchDTO(); string dto2str = Common.TransformHelper.ConvertDTOTOBase64JsonString(dto2); var pp2 = DistributorTypeController.GetDepartmentList(dto2str); string strResult2 = pp2.Content.ReadAsStringAsync().Result; List <DistributorTypeResultDTO> list1 = JsonConvert.DeserializeObject <List <DistributorTypeResultDTO> >(strResult2); //修改 DistributorTypeOperateDTO dto3 = new DistributorTypeOperateDTO(); dto3.DistributorTypeID = list1.Where(p => p.DistributorTypeName == "测试类别Test").Select(s => s.DistributorTypeID).FirstOrDefault(); dto3.DistributorTypeName = "修改测试类别Test"; dto3.ModifyUser = "******"; dto3.ModifyTime = DateTime.Now; var pp3 = DistributorTypeController.UpdateDistributorType(dto3); string strResult3 = pp3.Content.ReadAsStringAsync().Result; ResultDTO <object> bl1 = JsonConvert.DeserializeObject <ResultDTO <object> >(strResult3); Assert.IsTrue(bl1.SubmitResult); //删除 DistributorTypeOperateDTO dto4 = new DistributorTypeOperateDTO(); dto4.DistributorTypeID = list1.Where(p => p.DistributorTypeName == "测试类别Test").Select(s => s.DistributorTypeID).FirstOrDefault(); string dto4str = Common.TransformHelper.ConvertDTOTOBase64JsonString(dto4); var pp4 = DistributorTypeController.DeleteDistributorType(dto4str); string strResult4 = pp4.Content.ReadAsStringAsync().Result; ResultDTO <object> bl2 = JsonConvert.DeserializeObject <ResultDTO <object> >(strResult4); Assert.IsTrue(bl2.SubmitResult); }
public HttpResponseMessage GetDepartmentList(string DistributorTypeSearchDTO) { List <DistributorTypeResultDTO> Dtyperesult = new List <DistributorTypeResultDTO>(); DistributorTypeSearchDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <DistributorTypeSearchDTO>(DistributorTypeSearchDTO); Dtyperesult = _IDistributorServices.GetDistributorType(dto); HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(Dtyperesult), System.Text.Encoding.GetEncoding("UTF-8"), "application/json") }; return(result); }
/// <summary> /// 得到所有经销商类别 /// </summary> /// <returns></returns> public List <DistributorTypeResultDTO> GetDistributorType(DistributorTypeSearchDTO dto) { List <DistributorTypeResultDTO> result = null; var tcdmse = SingleQueryObject.GetObj(); var pp = tcdmse.master_DistributorType.AsNoTracking().Where(p => p.DistributorTypeID != null); if (dto.DistributorTypeID != null) { pp = pp.Where(p => p.DistributorTypeID == dto.DistributorTypeID); } result = Mapper.Map <List <master_DistributorType>, List <DistributorTypeResultDTO> >(pp.ToList()); return(result); }
/// <summary> /// 得到一条经销商类别 /// </summary> /// <param name="id"></param> /// <returns></returns> public static ResultData <DistributorTypeResultDTO> GetDistributorType(DistributorTypeSearchDTO dto) { ResultData <DistributorTypeResultDTO> result = new ResultData <DistributorTypeResultDTO>(); var resultlist = GetAPI <List <DistributorTypeResultDTO> >(WebConfiger.MasterDataServicesUrl + "DistributorType?DistributorTypeSearchDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto)); if (resultlist.Count > 0) { result.Object = resultlist.First(); result.SubmitResult = true; } else { result.Message = "此条信息不存在!"; } return(result); }
public void TestMethod1() { //查询经销商类别 DistributorTypeSearchDTO dto = new DistributorTypeSearchDTO(); List <DistributorTypeResultDTO> list = _IDistributorServices.GetDistributorType(dto); //经销商类别新增 DistributorTypeOperateDTO dto1 = new DistributorTypeOperateDTO(); dto1.DistributorTypeName = "测试类别Test"; dto1.CreateUser = "******"; dto1.CreateTime = DateTime.Now; bool bl = _IDistributorServices.AddDistributorType(dto1); Assert.IsTrue(bl); //查询经销商类别 DistributorTypeSearchDTO dto2 = new DistributorTypeSearchDTO(); List <DistributorTypeResultDTO> list1 = _IDistributorServices.GetDistributorType(dto2); //修改经销商类别 DistributorTypeOperateDTO dto3 = new DistributorTypeOperateDTO(); dto3.DistributorTypeID = list1.Where(p => p.DistributorTypeName == "测试类别Test").Select(s => s.DistributorTypeID).FirstOrDefault(); dto3.DistributorTypeName = "修改测试类别Test"; dto3.ModifyUser = "******"; dto3.ModifyTime = DateTime.Now; bool bl1 = _IDistributorServices.UpdateDistributorType(dto3); Assert.IsTrue(bl1); //删除经销商类别 DistributorTypeOperateDTO dto4 = new DistributorTypeOperateDTO(); dto4.DistributorTypeID = list1.Where(p => p.DistributorTypeName == "测试类别Test").Select(s => s.DistributorTypeID).FirstOrDefault(); bool bl2 = _IDistributorServices.DeleteDistributorType(dto4); Assert.IsTrue(bl2); }