Esempio n. 1
0
        protected override void BtnOK_Click(object sender, EventArgs e)
        {
            if (cbArea.SelectedIndex == 0 && cbBuild.SelectedIndex == 0 && cbUnit.SelectedIndex == 0 && cbRoom.SelectedIndex == 0)
            {
                Tools.CMessageBox.ShowError("请至少选择一级建筑", Config.DialogTitle);
                return;
            }
            if (MessageBox.Show("确定选择该设置吗?", Config.DialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            this._BuildingCode = new BuildingCode();
            ComboBoxItem cbItem;

            //小区
            cbItem = (ComboBoxItem)cbArea.SelectedItem;
            if (Convert.ToInt32(cbItem.Value) > 0)
            {
                this._BuildingCode.AreaCode = cbItem.Text.Split('|')[1];
            }
            //楼栋
            cbItem = (ComboBoxItem)cbBuild.SelectedItem;
            if (Convert.ToInt32(cbItem.Value) > 0)
            {
                this._BuildingCode.BuildCode = cbItem.Text.Split('|')[1];
            }
            //单元
            cbItem = (ComboBoxItem)cbUnit.SelectedItem;
            if (Convert.ToInt32(cbItem.Value) > 0)
            {
                this._BuildingCode.UnitCode = cbItem.Text.Split('|')[1];
            }
            //房间
            cbItem = (ComboBoxItem)cbRoom.SelectedItem;
            if (Convert.ToInt32(cbItem.Value) > 0)
            {
                this._BuildingCode.RoomCode = cbItem.Text.Split('|')[1];
            }

            this.DialogResult = DialogResult.OK;
        }
Esempio n. 2
0
 public static string GetBuildingName(BuildingCode code)
 {
     return buildingNames[code];
 }
Esempio n. 3
0
 public Building(BuildingCode code)
 {
     buildingCode = code;
     buildingName = buildingNames[code];
 }