示例#1
0
        public static ServicePersonViewModel GetServicePerson(string customerId, string userId, string servicePersonId)
        {
            var loggingSessionInfo = Default.GetBSLoggingSession(customerId, userId);
            var bll     = new GLServicePersonInfoBLL(loggingSessionInfo);
            var person  = bll.GetByID(servicePersonId);
            var taskBll = new GLServiceTaskBLL(loggingSessionInfo);
            var list    = taskBll.Query(new IWhereCondition[]
            {
                new EqualsCondition {
                    DateTimeAccuracy = null, FieldName = "UserID", Value = servicePersonId
                }
            },
                                        null);
            var orderCount = list.Count(task => task.ServiceDate != null && (task.ServiceDate.Value.Date == DateTime.Now.Date));

            return(new ServicePersonViewModel
            {
                Mobile = person.Mobile,
                Name = person.Name,
                OrderCount = person.OrderCount,
                Picture = person.Picture,
                ServicePersonId = servicePersonId,
                Star = person.Star,
                TodayOrder = orderCount
            });
        }
示例#2
0
        /// <summary>
        /// 选择师傅
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string SelectServicePerson(string pRequest)
        {
            var rd = new APIResponse <SelectServicePersonRD>();

            try
            {
                var req = pRequest.DeserializeJSONTo <APIRequest <SelectServicePersonRP> >();
                if (req.Parameters == null)
                {
                    throw new ArgumentException();
                }

                req.Parameters.Validate();

                // 创建任务
                var session      = Default.GetBSLoggingSession(req.CustomerID, req.UserID);
                var bll          = new GLServiceTaskBLL(session);
                var serviceOrder = ServiceOrderManager.Instance.GetServiceOrder(req.Parameters.ServiceOrderNO);
                if (serviceOrder == null)
                {
                    throw new ArgumentException();
                }

                //删除
                var entity = bll.Query(new IWhereCondition[]
                {
                    new EqualsCondition {
                        DateTimeAccuracy = null, FieldName = "ServiceOrderID", Value = req.Parameters.ServiceOrderNO
                    },
                    new EqualsCondition {
                        DateTimeAccuracy = null, FieldName = "CustomerID", Value = req.CustomerID
                    },
                    new EqualsCondition {
                        DateTimeAccuracy = null, FieldName = "IsDelete", Value = "0"
                    },
                    new EqualsCondition {
                        DateTimeAccuracy = null, FieldName = "UserID", Value = req.Parameters.PersonID
                    }
                }, null);
                if (entity != null && entity.Length > 0)
                {
                    bll.Delete(entity);
                }

                bll.Create(new GLServiceTaskEntity
                {
                    CreateBy       = "",
                    CreateTime     = DateTime.Now,
                    CustomerID     = req.CustomerID,
                    IsDelete       = 0,
                    LastUpdateBy   = "",
                    LastUpdateTime = DateTime.Now,
                    ServiceDate    = serviceOrder.InstallOrderDate,
                    ServiceOrderID = req.Parameters.ServiceOrderNO,
                    ServiceTaskID  = GreeCommon.GetGuid(),
                    UserID         = req.Parameters.PersonID
                });

                // 标记赢得预约单的师傅
                ServiceOrderManager.Instance.SelectServicePerson(req.Parameters.ServiceOrderNO, req.Parameters.PersonID);

                if (!string.IsNullOrEmpty(serviceOrder.VipID))
                {
                    VipEntity vipInfo = new VipBLL(session).GetByID(serviceOrder.VipID);
                    if (vipInfo == null || vipInfo.VIPID.Equals(""))
                    {
                        throw new APIException("用户不存在");
                    }

                    #region 推送师傅联系方式url到用户的微信端。
                    string message = "安装师傅联系方式,请点击<a href='" + req.Parameters.RetUrl + "'>查看师傅详情 </a>";
                    string code    = JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(message, serviceOrder.VipID, session, vipInfo);
                    #endregion
                }

                var rdData = new SelectServicePersonRD {
                    IsSuccess = true
                };
                rd.Data       = rdData;
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.Message    = ex.Message;
                rd.ResultCode = 101;
            }

            return(rd.ToJSON());
        }