protected void ButtonOK_Click(object sender, EventArgs e)
        {
            bool done = false;
            StringBuilder stringBuilder = new StringBuilder();

            if (this.DropDownListMachines.SelectedValue != null)
            {
                string guid = this.DropDownListMachines.SelectedValue;
                if (!string.IsNullOrEmpty(guid))
                {
                    try
                    {
                        MachineBusiness business = new MachineBusiness();
                        Machine module = business.QueryByGuid(guid);

                        if (module != null)
                        {
                            this.InitializeUpdateModule(module);

                            int intervalValue = int.Parse(this.TextBoxInterval.Text);

                            module.RoomId = this.DropDownListRooms.SelectedValue;
                            module.Name = this.TextBoxName.Text;
                            module.Ip = this.TextBoxIP.Text;
                            module.Interval = intervalValue;
                            module.Mobile = this.TextBoxMobile.Text;

                            Machine machine = business.QueryByNameOrIp(module.Name, module.RoomId, module.Ip);

                            if ((machine == null) || (string.Equals(machine.Guid, module.Guid, StringComparison.CurrentCulture)))
                            {
                                done = business.Update(module);

                                if (done)
                                {
                                    stringBuilder.Append("修改检测仪成功!");

                                    machine = business.QueryByNameOrIp(module.Name, module.RoomId, module.Ip);
                                    if (machine != null)
                                    {
                                        string imageFile = this.MapPath(machine.FloorPlanHref);
                                        this.UploadFileSave(this.FileUploadFloorPlan, imageFile);

                                        string message = string.Empty;

                                        MachineSetup setup = new MachineSetup();
                                        // 设置检测仪上传数据时间间隔
                                        message = setup.Interval(machine);
                                        stringBuilder.Append(message);
                                        // 设置检测仪时间
                                        if (this.RadioButtonListTime.SelectedValue != null)
                                        {
                                            bool sync = false;
                                            try
                                            {
                                                sync = bool.Parse(this.RadioButtonListTime.SelectedValue);
                                            }
                                            finally
                                            {
                                            }
                                            if (sync)
                                            {
                                                message = setup.Time(machine);
                                                stringBuilder.Append(message);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    stringBuilder.Append("修改检测仪失败!");
                                }
                            }
                            else
                            {
                                stringBuilder.Append("检测仪已经存在(名称或IP地址相同)!");
                            }
                        }
                        else
                        {
                            stringBuilder.Append("检测仪不存在!");
                        }
                    }
                    catch (Exception exception)
                    {
                        stringBuilder.Append("修改检测仪错误!");
                        Variable.Logger.Log(exception);
                    }
                }
            }

            this.LabelMessage.Text = stringBuilder.ToString();

            this.InitializeBind();
        }
        protected void ButtonOK_Click(object sender, EventArgs e)
        {
            bool done = false;
            StringBuilder stringBuilder = new StringBuilder();

            try
            {
                MachineBusiness business = new MachineBusiness();
                Machine module = new Machine();

                this.InitializeInsertModule(module);

                int intervalValue = int.Parse(this.TextBoxInterval.Text);

                module.RoomId = this.DropDownListRooms.SelectedValue;
                module.Name = this.TextBoxName.Text;
                module.Ip = this.TextBoxIP.Text;

                module.Netmask = string.Empty;
                module.Gateway = string.Empty;
                module.Mac = string.Empty;
                module.MobileA = string.Empty;
                module.MobileB = string.Empty;
                module.MobileC = string.Empty;
                module.Alarm = false;

                module.Interval = intervalValue;
                module.Mobile = this.TextBoxMobile.Text;

                Machine machine = business.QueryByNameOrIp(module.Name, module.RoomId, module.Ip);

                if (machine == null)
                {
                    done = business.Insert(module);

                    if (done)
                    {
                        stringBuilder.Append("新增检测仪成功!");

                        machine = business.QueryByNameOrIp(module.Name, module.RoomId, module.Ip);
                        if (machine != null)
                        {
                            string imageFile = this.MapPath(machine.FloorPlanHref);
                            this.UploadFileSave(this.FileUploadFloorPlan, imageFile);

                            string message = string.Empty;

                            MachineSetup setup = new MachineSetup();
                            // 设置检测仪上传数据时间间隔
                            message = setup.Interval(machine);
                            stringBuilder.Append(message);
                            // 设置检测仪时间
                            if (this.RadioButtonListTime.SelectedValue != null)
                            {
                                bool sync = false;
                                try
                                {
                                    sync = bool.Parse(this.RadioButtonListTime.SelectedValue);
                                }
                                finally
                                {
                                }
                                if (sync)
                                {
                                    message = setup.Time(machine);
                                    stringBuilder.Append(message);
                                }
                            }
                        }
                    }
                    else
                    {
                        stringBuilder.Append("新增检测仪失败!");
                    }
                }
                else
                {
                    stringBuilder.Append("检测仪已经存在(名称或IP地址相同)!");
                }
            }
            catch (Exception exception)
            {
                stringBuilder.Append("新增检测仪错误!");
                Variable.Logger.Log(exception);
            }

            this.LabelMessage.Text = stringBuilder.ToString();

            this.InitializeBind();
        }