Пример #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();
        }