コード例 #1
0
        public CommonRtnEntity Get(string projectName, string mobileNum)
        {
            IAbandonedMobileServices advertisementServices = new AbandonedMobileServices();
            AbandonedMobile          info = advertisementServices.Query(d => d.MobileNum == mobileNum && d.ProjectName == projectName).FirstOrDefault();

            if (info != null)
            {
                info.Count++;
                advertisementServices.Update(info);
            }
            CommonRtnEntity rtnInfo = new CommonRtnEntity()
            {
                Success = info != null,
                Data    = info,
                Message = "查询成功!"
            };

            return(rtnInfo);
        }
コード例 #2
0
        public CommonRtnEntity Add([FromBody] AbandonedMobile info)
        {
            CommonRtnEntity rtnInfo = new CommonRtnEntity();

            try
            {
                IAbandonedMobileServices advertisementServices = new AbandonedMobileServices();
                info.Count      = 0;
                info.CreateTime = DateTime.Now;
                int result = advertisementServices.Add(info);
                rtnInfo.Success = result > 0;
                rtnInfo.Data    = result;
                rtnInfo.Message = "添加成功!";
            }
            catch (Exception ex)
            {
                rtnInfo.Success = false;
                rtnInfo.Data    = ex.Message;
                rtnInfo.Message = ex.Message;
            }

            return(rtnInfo);
        }
コード例 #3
0
        public CommonRtnEntity CheckIsMyMobile(string clientName, string projectName, string mobileNum)
        {
            bool isMy = false;
            //先查是否在自己号码库中
            IMobileInfoServices advertisementServices = new MobileInfoServices();
            MobileInfo          info = advertisementServices.Query(d => d.MobileNum == mobileNum && d.ProjectName == projectName && d.ClientName == clientName).FirstOrDefault();
            string msg = "";

            if (info != null)
            {
                msg  = "已使用!";
                isMy = true;
            }
            else
            {
                //如果不在自己号码库中,再查是否作废
                IAbandonedMobileServices abandonedMobileServices = new AbandonedMobileServices();
                AbandonedMobile          abandonedMobile         = abandonedMobileServices.Query(d => d.MobileNum == mobileNum && d.ProjectName == projectName).FirstOrDefault();
                if (abandonedMobile != null)
                {
                    abandonedMobile.Count++;
                    abandonedMobileServices.Update(abandonedMobile);
                    isMy = true;
                    msg  = "已作废!";
                }
            }

            CommonRtnEntity rtnInfo = new CommonRtnEntity()
            {
                Success = isMy,
                Data    = msg,
                Message = "检查完毕!"
            };

            return(rtnInfo);
        }