/// <summary>
        /// 新建评价
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Add(P_EVALUATE entity)
        {
            var res = evaluateDao.Add(entity);

            if (entity.OnTime == 0)
            {
                //写入用户确认金额
                orderDao.unUserPrice(entity.OrderID);
                preApprovalDao.FinishPreApproval(entity.OrderID);
                var order   = orderDao.FindByID(entity.OrderID);
                var nowDate = DateTime.Now.AddHours(-48);
                var userId  = order.UserId;
                if (order.IsTransfer == 1)
                {
                    userId = order.TransferUserMUDID;
                }
                var orderList = orderDao.LoadUserConfirmOrders(userId, nowDate);
                if (orderList.Count < 1)
                {
                    var group = groupMemberDao.FindByUser(userId);
                    if (group != null)
                    {
                        if (group.State == 0 && group.State2 == 0 && group.State3 == 0)
                        {
                            groupMemberDao.DelByState1(userId);
                        }
                        else
                        {
                            groupMemberDao.UpdateState1(userId);
                        }
                    }
                }
            }
            return(res);
        }
        /// <summary>
        /// 评论
        /// </summary>
        /// <returns></returns>
        public JsonResult Add(string orderID, string restaurantId, int star, int onTime, string onTimeDiscripion,
                              int isSafe, string safeDiscepion, string safeImage, int health, string healthDiscrpion, string healthImage,
                              int pack, string packDiscrpion, string packImage, int costEffective, string costEffectiveDiscrpion, string costEffectiveImage, string otherDiscrpion)
        {
            P_EVALUATE entity = new P_EVALUATE();

            entity.ID                     = Guid.NewGuid();
            entity.OrderID                = new Guid(orderID);
            entity.RestaurantId           = restaurantId == "" ? "" : restaurantId;
            entity.Star                   = star;
            entity.OnTime                 = onTime;
            entity.OnTimeDiscrpion        = onTimeDiscripion;
            entity.IsSafe                 = isSafe;
            entity.SafeDiscrpion          = safeDiscepion == "" ? "" : safeDiscepion;
            entity.SafeImage              = safeImage == "" ? "" : safeImage;
            entity.Health                 = health;
            entity.HealthDiscrpion        = healthDiscrpion == "" ? "" : healthDiscrpion;
            entity.HealthImage            = healthImage == "" ? "" : healthImage;
            entity.Pack                   = pack;
            entity.PackDiscrpion          = packDiscrpion == "" ? "" : packDiscrpion;
            entity.PackImage              = packImage == "" ? "" : packImage;
            entity.CostEffective          = costEffective;
            entity.CostEffectiveDiscrpion = costEffectiveDiscrpion == "" ? "" : costEffectiveDiscrpion;
            entity.CostEffectiveImage     = costEffectiveImage == "" ? "" : costEffectiveImage;
            entity.OtherDiscrpion         = otherDiscrpion == "" ? "" : otherDiscrpion;
            entity.State                  = 1;
            entity.CreateDate             = DateTime.Now;

            var channel = EvaluateClientChannelFactory.GetChannel();
            int res     = channel.Add(entity);

            if (res == 1)
            {
                var  _channel = OrderApiClientChannelFactory.GetChannel();
                Guid id       = new Guid(orderID);
                var  order    = _channel.FindByID(id);
                // 发用户消息
                WxMessageHandler.GetInstance().SendMessageToUser(CurrentWxUser.UserId, order);

                return(Json(new { state = 1 }));
            }
            else
            {
                return(Json(new { state = 0, errCode = 9008 }));
            }
        }
        /// <summary>
        /// 未送达
        /// </summary>
        /// <param name="orderID"></param>
        /// <param name="restaurantId"></param>
        /// <param name="onTimeDiscripion"></param>
        /// <returns></returns>
        public JsonResult AddUndelivered(string orderID, string restaurantId, string onTimeDiscripion, string supplier, int normal)
        {
            P_EVALUATE entity = new P_EVALUATE();

            entity.ID              = Guid.NewGuid();
            entity.OrderID         = new Guid(orderID);
            entity.RestaurantId    = restaurantId;
            entity.OnTime          = 0;
            entity.OnTimeDiscrpion = onTimeDiscripion;
            entity.State           = 1;
            entity.CreateDate      = DateTime.Now;
            entity.Normal          = normal;
            var channel = EvaluateClientChannelFactory.GetChannel();
            int res     = channel.Add(entity);

            if (res == 1)
            {
                var  _channel = OrderApiClientChannelFactory.GetChannel();
                Guid id       = new Guid(orderID);
                var  order    = _channel.FindByID(id);
                // 发用户消息
                WxMessageHandler.GetInstance().SendMessageToUser(CurrentWxUser.UserId, order);

                // 告诉小秘书没收到餐
                Task.Factory.StartNew(() =>
                {
                    //var oponapiChannel = OpenApiChannelFactory.GetChannel();
                    //var xmlres = oponapiChannel.orderDeliveryFailure(order.XmsOrderId, string.Empty);
                    var req = new OrderDeliveryFailureReq()
                    {
                        _Channels    = supplier,
                        iPathOrderId = order.XmsOrderId,
                        remark       = onTimeDiscripion
                    };
                    var iPathRes = apiClient.OrderDeliveryFailure(req);
                });

                return(Json(new { state = 1 }));
            }
            else
            {
                return(Json(new { state = 0, errCode = 9008 }));
            }
        }
示例#4
0
        private void button2_Click(object sender, EventArgs e)
        {
            var  orderChannel = MealAdminApiClient.OrderApiClientChannelFactory.GetChannel();
            Guid _id          = new Guid("6110151A-42C0-4874-A3B7-487A86B2DAF3");
            var  order        = orderChannel.FindByID(_id);



            var client = MealAdminApiClient.EvaluateClientChannelFactory.GetChannel();

            Guid       id     = new Guid("FC81BD4C-711C-4F8B-8E3B-C0FEA6EF4A66");
            var        res    = client.LoadByOrderID(id);
            P_EVALUATE entity = new P_EVALUATE();

            entity.ID           = Guid.NewGuid();
            entity.OrderID      = Guid.NewGuid();
            entity.RestaurantId = "10001";
            entity.State        = 1;
            entity.CreateDate   = DateTime.Now;

            var res1 = client.Add(entity);
        }
示例#5
0
        /// <summary>
        /// 新建评价
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Add(P_EVALUATE entity)
        {
            var sqlServerTemplate = sqlServerTemplFactory.CreateDbTemplate();

            using (var conn = sqlServerTemplate.GetSqlConnection())
            {
                conn.Open();

                var res = sqlServerTemplate.ExecuteNonQuery("INSERT INTO P_EVALUATE " +
                                                            " (ID,OrderID,RestaurantId,Star,OnTime,OnTimeDiscrpion,IsSafe,SafeDiscrpion,SafeImage,Health,HealthDiscrpion,HealthImage,Pack,PackDiscrpion,PackImage,CostEffective,CostEffectiveDiscrpion,CostEffectiveImage,OtherDiscrpion,OtherDiscrpionImage,State,CreateDate)" +
                                                            " SELECT @ID,@OrderID,@RestaurantId,@Star,@OnTime,@OnTimeDiscrpion,@IsSafe,@SafeDiscrpion,@SafeImage,@Health,@HealthDiscrpion,@HealthImage,@Pack,@PackDiscrpion,@PackImage,@CostEffective,@CostEffectiveDiscrpion,@CostEffectiveImage,@OtherDiscrpion,@OtherDiscrpionImage,@State,@CreateDate " +
                                                            " WHERE NOT EXISTS (SELECT * FROM P_EVALUATE WHERE OrderID=@OrderID)",
                                                            new SqlParameter[]
                {
                    SqlParameterFactory.GetSqlParameter("@ID", entity.ID),
                    SqlParameterFactory.GetSqlParameter("@OrderID", entity.OrderID),
                    SqlParameterFactory.GetSqlParameter("@RestaurantId", entity.RestaurantId),
                    SqlParameterFactory.GetSqlParameter("@Star", entity.Star),
                    SqlParameterFactory.GetSqlParameter("@OnTime", entity.OnTime),
                    SqlParameterFactory.GetSqlParameter("@OnTimeDiscrpion", entity.OnTimeDiscrpion),
                    SqlParameterFactory.GetSqlParameter("@IsSafe", entity.IsSafe),
                    SqlParameterFactory.GetSqlParameter("@SafeDiscrpion", entity.SafeDiscrpion),
                    SqlParameterFactory.GetSqlParameter("@SafeImage", entity.SafeImage),
                    SqlParameterFactory.GetSqlParameter("@Health", entity.Health),
                    SqlParameterFactory.GetSqlParameter("@HealthDiscrpion", entity.HealthDiscrpion),
                    SqlParameterFactory.GetSqlParameter("@HealthImage", entity.HealthImage),
                    SqlParameterFactory.GetSqlParameter("@Pack", entity.Pack),
                    SqlParameterFactory.GetSqlParameter("@PackDiscrpion", entity.PackDiscrpion),
                    SqlParameterFactory.GetSqlParameter("@PackImage", entity.PackImage),
                    SqlParameterFactory.GetSqlParameter("@CostEffective", entity.CostEffective),
                    SqlParameterFactory.GetSqlParameter("@CostEffectiveDiscrpion", entity.CostEffectiveDiscrpion),
                    SqlParameterFactory.GetSqlParameter("@CostEffectiveImage", entity.CostEffectiveImage),
                    SqlParameterFactory.GetSqlParameter("@OtherDiscrpion", entity.OtherDiscrpion),
                    SqlParameterFactory.GetSqlParameter("@OtherDiscrpionImage", entity.OtherDiscrpionImage),
                    SqlParameterFactory.GetSqlParameter("@State", entity.State),
                    SqlParameterFactory.GetSqlParameter("@CreateDate", entity.CreateDate)
                });


                var _res = 0;
                if (entity.OnTime != 0)
                {
                    _res = sqlServerTemplate.Update($"UPDATE [P_ORDER] SET [State]={OrderState.EVALUATED} WHERE ID=@ID ",
                                                    new SqlParameter[]
                    {
                        SqlParameterFactory.GetSqlParameter("@ID", entity.OrderID)
                    });
                }
                else
                {
                    var receiveDate = DateTime.Now;
                    _res = sqlServerTemplate.Update($"UPDATE [P_ORDER] SET [State]={OrderState.FOODLOSE}, ReceiveState={OrderState.FOODLOSE},ReceiveDate=@ReceiveDate,IsSpecialOrder=@IsSpecialOrder,RealCount=0 WHERE ID=@ID ",
                                                    new SqlParameter[]
                    {
                        SqlParameterFactory.GetSqlParameter("@ID", entity.OrderID),
                        SqlParameterFactory.GetSqlParameter("@ReceiveDate", receiveDate),
                        SqlParameterFactory.GetSqlParameter("@IsSpecialOrder", entity.Normal == 0?3:0)
                    });
                }

                if (res == 1 && _res == 1)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }
示例#6
0
 /// <summary>
 /// 新建评价
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Add(P_EVALUATE entity)
 {
     return(evaluateService.Add(entity));
 }
示例#7
0
 /// <summary>
 /// 新建评价
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int AddUnd(P_EVALUATE entity, string totalPrice)
 {
     return(evaluateService.AddUnd(entity, totalPrice));
 }
        /// <summary>
        /// 新建评价
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int AddUnd(P_EVALUATE entity, string totalPrice)
        {
            var res = evaluateDao.Add(entity);

            return(res);
        }