Exemplo n.º 1
0
        public JsonResult getTotal(int userId)
        {
            Response response = new Response();

            try {
                TotalDataHandler totalDataHandler = new TotalDataHandler(config);
                Total            total            = totalDataHandler.getTotal(userId);
                response.status = true;
                response.data   = JsonConvert.SerializeObject(total);
            } catch (Exception ex) {
                response.status  = false;
                response.message = ex.Message;
            }
            return(Json(response));
        }
Exemplo n.º 2
0
        private JsonResult saveTotal(Total total, string command)
        {
            bool             result           = false;
            Response         response         = new Response();
            TotalDataHandler totalDataHandler = new TotalDataHandler(config);

            totalDataHandler.userId        = total.userId;
            totalDataHandler.expenseAmount = total.expenseAmount;
            totalDataHandler.incomeAmount  = total.incomeAmount;
            if (command.Equals("create_total"))
            {
                result = totalDataHandler.createTotal();
            }
            if (command.Equals("update_total"))
            {
                result = totalDataHandler.updateTotal();
            }
            response.status = result;
            return(Json(response));
        }
Exemplo n.º 3
0
        private void _deviceManagerService_TotalDataNoifyProxyHandle(object sender, TotalDataPublishArgs e)
        {
            bool IsActionSuccess = false;

            if (_cache.IsScanned(e.ScanDataCode))
            {
                ScanDataEntity      entity    = new ScanDataEntity();
                ScanImageDataEntity imgentity = new ScanImageDataEntity();
                imgentity.OrderId    = entity.OrderId = e.ScanDataCode;
                entity.Weight        = e.Weight;
                entity.ScanTime      = DateTime.Now;
                imgentity.PostStatus = entity.PostStatus = 0;
                imgentity.PostTime   = entity.PostTime = DateTime.Now;
                imgentity.PostTimes  = entity.PostTimes = 0;
                entity.Scanner       = "";
                entity.ScanPlace     = "";
                entity.ScanType      = "0";
                imgentity.ImgStatus  = 0;
                imgentity.ImgPath    = _imagePath;
                using (var scope = _root.BeginLifetimeScope())
                {
                    var dataCount = scope.ResolveOptional <IRepository <ScanDataEntity> >().Add(SQLFormatStr.ScanDataAdd, entity, false);
                    _log.Info($"插入数据库 ScanData{dataCount}条");
                    var imageCount = scope.ResolveOptional <IRepository <ScanImageDataEntity> >().Add(SQLFormatStr.ImageDataAdd, imgentity, false);
                    _log.Info($"插入数据库 ImageData{imageCount}条");
                }
                _cache.AddScanned(e.ScanDataCode);
                IsActionSuccess = true;
            }
            else
            {
                e.CodeMsg = "条码已扫描";
            }
            TotalDataHandler?.Invoke(new UITotalData()
            {
                IsSuccess = IsActionSuccess, Code = e.ScanDataCode, CodeMsg = e.CodeMsg, Weight = e.Weight, ImageData = e.ImageData, ScanDate = e.ScanTime
            });
        }