コード例 #1
0
ファイル: BasRoomDao.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 删除房间
 /// </summary>
 /// <param name="mRoomInf"></param>
 /// <returns></returns>
 public bool DeleteRoomInfo(BasRoomModel mRoomInfo)
 {
     try
     {
         BAS_ROOM_INFO bri = dc.BAS_ROOM_INFO.First(c => c.ROOM_ID == mRoomInfo.RoomId);
         dc.BAS_ROOM_INFO.DeleteOnSubmit(bri);
         dc.SubmitChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
コード例 #2
0
ファイル: BasRoomDao.cs プロジェクト: gudaling/hotel
 public List<BasRoomModel> GetRoomInfo(BasRoomModel mRoom, ObjectControls oCtrl)
 {
     string sql = @"SELECT A.ROOM_ID, A.ROOM_NO, A.ROOM_TYPE,C.CODE_DESC AS ROOM_TYPE_DESC, A.ROOM_RATES, A.STATUS,
                      A.CREATE_DATE, A.CREATE_USERID, A.ROOM_PHONE, A.ROOM_NOTICE,A.UPDATE_DATE,A.UPDATE_USERID,
                      B.FLOOR_ID, B.FLOOR_NAME, B.STATUS AS FLOOR_STATUS
                      FROM BAS_ROOM_INFO AS A INNER JOIN
                      BAS_FLOOR_INFO AS B ON A.FLOOR_ID = B.FLOOR_ID
                     INNER JOIN SYS_LOOKUP_CODE AS C ON A.ROOM_TYPE=C.CODE_NO AND C.TABLE_NAME='BAS_ROOM_INFO'
                      AND C.COLUMN_NAME='ROOM_TYPE' ";
     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByRoomId) && oCtrl.Append(ref sql, " AND A.ROOM_ID=" + mRoom.RoomId));
     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByRoomNo) && oCtrl.Append(ref sql, " AND A.ROOM_NO=" + SQL(mRoom.RoomNo)));
     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByRoomStatus) && oCtrl.Append(ref sql, " AND A.STATUS=" + SQL(mRoom.Status)));
     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByRoomStatusGroup) && oCtrl.Append(ref sql, " AND A.STATUS IN (" + mRoom.StatusGroup+")"));
     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByRoomType) && oCtrl.Append(ref sql, " AND A.ROOM_TYPE=" + SQL(mRoom.RoomType)));
     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByFloorId) && oCtrl.Append(ref sql, " AND B.FLOOR_ID=" + mRoom.FloorInfo.FloorId));
     oCtrl.Helper(oCtrl.Exsit(MCtrl.ByFloorName) && oCtrl.Append(ref sql, " AND B.FLOOR_NAME=" + SQL(mRoom.FloorInfo.FloorName)));
     sql += " ORDER BY ROOM_NO";
     sdr = ExecuteReader(sql);
     List<BasRoomModel> listRoomInfo = new List<BasRoomModel>();
     using (sdr)
     {
         while (sdr.Read())
         {
             BasRoomModel mBasRoomInfo = new BasRoomModel();
             mBasRoomInfo.RoomId = ToInt32(sdr["ROOM_ID"]);
             mBasRoomInfo.RoomNo = ToString(sdr["ROOM_NO"]);
             mBasRoomInfo.RoomPhone = ToString(sdr["ROOM_PHONE"]);
             mBasRoomInfo.RoomRate = ToDouble(sdr["ROOM_RATES"]);
             mBasRoomInfo.RoomType = ToChar(sdr["ROOM_TYPE"]);
             mBasRoomInfo.RoomTypeDesc = ToString(sdr["ROOM_TYPE_DESC"]);
             mBasRoomInfo.RoomNotice = ToString(sdr["ROOM_NOTICE"]);
             mBasRoomInfo.Status = ToChar(sdr["STATUS"]);
             mBasRoomInfo.CommonInfo = new CommonModel();
             mBasRoomInfo.CommonInfo.CreateDate = ToDateTime(sdr["CREATE_DATE"]);
             mBasRoomInfo.CommonInfo.CreateUserId = ToInt32(sdr["CREATE_USERID"]);
             mBasRoomInfo.CommonInfo.UpdateDate = ToDateTime(sdr["UPDATE_DATE"]);
             mBasRoomInfo.CommonInfo.UpdateUserId = ToInt32(sdr["UPDATE_USERID"]);
             mBasRoomInfo.FloorInfo = new BasFloorModel();
             mBasRoomInfo.FloorInfo.FloorId = ToInt32(sdr["FLOOR_ID"]);
             mBasRoomInfo.FloorInfo.FloorName = ToString(sdr["FLOOR_NAME"]);
             mBasRoomInfo.FloorInfo.Status = ToChar(sdr["FLOOR_STATUS"]);
             listRoomInfo.Add(mBasRoomInfo);
         }
     }
     return listRoomInfo;
 }
コード例 #3
0
ファイル: FormTeamCustomers.cs プロジェクト: gudaling/hotel
 private void AddTvNode(BasRoomModel mRoom)
 {
     TreeNode tn = new TreeNode();
     tn.Text = mRoom.RoomNo;
     tn.Name = mRoom.RoomId.ToString();
     TreeNode[] tnl = tvEnableRoom.Nodes.Find(mRoom.RoomType.ToString(), false);
     if (tnl.Length > 0)
     {
         tnl[0].Nodes.Add(tn);
     }
     else
     {
         TreeNode tnN = new TreeNode();
         tnN.Text = mRoom.RoomTypeDesc;
         tnN.Name = mRoom.RoomType.ToString();
         tnN.Nodes.Add(tn);
         tvEnableRoom.Nodes.Add(tnN);
     }
 }
コード例 #4
0
ファイル: FormControl.cs プロジェクト: gudaling/hotel
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         CheckTextValue(new Object[] { txtRoomNo, txtRoomRate });
         if (!cmn.Confirm("保存房间信息?"))
         {
             return;
         }
         int nRoomId = 0;
         if (txtRoomNo.Tag != null && txtRoomNo.Tag.ToString() != "")
         {
             nRoomId = Convert.ToInt32(txtRoomNo.Tag);
         }
         var query = listRoom.Where(c => c.RoomId == nRoomId);
         if (query.Count() > 0)
         {
             oCtrl.Reset();
             oCtrl.Add(MCtrl.SetRoomNo);
             oCtrl.Add(MCtrl.SetRoomRate);
             oCtrl.Add(MCtrl.SetRoomType);
             oCtrl.Add(MCtrl.SetFloorId);
             oCtrl.Add(MCtrl.SetPhone);
             BasRoomModel mRoom = new BasRoomModel();
             mRoom.RoomNo = txtRoomNo.Text;
             mRoom.RoomPhone = txtRoomPhone.Text;
             mRoom.RoomRate = cmn.CheckIsDouble(txtRoomRate, "房间价格");
             mRoom.RoomType = cmn.ToChar(cboRoomType.SelectedValue);
             mRoom.FloorInfo.FloorId = int.Parse(cboFloor.SelectedValue.ToString());
             mRoom.RoomId = query.First().RoomId;
             bRoom.UpdateRoomInfo(mRoom, oCtrl);
         }
         else
         {
             query = listRoom.Where(c => c.RoomNo == txtRoomNo.Text);
             if (query.Count() > 0)
             {
                 cmn.Show("房间号已经存在,无法新增!");
                 return;
             }
             BasRoomModel mRoom = new BasRoomModel();
             mRoom.RoomNo = txtRoomNo.Text;
             mRoom.RoomPhone = txtRoomPhone.Text;
             mRoom.RoomRate = cmn.CheckIsDouble(txtRoomRate, "房间价格");
             mRoom.RoomType = cmn.ToChar(cboRoomType.SelectedValue);
             mRoom.FloorInfo.FloorId = int.Parse(cboFloor.SelectedValue.ToString());
             mRoom.Status = 'E';
             mRoom.RoomNotice = "";
             mRoom.CommonInfo.CreateUserId = UserInfo.UserId;
             bRoom.InsertRoomInfo(mRoom);
         }
         BindRoomList();
         tslblStatus.Text = "保存完毕";
         txtRoomNo.Text = "";
         txtRoomNo.Tag = "";
         txtRoomPhone.Text = "";
         txtRoomRate.Text = "";
     }
     catch (Exception err)
     {
         tslblStatus.Text = err.Message;
     }
 }
コード例 #5
0
ファイル: BasRoomDao.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 新增房间信息
 /// </summary>
 /// <param name="mRoomInfo"></param>
 /// <returns></returns>
 public bool InsertRoomInfo(BasRoomModel mRoomInfo)
 {
     try
     {
         BAS_ROOM_INFO bri = new BAS_ROOM_INFO();
         bri.ROOM_NO = mRoomInfo.RoomNo;
         bri.ROOM_TYPE = mRoomInfo.RoomType;
         bri.ROOM_RATES = mRoomInfo.RoomRate;
         bri.ROOM_PHONE = mRoomInfo.RoomPhone;
         bri.STATUS = mRoomInfo.Status;
         bri.FLOOR_ID = mRoomInfo.FloorInfo.FloorId;
         bri.ROOM_NOTICE = mRoomInfo.RoomNotice;
         bri.CREATE_DATE = GetDBTime;
         bri.CREATE_USERID = mRoomInfo.CommonInfo.CreateUserId;
         bri.UPDATE_DATE = bri.CREATE_DATE;
         bri.UPDATE_USERID = bri.CREATE_USERID;
         dc.BAS_ROOM_INFO.InsertOnSubmit(bri);
         dc.SubmitChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
コード例 #6
0
ファイル: FormMain.cs プロジェクト: gudaling/hotel
        private void GetRoomByFloor(int nFloorId)
        {
            if (tbcRoomInfo.TabCount > 0)
            {
                tbcRoomInfo.TabPages[nFloorId.ToString()].Controls.Clear();
            }
            BasRoomModel mRoomInfo = new BasRoomModel();
            mRoomInfo.FloorInfo = new BasFloorModel();
            mRoomInfo.FloorInfo.FloorId = nFloorId;
            oCtrl.Reset();
            oCtrl.Add(MCtrl.ByFloorId);
            List<BasRoomModel> listRoomInfo = bRoomInfo.GetRoomInfo(mRoomInfo, oCtrl);

            if (IsConnectDigiLock)
            {
                DigiRoomList = bDigiLock.GetPhoneDetail();
            }
            double dCleanTime = double.Parse(hml.ToParameter(listSysParameter, "DEFAULT_CLEAN_TIME").Value1);//退房后一段时间内默认为清理时间.单位为分钟
            for (int i = 0; i < listRoomInfo.Count; i++)
            {
                PictureBox pc = new PictureBox();

                //如果超过清理时间,则将房间状态更新为E (listRoomInfo[i].Status == 'O' && !cmn.CheckEOF(hml.GetRoomOrder(listRoomInfo[i])
                if ((listRoomInfo[i].Status == 'C' && dCleanTime > 0 &&
                    cmn.DateBaseDate.Subtract(listRoomInfo[i].CommonInfo.UpdateDate).TotalMinutes
                    >= dCleanTime))// && hml.GetCustomerStayInfoByRoom(listRoomInfo[i], 'I') == null
                {
                    listRoomInfo[i].Status = 'E';
                    hml.UpdateRoomStatusByRoomId(listRoomInfo[i], UserInfo);
                }
                pc.BackgroundImage = SelectRoomImage(listRoomInfo[i].Status);
                pc.AccessibleDescription = listRoomInfo[i].Status.ToString();
                pc.BackgroundImageLayout = ImageLayout.Zoom;
                pc.Tag = listRoomInfo[i].RoomId.ToString();
                pc.Name = listRoomInfo[i].RoomNo;
                pc.Size = new Size(32, 64);
                pc.Cursor = Cursors.Hand;
                pc.ContextMenuStrip = ctmsFunction;
                pc.Paint += new PaintEventHandler(peh);
                pc.MouseEnter += new EventHandler(pbMouseEnter);
                pc.MouseLeave += new EventHandler(pbMouseLeave);
                pc.Click += new EventHandler(pbClick);
                pc.Location = new Point(tbcRoomInfo.Location.X + (i % 19) * (pc.Size.Width + 10), tbcRoomInfo.Location.Y + Convert.ToInt32(i / 19) * (pc.Size.Height + 5));
                tbcRoomInfo.TabPages[nFloorId.ToString()].Controls.Add(pc);
            }
        }
コード例 #7
0
ファイル: FormPayMoney.cs プロジェクト: gudaling/hotel
        private void LoadUIInfo()
        {
            try
            {

                List<BasRoomModel> listRoom = new List<BasRoomModel>();
                BasRoomModel mRoom = new BasRoomModel();
                dtmNow = cmn.DateBaseDate;
                mRoom.StatusGroup = "'I','T'";
                IsCountPhone = hml.ToParameter(listSysParameter, "PHONE_JF").Value1.Equals("Y") ? true : false;
                btnPhoneList.Visible = IsCountPhone;
                listCat = bCall.GetPhoneCatList(null, oCtrl.EmptyCtrl);

                listRoom = bRoom.GetRoomInfo(mRoom, new ObjectControls(MCtrl.ByRoomStatusGroup));
                BindCodeInfo(cboPayType, "CUSTOMER_STAY_INFO", "PAY_TYPE");
                char cPayType = 'C';
                if (mRoomInfo.Status == 'I')
                {
                    #region 散客结账
                    mCustomerStay = hml.GetStayInRoomInfo(mRoomInfo, 'I',"");
                    if (mCustomerStay != null)
                    {
                        listCustomerStay.Add(mCustomerStay);
                        lblRoomNo.Text = mRoomInfo.RoomNo;
                        txtStayNo.Text = hml.GetStayNo(mCustomerStay.StayId, listSysParameter);
                        lblMainCustomer.Text = mCustomerStay.CustomerList[0].Name;
                        if (cmn.CheckEOF(mCustomerStay.CustomerList))
                        {
                            if (cmn.FileExsit(cmn.GetImgFilePath(mCustomerStay.CustomerList[0].Picture)))
                            {
                                pbxUserImg.Image = Image.FromFile(cmn.GetImgFilePath(mCustomerStay.CustomerList[0].Picture));
                            }
                            else
                            {
                                pbxUserImg.Image = mCustomerStay.CustomerList[0].Sex == "男" ? Properties.Resources.DefaultMan : Properties.Resources.DefaultWoman;
                            }
                            pbxUserImg.Size = pbxUserImg.Image.Size;
                        }
                        cPayType=mCustomerStay.PayType;
                        txtNotice.Text = mCustomerStay.Notice;
                        var q = listRoom.Where(c => c.RoomId == mRoomInfo.RoomId).First();
                        listRoom.Remove(q);
                        BindTreeViewRoom(tvUsedRooms, listRoom, "入住房间");
                        listRoom = new List<BasRoomModel>();
                        listRoom.Add(mRoomInfo);
                        BindTreeViewRoom(tvPayRooms, listRoom, "结账房间");
                        BindConsumeDetail(listCustomerStay);
                    }
                    else
                    {
                        cmn.Show("该房间不存在消费记录!");
                        this.Dispose();
                        return;
                    }
                    #endregion
                }
                else if (mRoomInfo.Status == 'T')
                {
                    #region 团队结账
                    List<BasRoomModel> listTeamRoom = hml.GetTeamRoomListByRoomId(mRoomInfo, 'I');
                    if (cmn.CheckEOF(listTeamRoom))
                    {
                        BindTreeViewRoom(tvPayRooms, listTeamRoom, "结账房间");
                        foreach (BasRoomModel mTeamRoom in listTeamRoom)
                        {
                            listRoom.Remove(listRoom.Where(c => c.RoomId == mTeamRoom.RoomId).FirstOrDefault());
                        }
                        listCustomerStay = hml.GetStayInRoomInfo(listTeamRoom, 'I',"", true);

                        BindTreeViewRoom(tvUsedRooms, listRoom, "入住房间");
                        BindConsumeDetail(listCustomerStay);

                        lblRoomNo.Text = "结账区域房间";
                        txtStayNo.Text = hml.GetStayNo(mCustomerStay.StayId, listSysParameter);
                        lblMainCustomer.Text = listCustomerStay[0].CustomerList[0].Name;
                        if (cmn.CheckEOF(listCustomerStay[0].CustomerList))
                        {
                            if (cmn.FileExsit(cmn.GetImgFilePath(listCustomerStay[0].CustomerList[0].Picture)))
                            {
                                pbxUserImg.Image = Image.FromFile(cmn.GetImgFilePath(listCustomerStay[0].CustomerList[0].Picture));
                            }
                            else
                            {
                                pbxUserImg.Image = listCustomerStay[0].CustomerList[0].Sex == "男" ? Properties.Resources.DefaultMan : Properties.Resources.DefaultWoman;
                            }
                            pbxUserImg.Size = pbxUserImg.Image.Size;
                        }
                        cPayType = listCustomerStay[0].PayType;
                        txtNotice.Text = listCustomerStay[0].Notice;
                    }
                    #endregion
                }
                else
                {
                    cmn.Show("该房间不存在消费记录!");
                    this.Close();
                }
                cboPayType.SelectedIndex = GetComboxIndexByKey(cboPayType,cPayType);
                CalculateTotal();
                CalculateChange();
            }
            catch (Exception err)
            {
                cmn.Show(err.Message);
            }
        }
コード例 #8
0
ファイル: FormRoomDetail.cs プロジェクト: gudaling/hotel
        private void GetRoomByStatus(string sCode)
        {
            tbcRoomInfo.TabPages[0].Text = cboRoomStatus.Text;
            tbcRoomInfo.TabPages[0].Controls.Clear();

            List<BasRoomModel> listRoomInfo = new List<BasRoomModel>();
            BasRoomModel mRoomInfo = new BasRoomModel();
            if (cboRoomStatus.SelectedIndex != 0)
            {
                mRoomInfo.Status = cmn.ToChar(sCode);
                oCtrl.Reset();
                oCtrl.Add(MCtrl.ByRoomStatus);
            }
            else
            {
                oCtrl = oCtrl.EmptyCtrl;
            }
            listRoomInfo = bRoomInfo.GetRoomInfo(mRoomInfo, oCtrl);
            listAllRoomInfo = listRoomInfo;
            tslblTotal.Text = cboRoomStatus.Text + " 共计 " + listRoomInfo.Count() + "间房";
            if (IsConnectDigiLock)
            {
                DigiRoomList = bDigiLock.GetPhoneDetail();
            }
            double dCleanTime = double.Parse(hml.ToParameter(listSysParameter, "DEFAULT_CLEAN_TIME").Value1);//退房后一段时间内默认为清理时间.单位为分钟
            List<CustomerStayModel> listAllStayCustomer = new List<CustomerStayModel>();
            listAllStayCustomer = hml.GetStayInRoomInfo(listRoomInfo, 'I', "", false);
            for (int i = 0; i < listRoomInfo.Count; i++)
            {
                PictureBox pc = new PictureBox();

                //如果超过清理时间,则将房间状态更新为E (listRoomInfo[i].Status == 'O' && !cmn.CheckEOF(hml.GetRoomOrder(listRoomInfo[i])
                if ((listRoomInfo[i].Status == 'C' && dCleanTime > 0 &&
                    cmn.DateBaseDate.Subtract(listRoomInfo[i].CommonInfo.UpdateDate).TotalMinutes
                    >= dCleanTime))// && hml.GetCustomerStayInfoByRoom(listRoomInfo[i], 'I') == null
                {
                    listRoomInfo[i].Status = 'E';
                    hml.UpdateRoomStatusByRoomId(listRoomInfo[i], UserInfo);
                }
                pc.BackgroundImage = SelectRoomImage(listRoomInfo[i].Status);
                pc.BackgroundImageLayout = ImageLayout.Center;
                pc.Tag = listRoomInfo[i].RoomId.ToString();
                pc.Name = listRoomInfo[i].RoomNo;

                if ((listRoomInfo[i].Status == 'I' || listRoomInfo[i].Status == 'T') && cmn.CheckEOF(listAllStayCustomer))
                {
                    var query = listAllStayCustomer.Where(c => c.RoomId == listRoomInfo[i].RoomId);
                    if (query.Count() > 0)
                    {
                        foreach (CustomerModel mc in query.First().CustomerList)
                        {
                            pc.AccessibleName += mc.Name + ";";
                        }
                        pc.AccessibleDescription = query.First().MainRoomId.ToString();
                    }
                }
                pc.AccessibleDefaultActionDescription = listRoomInfo[i].Status.ToString();

                pc.Size = new Size(40, 85);
                pc.Cursor = Cursors.Hand;
                pc.ContextMenuStrip = ctmsFunction;
                pc.Paint += new PaintEventHandler(peh);
                pc.MouseEnter += new EventHandler(pbMouseEnter);
                pc.MouseLeave += new EventHandler(pbMouseLeave);
                pc.Click += new EventHandler(pbClick);
                pc.Location = new Point(tbcRoomInfo.Location.X + (i % 12) * (pc.Size.Width + 10), Convert.ToInt32(i / 12) * (pc.Size.Height));
                tbcRoomInfo.TabPages[0].Controls.Add(pc);
            }
        }
コード例 #9
0
ファイル: FormChangeRoom.cs プロジェクト: gudaling/hotel
 public FormChangeRoom(BasRoomModel mRoomInfo)
 {
     InitializeComponent();
     this.mRoomInfo = mRoomInfo;
 }
コード例 #10
0
ファイル: FormOneCustomer.cs プロジェクト: gudaling/hotel
 public FormOneCustomer(BasRoomModel mRoomInfo)
 {
     InitializeComponent();
     this.mRoomInfo = mRoomInfo;
 }
コード例 #11
0
ファイル: FormTeamCustomers.cs プロジェクト: gudaling/hotel
 private void tvEnableRoom_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node != null&&e.Node.Level>0)
     {
         BasRoomModel mSelectedRoom = new BasRoomModel();
         var query = listRoomInfo.Where(c => c.RoomNo == e.Node.Text).First();
         mSelectedRoom = query;
         listSelectedRoom.Add(mSelectedRoom);
         listRoomInfo.Remove(query);
         tvEnableRoom.Nodes.Remove(e.Node);
         BindSelectedRoomDgv(listSelectedRoom);
         BindMainRoom(listSelectedRoom);
     }
 }
コード例 #12
0
ファイル: FormTeamCustomers.cs プロジェクト: gudaling/hotel
 private void pbtnRemove_Click(object sender, EventArgs e)
 {
     if (dgvSelectedRoom.SelectedRows.Count > 0)
     {
         DataGridViewRow dgvr = dgvSelectedRoom.SelectedRows[0];
         if (dgvr != null)
         {
             BasRoomModel mSelectedRoom = new BasRoomModel();
             var query = listSelectedRoom.Where(c => c.RoomNo == dgvr.Cells["RoomNo"].Value.ToString()).First();
             mSelectedRoom = query;
             listRoomInfo.Add(mSelectedRoom);
             listSelectedRoom.Remove(query);
             AddTvNode(mSelectedRoom);
             BindSelectedRoomDgv(listSelectedRoom);
             BindMainRoom(listSelectedRoom);
         }
     }
 }
コード例 #13
0
ファイル: FormTeamCustomers.cs プロジェクト: gudaling/hotel
 private void pbtnAdd_Click(object sender, EventArgs e)
 {
     TreeNode tn = tvEnableRoom.SelectedNode;
     if (tn != null && tn.Level > 0)
     {
         BasRoomModel mSelectedRoom = new BasRoomModel();
         var query = listRoomInfo.Where(c => c.RoomNo == tn.Text).First();
         mSelectedRoom = query;
         listSelectedRoom.Add(mSelectedRoom);
         listRoomInfo.Remove(query);
         tvEnableRoom.Nodes.Remove(tn);
         BindSelectedRoomDgv(listSelectedRoom);
         BindMainRoom(listSelectedRoom);
     }
 }
コード例 #14
0
ファイル: FormTeamCustomers.cs プロジェクト: gudaling/hotel
 private void LoadUIInfo()
 {
     oCtrl.Reset();
     oCtrl.Add(MCtrl.ByRoomStatus);
     BasRoomModel mRoom = new BasRoomModel();
     mRoom.Status = 'E';
     listRoomInfo = bRoom.GetRoomInfo(mRoom, oCtrl);
     BindEnabledRoomTree(listRoomInfo);
     BindCodeInfo(cboPayType, "CUSTOMER_STAY_INFO", "PAY_TYPE");
     cboSex.SelectedIndex = 0;
     dDiskon = double.Parse(hml.ToParameter(listSysParameter, "DEFAULT_DISKON").Value1);
 }
コード例 #15
0
ファイル: FormTeamCustomers.cs プロジェクト: gudaling/hotel
 private void dgvSelectedRoom_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e != null)
     {
         BasRoomModel mSelectedRoom = new BasRoomModel();
         var query = listSelectedRoom.Where(c => c.RoomNo == dgvSelectedRoom.Rows[e.RowIndex].Cells["RoomNo"].Value.ToString()).First();
         mSelectedRoom = query;
         listRoomInfo.Add(mSelectedRoom);
         listSelectedRoom.Remove(query);
         AddTvNode(mSelectedRoom);
         BindSelectedRoomDgv(listSelectedRoom);
         BindMainRoom(listSelectedRoom);
     }
 }
コード例 #16
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
        /// <summary>
        /// 换房逻辑,换房只能从一个已入住房间换到状态为可用的房间.
        /// </summary>
        /// <param name="mCustomerStay">入住信息</param>
        /// <param name="mNewRoomInfo">新房信息</param>
        /// <param name="dNewRoomRate">新房费用</param>
        /// <param name="mUserInfo">系统用户信息</param>
        /// <param name="listSysParameter">系统参数</param>
        public void ChangeRoom(CustomerStayModel mCustomerStay, BasRoomModel mNewRoomInfo,double dNewRoomRate, SysUserInfoModel mUserInfo, List<SysParameterModel> listSysParameter)
        {
            try
            {
                #region 将之前房间费用(光房间费用)加入到消费清单中.

                ConsumeDetailModel mConsume = new ConsumeDetailModel();
                BasGoodsModel mGoods = new BasGoodsModel();
                mGoods.Type = 'R';
                List<BasGoodsModel> listGoods = bGoods.GetGoodsInfo(mGoods, new ObjectControls(MCtrl.ByGoodsType));
                if (Cmn.CheckEOF(listGoods))
                {
                    mConsume.GoodsId = listGoods[0].GoodsId;
                }
                else
                {
                    throw new Exception("未定义类型的R的商品,该类型为房间费.");
                }
                mConsume.StayId = mCustomerStay.StayId;
                mConsume.UnitPrice = mCustomerStay.RoomRate;
                RoomStayType eRst = mCustomerStay.RoomStayType == 'D' ? RoomStayType.Day : RoomStayType.Hour;
                DateTime dtNow = Cmn.DateBaseDate;
                mConsume.Number = GetCustomerStayDays(mCustomerStay.CommonInfo.StartDate, dtNow,dtNow, eRst, listSysParameter);
                mConsume.Total = GetTotalRates(mCustomerStay, null, listSysParameter, dtNow, 0.0);
                mConsume.CommonInfo = new CommonModel();
                mConsume.CommonInfo.CreateDate = mCustomerStay.CommonInfo.StartDate;
                mConsume.CommonInfo.CreateUserId = mUserInfo.UserId;
                mConsume.CommonInfo.UpdateUserId = mUserInfo.UserId;
                bConsume.InsertConsumeDetail(mConsume);

                #endregion

                #region 是否团队房间
                if (mCustomerStay.MainRoomId == mCustomerStay.RoomId)
                {
                    if (Cmn.Confirm(string.Format("{0}为主房间,变更后{1}将成为主房间,是否继续?", mCustomerStay.RoomInfo.RoomNo, mNewRoomInfo.RoomNo)))
                    {
                        #region 将团队房间的MainRoomId变为新ID
                        List<BasRoomModel> listTeamRoom = GetTeamRoomListByRoomId(mCustomerStay.RoomInfo, 'I');
                        if (Cmn.CheckEOF(listTeamRoom))
                        {
                            ObjectControls oCtrl = new ObjectControls();
                            oCtrl.Add(MCtrl.SetMainRoomId);
                            foreach (BasRoomModel mRoom in listTeamRoom)
                            {
                                CustomerStayModel mCs = new CustomerStayModel();
                                mCs.RoomId = mRoom.RoomId;
                                mCs.Status = 'I';
                                ObjectControls oc = new ObjectControls();
                                oc.Add(MCtrl.ByStayStatus);
                                oc.Add(MCtrl.ByRoomId);
                                mCs = bCustomerStay.GetCustomerStayInfo(mCs, oc);
                                if (mCs != null)
                                {
                                    mCs.MainRoomId = mNewRoomInfo.RoomId;
                                    bCustomerStay.UpdateCustomerStay(mCs, oCtrl);
                                }
                            }
                        }
                        #endregion
                    }
                }
                #endregion

                #region 将原来房间置为清理,将新房间设置为入住

                ObjectControls oCtrlMain = new ObjectControls();
                oCtrlMain.Add(MCtrl.SetRoomId);
                oCtrlMain.Add(MCtrl.SetStartDate);
                oCtrlMain.Add(MCtrl.SetHours);
                oCtrlMain.Add(MCtrl.SetRoomRate);
                mCustomerStay.RoomId = mNewRoomInfo.RoomId;
                mCustomerStay.CommonInfo.StartDate = Cmn.DateBaseDate;
                double dDays = GetCustomerStayDays(mCustomerStay.CommonInfo.StartDate, mCustomerStay.CommonInfo.EndDate,mCustomerStay.CommonInfo.StartDate, eRst, listSysParameter);

                mCustomerStay.Hours = eRst == RoomStayType.Day ? Convert.ToInt32(dDays * 24) : Convert.ToInt32(dDays);
                mCustomerStay.RoomRate = dNewRoomRate;
                bCustomerStay.UpdateCustomerStay(mCustomerStay, oCtrlMain);

                mNewRoomInfo.Status = mCustomerStay.RoomInfo.Status;
                UpdateRoomStatusByRoomId(mNewRoomInfo, mUserInfo);

                mCustomerStay.RoomInfo.Status = 'C';
                UpdateRoomStatusByRoomId(mCustomerStay.RoomInfo, mUserInfo);

                #endregion
            }
            catch (Exception err)
            {
                throw err;
            }
        }
コード例 #17
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 开房前检测房间是否可用
 /// </summary>
 /// <param name="mRoom"></param>
 /// <returns></returns>
 public bool OpenRoomCheck(BasRoomModel mRoom)
 {
     if (mRoom.RoomId>0)
     {
         if (mRoom.Status == 'I' || mRoom.Status == 'T')
         {
             Cmn.Show("房间已被占用,无法开单.");
             return false;
         }
         else if (mRoom.Status == 'C' || mRoom.Status == 'D')
         {
             string sRoomStatus = mRoom.Status == 'C' ? "清理" : "停用";
             if (!Cmn.Confirm(string.Format("房间{0}处于{1}状态,继续开单?", mRoom.RoomNo, sRoomStatus)))
             {
                 return false;
             }
         }
         return true;
     }
     return false;
 }
コード例 #18
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 修改房态 ById
 /// </summary>
 /// <param name="mRoom"></param>
 public void UpdateRoomStatusByRoomId(BasRoomModel mRoom,SysUserInfoModel mUserInfo)
 {
     mRoom.CommonInfo.UpdateUserId = mUserInfo.UserId;
     bRoom.UpdateRoomInfo(mRoom, new ObjectControls(MCtrl.SetRoomStatus));
 }
コード例 #19
0
ファイル: FormChangeRoom.cs プロジェクト: gudaling/hotel
 private void LoadUIInfo()
 {
     try
     {
         mCustomerStay = hml.GetStayInRoomInfo(mRoomInfo, 'I',"M");
         if (mCustomerStay != null)
         {
             if (mCustomerStay.CommonInfo.EndDate.Date <= cmn.DateBaseDate.Date)
             {
                 throw new Exception("已到达退房日期,请先续住后再换房");
             }
             lblRoomNo.Text = mRoomInfo.RoomNo;
             oCtrl.Reset();
             oCtrl.Add(MCtrl.ByRoomStatus);
             BasRoomModel mRoom = new BasRoomModel();
             mRoom.Status = 'E';
             listRoomInfo = bRoom.GetRoomInfo(mRoom, oCtrl);
             if (cmn.CheckEOF(listRoomInfo))
             {
                 cboNewRoom.DataSource = listRoomInfo;
                 cboNewRoom.DisplayMember = "RoomNo";
                 cboNewRoom.ValueMember = "RoomId";
                 txtRoomRate.Text = listRoomInfo[0].RoomRate.ToString();
             }
         }
         else
         {
             throw new Exception("该房间无入住信息,无法换房");
         }
     }
     catch (Exception err)
     {
         cmn.Show(err.Message);
         this.Close();
     }
 }
コード例 #20
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 检测房间在这段时间内被预定或者处于不可预定状态.不可预定状态一般为RoomStatus为D
 /// </summary>
 /// <param name="listOrderedInfo">已预定的信息</param>
 /// <param name="mRoom">预定的房间</param>
 /// <param name="dtStartTime">预抵时间</param>
 /// <param name="dtEndTime">预离时间</param>
 /// <returns>如果验证通过返回True,反之返回False</returns>
 public bool CheckRoomOrdered(List<OrderInfoModel>listOrderedInfo,BasRoomModel mRoom, DateTime dtStartTime,DateTime dtEndTime)
 {
     if (Cmn.CheckEOF(listOrderedInfo))
     {
         var qOrder = listOrderedInfo.Where(c => c.RoomInfo.RoomId == mRoom.RoomId);
         if (qOrder.Count() > 0 && (qOrder.First().RoomInfo.Status != 'E' ||
             (qOrder.First().CommonInfo.StartDate < dtStartTime && qOrder.First().CommonInfo.EndDate > dtStartTime) ||
              (qOrder.First().CommonInfo.StartDate < dtEndTime && qOrder.First().CommonInfo.EndDate > dtEndTime)
             ))
         {
             if (!Cmn.Confirm("该房间目前处于非可用状态或者已经被预定,是否继续?"))
             {
                 return false;
             }
         }
     }
     else if (mRoom.Status != 'E')
     {
         if (!Cmn.Confirm("该房间目前处于非可用状态,是否继续?"))
         {
             return false;
         }
     }
     return true;
 }
コード例 #21
0
ファイル: FormRoomDetail.cs プロジェクト: gudaling/hotel
 private void UpdateRoomStatus(string sRoomNo, int nRoomId, char cStatus)
 {
     string sChangeType = "";
     switch (cStatus)
     {
         case 'E':
             sChangeType = "可用";
             break;
         case 'D':
             sChangeType = "停用";
             break;
         case 'C':
             sChangeType = "清理";
             break;
     }
     if (!cmn.Confirm(string.Format("确定更改房间{0}为{1}状态?", sRoomNo, sChangeType)))
     {
         return;
     }
     BasRoomModel mRoom = new BasRoomModel(nRoomId);
     mRoom.Status = cStatus;
     hml.UpdateRoomStatusByRoomId(mRoom, UserInfo);
     GetRoomByStatus(cboRoomStatus.SelectedValue.ToString());
 }
コード例 #22
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 仅获取宾客入住信息
 /// </summary>
 /// <param name="mRoom"></param>
 /// <param name="cStayStatus"></param>
 /// <returns></returns>
 public CustomerStayModel GetCustomerStayInfoByRoom(BasRoomModel mRoom, char cStayStatus)
 {
     CustomerStayModel mStayInfo = new CustomerStayModel();
     ObjectControls oCtrl = new ObjectControls();
     mStayInfo.RoomId = mRoom.RoomId;
     mStayInfo.Status = cStayStatus;
     oCtrl.Add(MCtrl.ByRoomId);
     oCtrl.Add(MCtrl.ByStayStatus);
     return bCustomerStay.GetCustomerStayInfo(mStayInfo, oCtrl);
 }
コード例 #23
0
ファイル: FormPayMoney.cs プロジェクト: gudaling/hotel
 public FormPayMoney(BasRoomModel mRoomInfo)
 {
     InitializeComponent();
     this.mRoomInfo = mRoomInfo;
 }
コード例 #24
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 获取房间有效的预定
 /// </summary>
 /// <param name="mRoom"></param>
 /// <returns></returns>
 public List<OrderInfoModel> GetRoomOrder(BasRoomModel mRoom)
 {
     OrderInfoModel mOrder = new OrderInfoModel();
     mOrder.RoomInfo = mRoom;
     mOrder.KeepDate = Cmn.DateBaseDate;
     mOrder.Status = 'E';
     ObjectControls oCtrl = new ObjectControls();
     oCtrl.Reset();
     oCtrl.Add(MCtrl.ByRoomId);
     oCtrl.Add(MCtrl.ByKeepDateEnable);
     oCtrl.Add(MCtrl.ByOrderStatus);
     return bOrder.GetOrderInfo(mOrder, oCtrl);
 }
コード例 #25
0
ファイル: FormMain.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 保存备注信息.如房间已近入住,则备注保存于CUSTOMER_STAY_INFO 的notice,否则保存到BAS_ROOM_INFO 的ROOM_NOTICE栏位
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pbtnSaveNotice_Click(object sender, EventArgs e)
 {
     if (txtNotice.Tag != null && cmn.Confirm("保存备注?"))
     {
         if (txtNotice.Tag.ToString() == "E")
         {
             BasRoomModel mr = new BasRoomModel();
             mr.RoomId = int.Parse(txtNotice.AccessibleName);
             mr.RoomNotice = txtNotice.Text;
             mr.CommonInfo.UpdateUserId = UserInfo.UserId;
             bRoomInfo.UpdateRoomInfo(mr, new ObjectControls(MCtrl.SetNotice));
         }
         else
         {
             CustomerStayModel mcs = new CustomerStayModel();
             mcs.StayId = int.Parse(txtNotice.Tag.ToString());
             mcs.Notice = txtNotice.Text;
             mcs.CommonInfo.UpdateUserId = UserInfo.UserId;
             bStay.UpdateCustomerStay(mcs, new ObjectControls(MCtrl.SetNotice));
         }
         cmn.Show("保存完毕!");
         ShowRoom(int.Parse(tbcRoomInfo.SelectedTab.Name));
     }
 }
コード例 #26
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 获取宾客入住信息,消费明细
 /// </summary>
 /// <param name="mRoom">房间信息</param>
 /// <param name="cStayStatus">入住状态 I In / O off</param>
 /// <param name="sStayType">入住类型,主客M从客S,如包含主从则为""</param>
 /// <returns></returns>
 public CustomerStayModel GetStayInRoomInfo(BasRoomModel mRoom, char cStayStatus, string sStayType)
 {
     CustomerStayModel mStayInfo = new CustomerStayModel();
         ObjectControls oCtrl = new ObjectControls();
         mStayInfo.RoomId = mRoom.RoomId;
         mStayInfo.Status = cStayStatus;
         mStayInfo.CustomerList = new List<CustomerModel>();
         CustomerModel mc = new CustomerModel();
         mc.CustomerStayHisInfo = new CustomerStayHisModel();
         if (!string.IsNullOrEmpty(sStayType))
         {
             mc.CustomerStayHisInfo.StayType = Cmn.ToChar(sStayType);
             oCtrl.Add(MCtrl.ByStayType);
         }
         mc.CustomerStayHisInfo.HisStatus = cStayStatus == 'I' ? 'E' : 'O';
         mStayInfo.CustomerList.Add(mc);
         oCtrl.Add(MCtrl.ByRoomId);
         oCtrl.Add(MCtrl.ByStayStatus);
         oCtrl.Add(MCtrl.ByHisStatus);
         CustomerStayModel mCustomerStay = bCustomerStay.GetCustomerStayInfo(mStayInfo, oCtrl);
         if (mCustomerStay != null)
         {
             List<ConsumeDetailModel> listGetConsumeDetail = new List<ConsumeDetailModel>();
             ConsumeDetailModel mConsume = new ConsumeDetailModel();
             mConsume.StayId = mCustomerStay.StayId;
             oCtrl.Reset();
             oCtrl.Add(MCtrl.ByStayId);
             listGetConsumeDetail = bConsume.GetConsumeList(mConsume, oCtrl);
             if (Cmn.CheckEOF(listGetConsumeDetail))
             {
                 mCustomerStay.ConSumeDetailList = listGetConsumeDetail;
             }
         }
         return mCustomerStay;
 }
コード例 #27
0
ファイル: BasRoomDao.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 修改房间信息
 /// </summary>
 /// <param name="mRoomInfo"></param>
 /// <param name="oCtrl"></param>
 /// <returns></returns>
 public int UpdateRoomInfo(BasRoomModel mRoomInfo, ObjectControls oCtrl)
 {
     try
     {
         string sql = "UPDATE BAS_ROOM_INFO SET  CREATE_DATE=CREATE_DATE";
         oCtrl.Helper(oCtrl.Exsit(MCtrl.SetRoomNo) && oCtrl.Append(ref sql, ",ROOM_NO=" + SQL(mRoomInfo.RoomNo)));
         oCtrl.Helper(oCtrl.Exsit(MCtrl.SetRoomStatus) && oCtrl.Append(ref sql, ",STATUS=" + SQL(mRoomInfo.Status)));
         oCtrl.Helper(oCtrl.Exsit(MCtrl.SetRoomRate) && oCtrl.Append(ref sql, ",ROOM_RATES=" + SQL(mRoomInfo.RoomRate)));
         oCtrl.Helper(oCtrl.Exsit(MCtrl.SetPhone) && oCtrl.Append(ref sql, ",ROOM_PHONE=" + SQL(mRoomInfo.RoomPhone)));
         oCtrl.Helper(oCtrl.Exsit(MCtrl.SetRoomType) && oCtrl.Append(ref sql, ",ROOM_TYPE=" + SQL(mRoomInfo.RoomType)));
         oCtrl.Helper(oCtrl.Exsit(MCtrl.SetFloorId) && oCtrl.Append(ref sql, ",FLOOR_ID=" + SQL(mRoomInfo.FloorInfo.FloorId)));
         oCtrl.Helper(oCtrl.Exsit(MCtrl.SetNotice) && oCtrl.Append(ref sql, ",ROOM_NOTICE=" + SQL(mRoomInfo.RoomNotice)));
         sql += ",UPDATE_DATE=" + SQL(GetDBTime);
         sql += ",UPDATE_USERID=" + SQL(mRoomInfo.CommonInfo.UpdateUserId);
         sql += " WHERE ROOM_ID=" + mRoomInfo.RoomId;
         return ExcuteNonQuery(sql);
     }
     catch (Exception err)
     {
         throw err;
     }
 }
コード例 #28
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
 /// <summary>
 /// 根据一个RoomId获取团队所有房间
 /// </summary>
 /// <param name="mRoom"></param>
 /// <returns></returns>
 public List<BasRoomModel> GetTeamRoomListByRoomId(BasRoomModel mRoom,char cStayStatus)
 {
     CustomerStayModel mCustomerStay = new CustomerStayModel();
     mCustomerStay.RoomId = mRoom.RoomId;
     mCustomerStay.Status = cStayStatus;
     ObjectControls oCtrl = new ObjectControls();
     oCtrl.Add(MCtrl.ByStayStatus);
     oCtrl.Add(MCtrl.ByRoomId);
     CustomerStayModel mC = bCustomerStay.GetCustomerStayInfo(mCustomerStay, oCtrl);
     if (mC.MainRoomId > 0)
     {
         oCtrl.Reset();
         oCtrl.Add(MCtrl.ByStayStatus);
         oCtrl.Add(MCtrl.ByMainRoomId);
         return bRoom.GetTeamRoomList(mC, oCtrl);
     }
     else
     {
         return new List<BasRoomModel>();
     }
 }
コード例 #29
0
ファイル: HotelMainLogic.cs プロジェクト: gudaling/hotel
        /// <summary>
        /// 开房以及修改房间信息逻辑.支持房间多人以及团体开房.支持房间人数变更以及宾客信息变更.
        /// </summary>
        /// <param name="listCustomerStayInfo"></param>
        /// <param name="listCustomerInfo"></param>
        /// <param name="eRmType"></param>
        /// <returns></returns>
        public bool OpendOrUpdateRoom(List<CustomerStayModel> listCustomerStayInfo, List<CustomerModel> listCustomerInfo, RoomLogicType eRmType)
        {
            try
            {
                if (listCustomerStayInfo[0].RoomStayType == 'D' && listCustomerStayInfo[0].Hours == 0)
                {
                    throw new Exception("非钟点房,预住天数不能为零.");
                }
                if (eRmType == RoomLogicType.OpenRoom)
                {
                    #region 开单

                    //如团体开房,则每个房间新增一个StayId
                    foreach (CustomerStayModel mCustomerStay in listCustomerStayInfo)
                    {
                        int nStayId = bCustomerStay.InsertCustomerStay(mCustomerStay);
                        BasRoomModel mRoom = new BasRoomModel();
                        mRoom.RoomId = mCustomerStay.RoomId;
                        mRoom.Status = mCustomerStay.RoomInfo.Status;
                        mRoom.CommonInfo = mCustomerStay.CommonInfo;
                        UpdateRoomStatusByRoomId(mRoom, new SysUserInfoModel(mCustomerStay.CommonInfo.UpdateUserId));
                        //每个房间可能多个入住人员
                        foreach (CustomerModel mCustomer in listCustomerInfo)
                        {
                            //检查宾客信息是否存在,存在则更新较新的信息.姓名和证件号不更新
                            List<CustomerModel> listCustomerOld = GetExistCustomerInfo(mCustomer);
                            int nCustomerId = 0;
                            if (Cmn.CheckEOF(listCustomerOld))
                            {
                                UpdateExsitCustomerInfo(mCustomer, listCustomerOld[0]);
                                nCustomerId = listCustomerOld[0].CustomerId;
                            }
                            else
                            {
                                nCustomerId = bCustomer.InsertCustomer(mCustomer);
                            }
                            CustomerStayHisModel mHis = new CustomerStayHisModel();
                            mHis.StayId = nStayId;
                            mHis.CustomerId = nCustomerId;
                            mHis.StayType = mCustomer.CustomerStayHisInfo.StayType;
                            mHis.HisStatus = 'E';
                            mHis.CommonInfo = new CommonModel();
                            mHis.CommonInfo.StartDate = mCustomerStay.CommonInfo.StartDate;
                            mHis.CommonInfo.EndDate = mCustomerStay.CommonInfo.EndDate;

                            mHis.CommonInfo.CreateDate = mCustomerStay.CommonInfo.CreateDate;
                            mHis.CommonInfo.CreateUserId = mCustomerStay.CommonInfo.CreateUserId;

                            bCustomerStay.InsertCustomerStayHis(mHis);
                        }
                    }
                    #endregion
                }
                else
                {
                    #region 修改房间信息

                    foreach (CustomerStayModel mCustomerStay in listCustomerStayInfo)
                    {
                        ObjectControls oCtrl = new ObjectControls();
                        oCtrl.Add(MCtrl.SetDeposit);
                        oCtrl.Add(MCtrl.SetMainRoomId);
                        oCtrl.Add(MCtrl.SetNotice);
                        oCtrl.Add(MCtrl.SetPayType);
                        oCtrl.Add(MCtrl.SetRoomId);
                        oCtrl.Add(MCtrl.SetRoomRate);
                        oCtrl.Add(MCtrl.SetCustomerStayStatus);
                        oCtrl.Add(MCtrl.SetRoomStayType);
                        oCtrl.Add(MCtrl.SetEndDate);
                        oCtrl.Add(MCtrl.SetHours);
                        //修改入住信息
                        bCustomerStay.UpdateCustomerStay(mCustomerStay, oCtrl);
                        foreach (CustomerModel mCustomer in listCustomerInfo)
                        {
                            //检查宾客信息是否存在,存在则更新较新的信息.姓名和证件号不更新
                            List<CustomerModel> listCustomerOld = GetExistCustomerInfo(mCustomer);
                            int nCustomerId = 0;
                            if (Cmn.CheckEOF(listCustomerOld))
                            {
                                mCustomer.CommonInfo.UpdateUserId = mCustomerStay.CommonInfo.UpdateUserId;
                                UpdateExsitCustomerInfo(mCustomer, listCustomerOld[0]);
                                nCustomerId = listCustomerOld[0].CustomerId;
                            }
                            else
                            {
                                nCustomerId = bCustomer.InsertCustomer(mCustomer);
                            }
                            CustomerStayHisModel mHis = new CustomerStayHisModel();
                            mHis.StayId = mCustomerStay.StayId;
                            mHis.CustomerId = nCustomerId;
                            oCtrl.Reset();
                            oCtrl.Add(MCtrl.ByStayId);
                            oCtrl.Add(MCtrl.ByCustomerId);
                            List<CustomerStayHisModel> listStayHis = bCustomerStay.GetStayHis(mHis, oCtrl);
                            if (Cmn.CheckEOF(listStayHis))
                            {
                                mHis.HisId = listStayHis[0].HisId;
                                mHis.HisStatus = mCustomer.CustomerStayHisInfo.HisStatus;
                                mHis.StayType = mCustomer.CustomerStayHisInfo.StayType;
                                mHis.CommonInfo = new CommonModel();
                                mHis.CommonInfo.UpdateUserId = mCustomerStay.CommonInfo.UpdateUserId;
                                oCtrl.Reset();
                                oCtrl.Add(MCtrl.SetHisStatus);
                                oCtrl.Add(MCtrl.SetHisType);
                                //如果用户选择将房间内某一宾客离店,则该宾客的离店时间为现在.开始时间不变
                                if (mHis.HisStatus == 'O')
                                {
                                    mHis.CommonInfo.EndDate = Cmn.DateBaseDate;
                                    oCtrl.Add(MCtrl.SetEndDate);
                                }

                                bCustomerStay.UpdateStayHis(mHis, oCtrl);
                            }
                            else
                            {
                                mHis.StayType = mCustomer.CustomerStayHisInfo.StayType;
                                mHis.HisStatus = mCustomer.CustomerStayHisInfo.HisStatus;
                                mHis.CommonInfo = new CommonModel();
                                mHis.CommonInfo.CreateUserId = mCustomerStay.CommonInfo.UpdateUserId;
                                mHis.CommonInfo.UpdateUserId = mCustomerStay.CommonInfo.UpdateUserId;

                                //如宾客为新增加到该房间内的.则他的入住时间从现在开始,到该房间的预住结束时间为止.
                                mHis.CommonInfo.StartDate = Cmn.DateBaseDate;
                                mHis.CommonInfo.EndDate = mCustomerStay.CommonInfo.EndDate;

                                bCustomerStay.InsertCustomerStayHis(mHis);
                            }
                        }
                    }
                    #endregion
                }
                return true;
            }
            catch (Exception err)
            {
                throw err;
            }
        }
コード例 #30
0
ファイル: FormAddPay.cs プロジェクト: gudaling/hotel
 public FormAddPay(CustomerStayModel mCustomerStayInfo)
 {
     InitializeComponent();
     this.mRoomInfo = mCustomerStayInfo.RoomInfo;
     mCustomerStay = mCustomerStayInfo;
 }