Esempio n. 1
0
        public ActionResult GetPagesByNotRelationship(long id, int page, int rows)
        {
            SearchPages_Data          pageAll    = _saService.GetPageAll();
            DeviceSearch_Data_Devices deviceById = _saService.GetDeviceById(id);
            List <long> pageids = _saService.GetPageids(deviceById);

            string[] array = new string[0];
            if (pageids != null && pageids.Count > 0)
            {
                array = (
                    from p in pageids
                    select p.ToString()).ToArray();
            }
            List <SearchPages_Data_Page> list = (
                from p in pageAll.pages
                where !array.Contains <string>(p.page_id.ToString())
                select p).ToList();
            DataGridModel <SearchPages_Data_Page> dataGridModel = new DataGridModel <SearchPages_Data_Page>()
            {
                rows  = list,
                total = list.Count
            };

            return(Json(dataGridModel));
        }
Esempio n. 2
0
        public ActionResult Relationship(long id)
        {
            DeviceSearch_Data_Devices deviceById = _saService.GetDeviceById(id);
            List <long> pageids = _saService.GetPageids(deviceById);
            List <SearchPages_Data_Page> searchPagesDataPages = new List <SearchPages_Data_Page>();

            if (pageids != null && pageids.Count > 0)
            {
                searchPagesDataPages = _saService.GetPageById(pageids.ToArray());
            }
            ViewBag.DevModel  = deviceById;
            ViewBag.PageModel = searchPagesDataPages;
            return(View());
        }
Esempio n. 3
0
        public ActionResult RemoveRelationship(RemoveRelationshipModel model)
        {
            DeviceSearch_Data_Devices           deviceById = _saService.GetDeviceById(model.id);
            DeviceApply_Data_Device_Identifiers deviceApplyDataDeviceIdentifier = new DeviceApply_Data_Device_Identifiers()
            {
                device_id = deviceById.device_id,
                major     = deviceById.major,
                uuid      = deviceById.uuid,
                minor     = deviceById.minor
            };
            IShakeAroundService shakeAroundService = _saService;

            long[] numArray = new long[] { model.pageid };
            bool   flag     = shakeAroundService.SetRelationship(deviceApplyDataDeviceIdentifier, numArray, ShakeAroundBindType.解除关联关系);

            return(Json(new { success = flag }));
        }
Esempio n. 4
0
        public List <long> GetPageids(DeviceSearch_Data_Devices model)
        {
            DeviceApply_Data_Device_Identifiers deviceApplyDataDeviceIdentifier = new DeviceApply_Data_Device_Identifiers()
            {
                device_id = model.device_id,
                major     = model.major,
                minor     = model.minor,
                uuid      = model.uuid
            };
            List <DeviceApply_Data_Device_Identifiers> filters = new List <DeviceApply_Data_Device_Identifiers>()
            {
                deviceApplyDataDeviceIdentifier
            };
            var relationResult = Senparc.Weixin.MP.AdvancedAPIs.ShakeAroundApi.SearchDeviceById(_accessToken, filters, 10000);

            return((
                       from p in relationResult.data.devices
                       select p.device_id).ToList());
        }
Esempio n. 5
0
        public ActionResult BindRelationship(BindRelationshipModel model)
        {
            DeviceSearch_Data_Devices deviceById = _saService.GetDeviceById(model.id);
            //DeviceSearch_Data_Devices deviceById =
            DeviceApply_Data_Device_Identifiers deviceApplyDataDeviceIdentifier = new DeviceApply_Data_Device_Identifiers()
            {
                device_id = deviceById.device_id,
                major     = deviceById.major,
                uuid      = deviceById.uuid,
                minor     = deviceById.minor
            };
            IShakeAroundService shakeAroundService = _saService;
            DeviceApply_Data_Device_Identifiers deviceApplyDataDeviceIdentifier1 = deviceApplyDataDeviceIdentifier;
            string str = model.pageids;

            char[] chrArray = new char[] { ',' };
            bool   flag     = shakeAroundService.SetRelationship(deviceApplyDataDeviceIdentifier1, (
                                                                     from p in str.Split(chrArray)
                                                                     select long.Parse(p)).ToArray(), ShakeAroundBindType.建立关联关系);

            return(Json(new { success = flag }));
        }