Пример #1
0
        public void Delete(HttpContext context)
        {
            string      text = context.Request.Form["ids"];
            long        num  = context.Request["page_id"].ToLong(0);
            IList <int> list = new List <int>();

            string[] array = text.Split(',');
            foreach (string text2 in array)
            {
                if (!string.IsNullOrEmpty(text2))
                {
                    list.Add(text2.ToInt(0));
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                throw new HidistroAshxException("请选择您要删除的设备");
            }
            bool   flag  = false;
            string text3 = text;
            int    num2  = 0;

            while (num2 < text3.Length)
            {
                char c = text3[num2];
                DeviceApply_Data_Device_Identifiers deviceApply_Data_Device_Identifiers = new DeviceApply_Data_Device_Identifiers();
                deviceApply_Data_Device_Identifiers.device_id = c;
                long[] pageIds = new long[1]
                {
                    num
                };
                WxJsonResult wxJsonResult = WXStoreHelper.BindPage(deviceApply_Data_Device_Identifiers, pageIds, ShakeAroundBindType.解除关联关系, ShakeAroundAppendType.覆盖);
                if (wxJsonResult.errcode.Equals(ReturnCode.请求成功))
                {
                    flag = true;
                    num2++;
                    continue;
                }
                flag = false;
                break;
            }
            if (flag)
            {
                base.ReturnSuccessResult(context, "删除成功!", 0, true);
                return;
            }
            throw new HidistroAshxException("删除失败");
        }
Пример #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请选择一台设备!", false);
            }
            else
            {
                List <long> devices = new List <long>();
                text.Split(',').ForEach(delegate(string c)
                {
                    devices.Add(c.ToLong(0));
                });
                bool flag = true;
                foreach (long item in devices)
                {
                    DeviceApply_Data_Device_Identifiers deviceApply_Data_Device_Identifiers = new DeviceApply_Data_Device_Identifiers();
                    deviceApply_Data_Device_Identifiers.device_id = item;
                    long[] pageIds = new long[1]
                    {
                        this.page_id
                    };
                    WxJsonResult wxJsonResult = WXStoreHelper.BindPage(deviceApply_Data_Device_Identifiers, pageIds, ShakeAroundBindType.建立关联关系, ShakeAroundAppendType.新增);
                    if (!wxJsonResult.errcode.Equals(ReturnCode.请求成功))
                    {
                        flag = false;
                    }
                }
                if (flag)
                {
                    base.CloseWindow(null);
                }
                else
                {
                    this.ShowMsg("选择的设备没有配置成功!", false);
                }
            }
        }