Exemplo n.º 1
0
        /// <summary>
        /// 修改房态只能对处于非占用状态的房间进行状态修改
        /// </summary>
        /// <param name="cRoomStatus"></param>
        private void UpdateRoomStatus(char cRoomStatus)
        {
            try
            {
                if (mCustomerStay != null)
                {
                    if (mCustomerStay.RoomInfo.Status == cRoomStatus)
                    {
                        throw new Exception("房间状态未变!");
                    }

                    if (cRoomStatus == 'I' || cRoomStatus == 'T')
                    {
                        #region 已入住房间可以变更为散客房或者团体房

                        string sRoomType = cRoomStatus == 'I' ? "散客房间" : "团队房间";

                        if (!cmn.Confirm(string.Format("确定要将房间{0}变更为{1}?", mRoomInfo.RoomNo, sRoomType)))
                        {
                            return;
                        }

                        #region 变为散客房

                        if (cRoomStatus == 'I')
                        {
                            if (mCustomerStay.MainRoomId == mCustomerStay.RoomId)
                            {
                                if (!hml.UpdateCustomerStayMainRoomId(mCustomerStay))
                                {
                                    return;
                                }
                            }
                            else
                            {
                                mCustomerStay.MainRoomId = -1;
                                bCustomerStay.UpdateCustomerStay(mCustomerStay, new ObjectControls(MCtrl.SetMainRoomId));
                            }
                        }

                        #endregion

                        #region 变为团体房

                        else if (cRoomStatus == 'T')
                        {
                            List <CustomerStayModel> listCustomerStay = bCustomerStay.GetMainRoomGroup();

                            if (!cmn.CheckEOF(listCustomerStay))
                            {
                                throw new Exception("无团队房间,无法将散客房间变更为团队房间!");
                            }

                            FormTeamRoomSelector frmTeam = new FormTeamRoomSelector(listCustomerStay);
                            if (frmTeam.ShowDialog() != DialogResult.OK)
                            {
                                return;
                            }
                            hml.UpdateSingleRoomToTeamRoom(mCustomerStay, frmTeam.MainRoomId, frmTeam.CustomerId, UserInfo);
                        }

                        #endregion

                        #endregion
                    }
                    else
                    {
                        throw new Exception("已入住房间不能变更为可用,清理,预定或不可用状态");
                    }
                }
                mRoomInfo.Status     = cRoomStatus;
                mRoomInfo.RoomNotice = txtNotice.Text;
                mRoomInfo.CommonInfo.UpdateUserId = UserInfo.UserId;
                oCtrl.Reset();
                oCtrl.Add(MCtrl.SetNotice);
                oCtrl.Add(MCtrl.SetRoomStatus);
                bRoom.UpdateRoomInfo(mRoomInfo, oCtrl);
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception err)
            {
                cmn.Show(err.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改房态只能对处于非占用状态的房间进行状态修改
        /// </summary>
        /// <param name="cRoomStatus"></param>
        private void UpdateRoomStatus(char cRoomStatus)
        {
            try
            {
                if (mCustomerStay != null)
                {
                    if (mCustomerStay.RoomInfo.Status == cRoomStatus)
                    {
                        throw new Exception("房间状态未变!");
                    }

                    if (cRoomStatus == 'I' || cRoomStatus == 'T')
                    {
                        #region 已入住房间可以变更为散客房或者团体房

                        string sRoomType = cRoomStatus == 'I' ? "散客房间" : "团队房间";

                        if (!cmn.Confirm(string.Format("确定要将房间{0}变更为{1}?", mRoomInfo.RoomNo, sRoomType)))
                        {
                            return;
                        }

                        #region 变为散客房

                        if (cRoomStatus == 'I')
                        {
                            if (mCustomerStay.MainRoomId == mCustomerStay.RoomId)
                            {
                                if (!hml.UpdateCustomerStayMainRoomId(mCustomerStay))
                                {
                                    return;
                                }
                            }
                            else
                            {
                                mCustomerStay.MainRoomId = -1;
                                bCustomerStay.UpdateCustomerStay(mCustomerStay, new ObjectControls(MCtrl.SetMainRoomId));
                            }
                        }

                        #endregion

                        #region 变为团体房

                        else if (cRoomStatus == 'T')
                        {
                            List<CustomerStayModel> listCustomerStay =bCustomerStay.GetMainRoomGroup();

                            if (!cmn.CheckEOF(listCustomerStay))
                            {
                                throw new Exception("无团队房间,无法将散客房间变更为团队房间!");
                            }

                            FormTeamRoomSelector frmTeam = new FormTeamRoomSelector(listCustomerStay);
                            if (frmTeam.ShowDialog() != DialogResult.OK)
                            {
                                return;
                            }
                            hml.UpdateSingleRoomToTeamRoom(mCustomerStay, frmTeam.MainRoomId, frmTeam.CustomerId, UserInfo);
                        }

                        #endregion

                        #endregion
                    }
                    else
                    {
                        throw new Exception("已入住房间不能变更为可用,清理,预定或不可用状态");
                    }
                }
                mRoomInfo.Status = cRoomStatus;
                mRoomInfo.RoomNotice = txtNotice.Text;
                mRoomInfo.CommonInfo.UpdateUserId = UserInfo.UserId;
                oCtrl.Reset();
                oCtrl.Add(MCtrl.SetNotice);
                oCtrl.Add(MCtrl.SetRoomStatus);
                bRoom.UpdateRoomInfo(mRoomInfo, oCtrl);
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception err)
            {
                cmn.Show(err.Message);
            }
        }