Exemplo n.º 1
0
        public IHttpActionResult Subscribe([FromBody] SubscribeDTO subscribeDTO)
        {
            var device = deviceService.GetByCode(subscribeDTO.DeviceCode);

            if (device == null)
            {
                return(BadRequest());
            }

            var store = storeService.GetByQR(subscribeDTO.StoreQR);

            if (store == null)
            {
                return(BadRequest());
            }

            StoreDevice subscribtion = new StoreDevice()
            {
                DeviceID    = device.DeviceID,
                StoreID     = store.StoreID,
                DateCreated = DateTime.UtcNow
            };

            deviceService.Subscribe(subscribtion);
            deviceService.SaveDevice();

            return(Ok());
        }
        /// <summary>
        ///
        /// </summary>
        private void GetDeviceData()
        {
            try
            {
                DataTable dt = tgsDataInfo.GetDeviceInfo("1=1 and substr(isshow,2,1)='1'");
                if (dt != null)
                {
                    StoreDevice.DataSource = dt;
                    StoreDevice.DataBind();
                }
                DataTable dt1 = GetRedisData.ChangColName(GetRedisData.GetData("t_sys_code:240014"), true);
                StoreCompany.DataSource = dt1; //tgsPproperty.GetCompanyDict();
                StoreCompany.DataBind();

                DataTable tgs = GetRedisData.ChangColName(ToDataTable(GetRedisData.GetData("Station:t_cfg_set_station").Select("", "station_name asc")), true);//tgsPproperty.GetTmsStationInfo();
                // tgs.Columns.RemoveAt(0);
                StoreStaion.DataSource = Bll.Common.ChangColName(GetRedisData.GetData("Station:t_cfg_set_station"));
                StoreStaion.DataBind();
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
            }
        }
Exemplo n.º 3
0
 public void Subscribe(StoreDevice subscribtion)
 {
     DbContext.StoreDevices.Add(subscribtion);
 }
Exemplo n.º 4
0
 public void Subscribe(StoreDevice subscribtion)
 {
     deviceRepository.Subscribe(subscribtion);
 }