protected void ButtonOK_Click(object sender, EventArgs e)
        {
            string guid = this.DropDownListDetectorTypes.SelectedValue;
            if (!string.IsNullOrEmpty(guid))
            {
                bool done = false;
                StringBuilder stringBuilder = new StringBuilder();

                try
                {
                    DetectorTypeBusiness business = new DetectorTypeBusiness();
                    DetectorType module = business.QueryByGuid(guid);

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

                        module.Name = this.TextBoxName.Text;
                        module.Type = (EnvironmentalMonitor.Support.Resource.DetectorTypes)(int.Parse(this.DropDownListTypes.SelectedValue));
                        module.Code = byte.Parse(this.TextBoxCode.Text);
                        module.DescriptionA = this.TextBoxDescriptionA.Text;
                        module.DescriptionB = this.TextBoxDescriptionB.Text;
                        module.UnitA = this.TextBoxUnitA.Text;
                        module.UnitB = this.TextBoxUnitB.Text;

                        DetectorType detectorType = business.QueryByNameOrCode(module.Name, module.Code);

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

                            if (done)
                            {
                                stringBuilder.Append("修改探头类型成功!");
                                detectorType = business.QueryByNameOrCode(module.Name, module.Code);
                                if (detectorType != null)
                                {
                                    string[] imageFiles = { this.MapPath(detectorType.NormalHref), this.MapPath(detectorType.ErrorHref) };
                                    FileUpload[] fileUploads = { this.FileUploadNormal, this.FileUploadError };
                                    for (int i = 0; i < imageFiles.Length; i++)
                                    {
                                        this.UploadFileSave(fileUploads[i], imageFiles[i]);
                                    }
                                }
                            }
                            else
                            {
                                stringBuilder.Append("修改探头类型失败!");
                            }
                        }
                        else
                        {
                            stringBuilder.Append("探头类型已经存在(名称或代码相同)!");
                        }
                    }
                    else
                    {
                        stringBuilder.Append("探头类型不存在!");
                    }
                }
                catch (Exception exception)
                {
                    stringBuilder.Append("修改探头类型错误!");
                    Variable.Logger.Log(exception);
                }

                this.LabelMessage.Text = stringBuilder.ToString();
                this.InitializeBind();
            }
        }
        private void InitializeBindType()
        {
            if (this.DropDownListDetectorTypes.SelectedValue != null)
            {
                string guid = this.DropDownListDetectorTypes.SelectedValue;
                DetectorTypeBusiness business = new DetectorTypeBusiness();
                DetectorType detectorType = business.QueryByGuid(guid);
                switch (detectorType.Type)
                {
                    case Support.Resource.DetectorTypes.Switch:
                        this.LabelMinimumA.Visible = false;
                        this.LabelMaximumA.Visible = false;
                        this.LabelMinimumB.Visible = false;
                        this.LabelMaximumB.Visible = false;
                        this.TextBoxMinimumA.Visible = false;
                        this.TextBoxMaximumA.Visible = false;
                        this.TextBoxMinimumB.Visible = false;
                        this.TextBoxMaximumB.Visible = false;

                        this.RequiredFieldValidatorMinimumA.Visible = false;
                        this.RequiredFieldValidatorMaximumA.Visible = false;
                        this.RequiredFieldValidatorMinimumB.Visible = false;
                        this.RequiredFieldValidatorMaximumB.Visible = false;
                        this.RangeValidatorMinimumA.Visible = false;
                        this.RangeValidatorMaximumA.Visible = false;
                        this.RangeValidatorMinimumB.Visible = false;
                        this.RangeValidatorMaximumB.Visible = false;

                        this.RequiredFieldValidatorMinimumA.Enabled = false;
                        this.RequiredFieldValidatorMaximumA.Enabled = false;
                        this.RequiredFieldValidatorMinimumB.Enabled = false;
                        this.RequiredFieldValidatorMaximumB.Enabled = false;
                        this.RangeValidatorMinimumA.Enabled = false;
                        this.RangeValidatorMaximumA.Enabled = false;
                        this.RangeValidatorMinimumB.Enabled = false;
                        this.RangeValidatorMaximumB.Enabled = false;

                        this.LabelMinimumA.Text = string.Format("{0}:", detectorType.DescriptionA);
                        break;
                    case Support.Resource.DetectorTypes.DoubleArea:
                        this.LabelMinimumA.Visible = true;
                        this.LabelMaximumA.Visible = true;
                        this.LabelMinimumB.Visible = true;
                        this.LabelMaximumB.Visible = true;
                        this.TextBoxMinimumA.Visible = true;
                        this.TextBoxMaximumA.Visible = true;
                        this.TextBoxMinimumB.Visible = true;
                        this.TextBoxMaximumB.Visible = true;

                        this.RequiredFieldValidatorMinimumA.Visible = true;
                        this.RequiredFieldValidatorMaximumA.Visible = true;
                        this.RequiredFieldValidatorMinimumB.Visible = true;
                        this.RequiredFieldValidatorMaximumB.Visible = true;
                        this.RangeValidatorMinimumA.Visible = true;
                        this.RangeValidatorMaximumA.Visible = true;
                        this.RangeValidatorMinimumB.Visible = true;
                        this.RangeValidatorMaximumB.Visible = true;

                        this.RequiredFieldValidatorMinimumA.Enabled = true;
                        this.RequiredFieldValidatorMaximumA.Enabled = true;
                        this.RequiredFieldValidatorMinimumB.Enabled = true;
                        this.RequiredFieldValidatorMaximumB.Enabled = true;
                        this.RangeValidatorMinimumA.Enabled = true;
                        this.RangeValidatorMaximumA.Enabled = true;
                        this.RangeValidatorMinimumB.Enabled = true;
                        this.RangeValidatorMaximumB.Enabled = true;

                        this.LabelMinimumA.Text = string.Format("{0}阀值下限:<br />({1})", detectorType.DescriptionA, detectorType.UnitA);
                        this.LabelMaximumA.Text = string.Format("{0}阀值上限:<br />({1})", detectorType.DescriptionA, detectorType.UnitA);
                        this.LabelMinimumB.Text = string.Format("{0}阀值下限:<br />({1})", detectorType.DescriptionB, detectorType.UnitB);
                        this.LabelMaximumB.Text = string.Format("{0}阀值上限:<br />({1})", detectorType.DescriptionB, detectorType.UnitB);

                        this.RequiredFieldValidatorMinimumA.ErrorMessage = string.Format("{0}阀值下限不允许为空!<br />", detectorType.DescriptionA);
                        this.RequiredFieldValidatorMaximumA.ErrorMessage = string.Format("{0}阀值上限不允许为空!<br />", detectorType.DescriptionA);
                        this.RequiredFieldValidatorMinimumB.ErrorMessage = string.Format("{0}阀值下限不允许为空!<br />", detectorType.DescriptionB);
                        this.RequiredFieldValidatorMaximumB.ErrorMessage = string.Format("{0}阀值上限不允许为空!<br />", detectorType.DescriptionB);
                        this.RangeValidatorMinimumA.ErrorMessage = string.Format("{0}阀值下限范围从0到255!<br />", detectorType.DescriptionA);
                        this.RangeValidatorMaximumA.ErrorMessage = string.Format("{0}阀值上限范围从0到255!<br />", detectorType.DescriptionA);
                        this.RangeValidatorMinimumB.ErrorMessage = string.Format("{0}阀值下限范围从0到255!<br />", detectorType.DescriptionB);
                        this.RangeValidatorMaximumB.ErrorMessage = string.Format("{0}阀值上限范围从0到255!<br />", detectorType.DescriptionB);
                        break;
                }
            }
        }
        protected void DropDownListDetectorTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            string guid = this.DropDownListDetectorTypes.SelectedValue;
            if (!string.IsNullOrEmpty(guid))
            {
                this.LabelMessage.Text = string.Empty;
                DetectorTypeBusiness business = new DetectorTypeBusiness();

                DetectorType currentDetectorType = business.QueryByGuid(guid);

                if (currentDetectorType != null)
                {
                    this.TextBoxName.Text = currentDetectorType.Name;
                    this.DropDownListTypes.SelectedValue = currentDetectorType.TypeValue.ToString();
                    this.TextBoxCode.Text = currentDetectorType.Code.ToString();
                    this.TextBoxDescriptionA.Text = currentDetectorType.DescriptionA;
                    this.TextBoxDescriptionB.Text = currentDetectorType.DescriptionB;
                    this.TextBoxUnitA.Text = currentDetectorType.UnitA;
                    this.TextBoxUnitB.Text = currentDetectorType.UnitB;

                    this.ImageNormal.ImageUrl = currentDetectorType.NormalHref;
                    this.ImageError.ImageUrl = currentDetectorType.ErrorHref;
                }
            }
        }