/// <summary>
        /// 保存数据方法
        /// </summary>
        /// <returns></returns>
        private bool saveData()
        {
            try
            {
                BLL.DORMITORY_INFO   dormitoryBll = new BLL.DORMITORY_INFO();
                Model.DORMITORY_INFO dormitoryMdl = new Model.DORMITORY_INFO();

                BLL.BUILDING_INFO   buildingBll = new BLL.BUILDING_INFO();
                Model.BUILDING_INFO buildingMdl = new Model.BUILDING_INFO();

                if (this.cbb_buildingname.Text == "--请选择--")
                {
                    MessageBox.Show("宿舍楼名称不能为空!", "提示信息");
                    return(false);
                }

                if (this.te_plate.Text == "")
                {
                    MessageBox.Show("宿舍门牌号不能为空!", "提示信息");
                    return(false);
                }

                buildingMdl                  = buildingBll.GetModel(this.cbb_buildingname.Text);
                dormitoryMdl.BUILDINGID      = buildingMdl.BUILDINGID;
                dormitoryMdl.DORMITORY_PLATE = this.te_plate.Text;

                if (this._enumStatus == StatusClass.AddNew)  //新增宿舍信息
                {
                    dormitoryBll.Add(dormitoryMdl);
                    return(true);
                }
                else if (this._enumStatus == StatusClass.Edit)  //修改宿舍信息
                {
                    dormitoryMdl.DORMITORY_ID = _dormitoryid;
                    dormitoryBll.Update(dormitoryMdl);
                    return(true);
                }
                return(true);
            }
            catch (Exception exception)
            {
                MessageBox.Show("保存失败!", exception.Message);
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 读取数据
        /// </summary>
        private void readData()
        {
            if (this._buildingno > 0)
            {
                BLL.BUILDING_INFO   departmentBll = new BLL.BUILDING_INFO();
                Model.BUILDING_INFO departmentMdl = new Model.BUILDING_INFO();

                departmentMdl = departmentBll.GetModel(_buildingno);
                if (departmentMdl == null)
                {
                    blankData();
                }
                else
                {
                    this.te_buildingname.Text = departmentMdl.BUILDINGNAME;
                    this.te_floors.Text       = ToolHelper.ConvertToString(departmentMdl.FLOORS);
                    this.te_admin.Text        = departmentMdl.ADMIN;
                }
            }
        }
        /// <summary>
        /// 读取数据方法
        /// </summary>
        private void readData()
        {
            if (this._dormitoryid > 0)
            {
                BLL.DORMITORY_INFO   dormitoryBll = new BLL.DORMITORY_INFO();
                Model.DORMITORY_INFO dormitoryMdl = new Model.DORMITORY_INFO();

                dormitoryMdl = dormitoryBll.GetModel(_dormitoryid);
                if (dormitoryMdl == null)
                {
                    blankData();
                }
                else
                {
                    BLL.BUILDING_INFO   buildingBll = new BLL.BUILDING_INFO();
                    Model.BUILDING_INFO buildingMdl = new Model.BUILDING_INFO();

                    buildingMdl = buildingBll.GetModel((int)dormitoryMdl.BUILDINGID);
                    this.cbb_buildingname.Text = buildingMdl.BUILDINGNAME;

                    this.te_plate.Text = dormitoryMdl.DORMITORY_PLATE;
                }
            }
        }