Пример #1
0
        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)
                        {
                            string currentIp = module.Ip;
                            this.InitializeUpdateModule(module);

                            module.Ip = this.TextBoxIP.Text;
                            module.Netmask = this.TextBoxNetmask.Text;
                            module.Gateway = this.TextBoxGateway.Text;

                            done = business.Update(module);

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

                                string message = string.Empty;

                                MachineSetup setup = new MachineSetup();
                                message = setup.Ip(module, currentIp);
                                stringBuilder.Append(message);
                            }
                            else
                            {
                                stringBuilder.Append("修改检测仪失败!");
                            }
                        }
                        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();

            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);

                            module.Alarm = bool.Parse(this.RadioButtonListMobileAlarm.SelectedValue);
                            module.MobileA = this.TextBoxMobileA.Text;
                            module.MobileB = this.TextBoxMobileB.Text;
                            module.MobileC = this.TextBoxMobileC.Text;

                            done = business.Update(module);

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

                                string message = string.Empty;

                                MachineSetup setup = new MachineSetup();
                                message = setup.Threshold(module);
                                stringBuilder.Append(message);
                                message = setup.MobileAlarm(module);
                                stringBuilder.Append(message);
                                message = setup.Mobile(module);
                                stringBuilder.Append(message);
                            }
                            else
                            {
                                stringBuilder.Append("修改检测仪失败!");
                            }
                        }
                        else
                        {
                            stringBuilder.Append("检测仪不存在!");
                        }
                    }
                    catch (Exception exception)
                    {
                        stringBuilder.Append("修改检测仪错误!");
                        Variable.Logger.Log(exception);
                    }
                }
            }

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

            this.InitializeBind();
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }