예제 #1
0
        public bool AuthShipperSend(string CodeCabinet, IMqttClientMain mqttClientMain)
        {
            Cabinet cabinet = smartDeliveryContext.Cabinet.Where(x => x.Code.Equals(CodeCabinet)).FirstOrDefault();

            cabinet.GoodsId = null;
            mqttClientMain.PublishToTopicAsync("command/locker1", "0");
            return(true);
        }
예제 #2
0
        public bool AuthShipperRecievie(Guid GoodsId, string CodeCabinet, IMqttClientMain mqttClientMain)
        {
            Cabinet cabinet = smartDeliveryContext.Cabinet.Where(x => x.Code.Equals(CodeCabinet)).FirstOrDefault();
            Goods   goods   = smartDeliveryContext.Goods.Where(x => x.Id == GoodsId).FirstOrDefault();

            cabinet.GoodsId = goods.Id;
            goods.Status    = 5;
            mqttClientMain.PublishToTopicAsync("command/locker2", "0");
            return(true);
        }
예제 #3
0
        public bool CustomerSend(string CodeCabinet, UserEntity userEntity, IMqttClientMain mqttClientMain)
        {
            Cabinet cabinet = smartDeliveryContext.Cabinet.Where(x => x.Code.Equals(CodeCabinet)).FirstOrDefault();
            Goods   goods   = smartDeliveryContext.Goods.Where(x => x.IdSender == userEntity.Id).FirstOrDefault();

            if (goods != null)
            {
                if (cabinet.GoodsId == goods.Id)
                {
                    //cabinet.IsOpended = true;
                    smartDeliveryContext.SaveChanges();
                    mqttClientMain.PublishToTopicAsync("command/locker1", "0");
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }