public SubscribeOrderViewModel GetSubscribeOrderDetail(string pCustomerId, string pServiceOrderNo)
        {
            var     smodel  = new SubscribeOrderViewModel();
            var     glsobll = new GLServiceOrderBLL(_loggingSessionInfo);
            DataSet ds      = glsobll.GetServiceOrderByServiceOrderNo(pCustomerId, pServiceOrderNo);

            if (ds.Tables[0] != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                smodel.ServiceOrderNO      = row["ServiceOrderID"].ToString();
                smodel.ServiceType         = int.Parse(row["ServiceType"].ToString());
                smodel.ServiceOrderDate    = Convert.ToDateTime(row["ServiceDate"].ToString());
                smodel.ServiceOrderDateEnd = Convert.ToDateTime(row["ServiceDateEnd"].ToString());
                smodel.ServiceAddress      = row["ServiceAddress"].ToString();
                smodel.CustomerName        = row["CustomerName"].ToString();
                smodel.CustomerPhone       = row["CustomerPhone"] == null ? "" : row["CustomerPhone"].ToString();
                smodel.Message             = row["CustomerMessage"] == null ? "" : row["CustomerMessage"].ToString();
                smodel.Longitude           = Convert.ToDecimal(row["Longitude"] == null ? "0.000000" : row["Longitude"].ToString());
                smodel.Latitude            = Convert.ToDecimal(row["Latitude"] == null ? "0.000000" : row["Latitude"].ToString());
                smodel.VipID    = row["VipID"] == null ? "" : row["VipID"].ToString();
                smodel.Distance = "";

                if (row["InstallOrderDate"] != null && !string.IsNullOrEmpty(row["InstallOrderDate"].ToString()))
                {
                    smodel.InstallOrderDate = Convert.ToDateTime(row["InstallOrderDate"].ToString());
                }
            }
            //smodel.DeviceList = GetInstallDeviceByServiceOrderNO(pCustomerId, pServiceOrderNo);
            smodel.DeviceList   = GetInstallDeviceByServiceOrderId(pCustomerId, pServiceOrderNo);
            smodel.InstallCount = smodel.DeviceList.Count;
            return(smodel);
        }
        public string NotifyRemark(string pRequest)
        {
            var rd     = new APIResponse <RemarkServicePersonRD>();
            var rdData = new RemarkServicePersonRD {
                IsSuccess = true
            };

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

                req.Parameters.Validate();
                var session = Default.GetBSLoggingSession(req.CustomerID, req.UserID);
                //var serviceOrder = ServiceOrderManager.Instance.GetServiceOrder(req.Parameters.ServiceOrderNO);
                //if (!string.IsNullOrEmpty(serviceOrder.VipID))
                //{
                //VipEntity vipInfo = new VipBLL(session).GetByID(serviceOrder.VipID);
                //VipEntity vipInfo = new VipBLL(session).GetByID(serviceOrder.VipID);
                GLServiceOrderBLL glsobll = new GLServiceOrderBLL(session);
                DataSet           ds      = glsobll.GetServiceOrderByServiceOrderNo(req.CustomerID, req.Parameters.ServiceOrderNO);
                if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    string    vipID   = ds.Tables[0].Rows[0]["VipID"] == null ? "" : ds.Tables[0].Rows[0]["VipID"].ToString();
                    VipEntity vipInfo = new VipBLL(session).GetByID(vipID);
                    if (vipInfo == null || vipInfo.VIPID.Equals(""))
                    {
                        throw new APIException("用户不存在")
                              {
                                  ErrorCode = 102
                              }
                    }
                    ;

                    #region 推送师傅联系方式url到用户的微信端。
                    string message = "评价安装师傅的服务,请点击<a href='" + req.Parameters.RetUrl + "'></a>";
                    //string code = JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(message, serviceOrder.VipID, session, vipInfo);
                    string code = JIT.CPOS.BS.BLL.WX.CommonBLL.SendWeixinMessage(message, vipID, session, vipInfo);
                    #endregion
                    rd.ResultCode = 0;
                }
                else
                {
                    rdData.IsSuccess = false;
                    rd.Message       = "不存在的预约订单号";
                    rd.ResultCode    = 102;
                }
                rd.Data = rdData;
            }
            catch (Exception ex)
            {
                rd.Message    = ex.Message;
                rd.ResultCode = 101;
            }

            return(rd.ToJSON());
        }
        /// <summary>
        /// 获取师傅的当前任务列表
        /// </summary>
        /// <param name="pCustomerId"></param>
        /// <param name="pServicePersonId"></param>
        /// <returns></returns>
        public List <SubscribeOrderViewModel> GetSubscribeOrderList(string pCustomerId, string pServicePersonId)
        {
            var     listServiceOrder = new List <SubscribeOrderViewModel>();
            var     glsobll          = new GLServiceOrderBLL(_loggingSessionInfo);
            DataSet ds = glsobll.GetServiceOrderByServicePersonID(pCustomerId, pServicePersonId);

            if (ds.Tables[0] != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                listServiceOrder = DataTableToObject.ConvertToList <SubscribeOrderViewModel>(ds.Tables[0]);
            }
            foreach (var item in listServiceOrder)
            {
                item.DeviceList   = GetInstallDeviceByServiceOrderId(pCustomerId, item.ServiceOrderNO);
                item.InstallCount = item.DeviceList.Count;
            }
            return(listServiceOrder);
        }
        /// <summary>
        /// 保存服务订单号+设备列表
        /// </summary>
        /// <param name="pServiceOrder"></param>
        /// <param name="pInstallDeviceList"></param>
        /// <returns></returns>
        public string SaveSubscribeOrder(GLServiceOrderEntity pServiceOrder, List <InstallDeviceViewModel> pInstallDeviceList)
        {
            var glsobll = new GLServiceOrderBLL(_loggingSessionInfo);
            var glsoe   = glsobll.GetGLServiceOrderEntityByOrderID(pServiceOrder.CustomerID, pServiceOrder.ProductOrderID);

            if (glsoe == null)
            {
                glsobll.Create(pServiceOrder);
            }
            else
            {
                return("0");
            }
            //保存设备
            SaveInstallDeviceList(pServiceOrder, pInstallDeviceList);

            return("1");
        }
Exemplo n.º 5
0
        /// <summary>
        /// 提交预约订单
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        private string SubmitAppOrder(string pRequest)
        {
            var rd     = new APIResponse <SubmitAppOrderRD>();
            var rdData = new SubmitAppOrderRD();

            var rp = pRequest.DeserializeJSONTo <APIRequest <SubmitAppOrderRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            #region 提交预约单

            //根据订单号获取订单ID
            GLProductOrderBLL    glpobll = new GLProductOrderBLL(loggingSessionInfo);
            GLProductOrderEntity glpoe   = glpobll.GetProductOrderByOrderNo(rp.CustomerID, rp.Parameters.OrderNO);
            //更新客户VipID
            //if (glpoe != null && !string.IsNullOrEmpty(rp.Parameters.VipID))
            if (glpoe != null && !string.IsNullOrEmpty(rp.UserID))
            {
                glpoe.VipID          = rp.UserID;
                glpoe.CustomerGender = rp.Parameters.Gender;
                glpoe.CustomerName   = rp.Parameters.Surname;
                glpobll.Update(glpoe);
            }

            //插入预约
            GLServiceOrderBLL      glsobll      = new GLServiceOrderBLL(loggingSessionInfo);
            GLServiceOrderEntity   glsoe        = glsobll.GetGLServiceOrderEntityByOrderID(rp.CustomerID, glpoe.ProductOrderID);
            ServiceOrderDataAccess orderManager = new ServiceOrderDataAccess(loggingSessionInfo);

            if (glsoe == null)
            {
                glsoe = new GLServiceOrderEntity();
            }

            //订单ID
            glsoe.ProductOrderID  = glpoe.ProductOrderID;
            glsoe.ServiceType     = rp.Parameters.ServiceType;
            glsoe.ServiceDate     = rp.Parameters.ServiceOrderDate;
            glsoe.ServiceDateEnd  = rp.Parameters.ServiceOrderDateEnd;
            glsoe.ServiceAddress  = rp.Parameters.ServiceAddress;
            glsoe.CustomerMessage = rp.Parameters.Msg;
            glsoe.Latitude        = Convert.ToDecimal(rp.Parameters.Latitude);
            glsoe.Longitude       = Convert.ToDecimal(rp.Parameters.Longitude);
            glsoe.CustomerID      = rp.CustomerID;

            if (!string.IsNullOrEmpty(glsoe.ServiceOrderID))
            {
                //删除预约单
                glsobll.Update(glsoe);
                //删除预约单设备
                orderManager.DeleteInstallDeviceList(glsoe.CustomerID, glsoe.ServiceOrderID);
            }
            else
            {
                glsoe.ServiceOrderID = GreeCommon.GetGuid();
                glsobll.Create(glsoe);
            }

            //插入安装设备
            orderManager.SaveInstallDeviceList(glsoe, rp.Parameters.DeviceList);

            //预约单管理
            //SubscribeOrderViewModel order = orderManager.GetSubscribeOrder(rp.CustomerID, rp.Parameters.OrderNO);
            SubscribeOrderViewModel order = orderManager.GetSubscribeOrderDetail(rp.CustomerID, glsoe.ServiceOrderID);
            ServiceOrderManager.Instance.AddServiceOrder(order);

            rdData.ServiceOrderNO = glsoe.ServiceOrderID;
            #endregion


            #region 推送信息给服务师傅IOS,Android消息推送
            GLServicePersonInfoBLL glspibll = new GLServicePersonInfoBLL(loggingSessionInfo);
            DataSet dsPerson = glspibll.GetServicePerson(rp.CustomerID, string.Empty);
            string  msg      = rp.Parameters.Msg;
            if (dsPerson != null && dsPerson.Tables != null && dsPerson.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in dsPerson.Tables[0].Rows)
                {
                    new PushIOSMessage(loggingSessionInfo).PushMessage(row["ServicePersonID"].ToString(), msg);
                    new PushAndroidMessage(loggingSessionInfo).PushMessage(row["ServicePersonID"].ToString(), msg);
                }
            }
            #endregion

            rd.Data       = rdData;
            rd.ResultCode = 0;

            return(rd.ToJSON());
        }