示例#1
0
        private void Change_Click(object sender, EventArgs e)
        {
            int statuscode = -2;
            int roomid     = 0;
            int index      = -99;
            int a          = -1000;

            if (ChangeType.Text == "" || SelectType.Text == "" && SelectType.Visible == true || ChangeValue.Text == "" && SelectType.Visible == false)
            {
                MessageBox.Show("请将选项填写完整后再试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (RoomList.SelectedRows.Count != 1)
            {
                MessageBox.Show("请仅选择一行记录后再试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            roomid = RoomManger.FindRoomIDByName(RoomList.SelectedRows[0].Cells[0].Value.ToString());

            index = ChangeType.SelectedIndex;


            if (index == 2 || index == 3)
            {
                try
                {
                    a = Convert.ToInt32(ChangeValue.Text);
                }
                catch
                {
                    MessageBox.Show("输入值为非数字,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            //房间号
            //房间类型
            //床数
            //最大旅客数
            //房间状态
            //描述

            switch (index)
            {
            case 0:
                statuscode = RoomManger.ChangeRoomValue(roomid, ChangeValue.Text, "", -1, -1, "", "", 0);
                break;

            case 1:
                statuscode = RoomManger.ChangeRoomValue(roomid, "", SelectType.Text, -1, -1, "", "", 1);
                break;

            case 2:

                statuscode = RoomManger.ChangeRoomValue(roomid, "", "", a, -1, "", "", 2);
                break;

            case 3:
                statuscode = RoomManger.ChangeRoomValue(roomid, "", "", -1, a, "", "", 3);
                break;

            case 4:
                statuscode = RoomManger.ChangeRoomValue(roomid, "", "", -1, -1, SelectType.Text, "", 4);
                break;

            case 5:
                statuscode = RoomManger.ChangeRoomValue(roomid, "", "", -1, -1, "", ChangeValue.Text, 5);
                break;
            }

            if (statuscode == 1)
            {
                MessageBox.Show("修改成功!请切换至信息刷新选项卡刷新列表!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("出现异常修改失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            ChangeType.Text  = null;
            SelectType.Text  = null;
            ChangeValue.Text = "";
        }
示例#2
0
        private void BookIn_Click(object sender, EventArgs e)
        {
            int    a         = -1;
            int    days      = 1;
            string GiveFeeID = "";

            if (Cash.Text == "")
            {
                MessageBox.Show("请填写押金后再试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (CheckIdent() == false)
            {
                MessageBox.Show("退房时间不能早于入住时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (InfoList.Count == 0)
            {
                MessageBox.Show("请添加旅客信息后再试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (CustManager.IsFree(CustIDNumber.Text) == false)
            {
                MessageBox.Show("旅客当前已入住,无法登记!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            days = CaluDay();

            try
            {
                a = Convert.ToInt32(Cash.Text);
            }
            catch
            {
                MessageBox.Show("输入的押金不是数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            double finalprice = 1;
            int    CashBound  = 1;

            foreach (Infos i in InfoList)
            {
                double count = CustManager.GetDegreeDisCount(i.IDNumber);
                if (finalprice > count)
                {
                    finalprice = count;
                    GiveFeeID  = i.IDNumber;
                }
                if (CustManager.IsFreeCash(i.IDNumber) == true && CustManager.GetDegreeDisCount(i.IDNumber) <= finalprice)
                {
                    CashBound = 0;
                }
            }

            string messages = "登记信息如下\r\n" +
                              "==========================\r\n";

            for (int i = 1; i <= InfoList.Count; i++)
            {
                messages += "顾客" + i.ToString() + ":" + InfoList[i - 1].Name + "\r\n";
            }

            messages += "==========================\r\n";

            messages += "应收押金:" + (CashBound * a).ToString() + "\r\n";
            messages += "应收房费:" + (finalprice * Price * days).ToString() + "\r\n";

            messages += "==========================\r\n";

            messages += "请确认信息无误后选择“是”\r\n";

            DialogResult result = MessageBox.Show(messages, "信息确认", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == DialogResult.No)
            {
                return;
            }
            else
            {
                foreach (Infos i in InfoList)
                {
                    int      CustID   = CustManager.GetCustIDByIDNumber(i.IDNumber);
                    int      RoomID   = RoomManger.FindRoomIDByName(RoomNumber.Text);
                    DateTime begin    = Convert.ToDateTime(CheckInTime.Value);
                    DateTime end      = Convert.ToDateTime(CheckOutTime.Value);
                    int      cash     = CashBound * a;
                    int      price    = Convert.ToInt32(finalprice * Price);
                    double   recmoney = CashBound * a + finalprice * Price * days;
                    CheckInLogManager.AddNewLog(CustID, RoomID, begin, end, cash, price, recmoney, 2);
                    List <CheckInLog> loglists = CheckInLogManager.GetList(CustID);
                    CustManager.ChangeStatus(i.IDNumber, price * days, loglists[loglists.Count - 1].CheckInID);
                    CustManager.CheckInChange(i.IDNumber, loglists[loglists.Count - 1].CheckInID);
                    if (i.IDNumber == GiveFeeID)
                    {
                        CustManager.ChangeMoney(i.IDNumber, Convert.ToInt32(recmoney));
                    }
                    RoomManger.ChangeRoomValue(RoomID, "", "", -1, -1, RoomStatus.Text, "", 4);
                }

                MessageBox.Show("登记成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }