Ejemplo n.º 1
0
        public CommonRtnEntity GetList([FromBody] SearchBase <CustomersSuppliersSearch> searchInfo)
        {
            ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices();

            int totalCount = 0;

            List <CustomersSuppliersInfo> list = services.QueryPage(x =>
                                                                    x.Name.Contains(searchInfo.Data.Name) &&
                                                                    x.Type == searchInfo.Data.Type &&
                                                                    x.PersonName.Contains(searchInfo.Data.PersonName) &&
                                                                    x.PersonPhone.Contains(searchInfo.Data.PersonPhone) &&
                                                                    x.QQ.Contains(searchInfo.Data.QQ) &&
                                                                    x.WeiXin.Contains(searchInfo.Data.WeiXin)
                                                                    , ref totalCount, searchInfo.PageIndex, searchInfo.PageSize, " CreateTime desc ");

            CommonRtnEntity rtnInfo = new CommonRtnEntity()
            {
                Success = list.Count > 0,
                Data    = new
                {
                    TotalCount = totalCount,
                    Data       = list
                },
                Message = "查询成功!"
            };

            return(rtnInfo);
        }
Ejemplo n.º 2
0
        public CommonRtnEntity Add([FromBody] CustomersSuppliersInfo info)
        {
            ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices();

            int result = 0;

            //编辑
            if (info.ID > 0)
            {
                info.UpdateTime = DateTime.Now;
                services.Update(info);
                result = info.ID;
            }
            else
            {
                result = services.Add(info);
            }

            CommonRtnEntity rtnInfo = new CommonRtnEntity()
            {
                Success = result > 0,
                Data    = result,
                Message = result > 0 ? "添加成功!" : "添加失败!"
            };

            return(rtnInfo);
        }
Ejemplo n.º 3
0
        public CommonRtnEntity Delete([FromBody] object[] ids)
        {
            ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices();
            bool            result  = services.DeleteByIds(ids);
            CommonRtnEntity rtnInfo = new CommonRtnEntity()
            {
                Success = result,
                Data    = result,
                Message = result ? "删除成功!" : "删除失败"
            };

            return(rtnInfo);
        }
Ejemplo n.º 4
0
        public CommonRtnEntity GetCustomersSuppliersInfo([FromBody]  SearchBase <string> searchInfo)
        {
            ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices();

            CustomersSuppliersInfo orderInfo = services.QueryByID(searchInfo.Data);

            CommonRtnEntity rtnInfo = new CommonRtnEntity()
            {
                Success = orderInfo != null,
                Data    = new
                {
                    Info = orderInfo
                },
                Message = orderInfo != null ? "查询成功!" : "查询失败!"
            };

            return(rtnInfo);
        }