/// <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");
        }
        /// <summary>
        /// 保存服务单号对应的设备列表
        /// </summary>
        /// <param name="pServiceOrder"></param>
        /// <param name="pInstallDeviceList"></param>
        public void SaveInstallDeviceList(GLServiceOrderEntity pServiceOrder, List <InstallDeviceViewModel> pInstallDeviceList)
        {
            var gldiibll = new GLDeviceInstallItemBLL(_loggingSessionInfo);

            for (var i = 0; i < pInstallDeviceList.Count; i++)
            {
                var gldiie = new GLDeviceInstallItemEntity
                {
                    ServiceOrderID  = pServiceOrder.ServiceOrderID,
                    DeviceInstallID = GreeCommon.GetGuid(),
                    DeviceItemID    = pInstallDeviceList[i].DeviceID,
                    DeviceFullName  = pInstallDeviceList[i].DeviceName,
                    InstallPosition = pInstallDeviceList[i].InstallPosition,
                    CustomerID      = pServiceOrder.CustomerID,
                    IsDelete        = 0
                };
                //服务订单号

                //gldiie.DeviceCount = pInstallDeviceList[i].DeviceCount;
                gldiibll.Create(gldiie);
            }
        }
 public void Update(GLServiceOrderEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField, pTran);
 }
 /// <summary>
 /// 在事务内创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Create(GLServiceOrderEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Create(pEntity, pTran);
 }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(GLServiceOrderEntity pEntity, IDbTransaction pTran)
 {
     Update(pEntity, true, pTran);
 }
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <GLServiceOrderEntity> PagedQueryByEntity(GLServiceOrderEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(GLServiceOrderEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public GLServiceOrderEntity[] QueryByEntity(GLServiceOrderEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(GLServiceOrderEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
 public void Update(GLServiceOrderEntity pEntity, bool pIsUpdateNullField)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField);
 }
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(GLServiceOrderEntity pEntity)
 {
     Update(pEntity, true);
 }
Exemple #12
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());
        }