Example #1
0
        private bool CheckDataValid()
        {
            var checkInData  = _checkInCtrl.GetDateTime();
            var checkOutDate = _checkOutCtrl.GetDateTime();

            if (checkInData >= checkOutDate)
            {
                SocialGUIManager.ShowPopupDialog("入住时间超过退房时间");
                return(false);
            }

            var roomIndex = _roomCtrl.GetVal();

            if (roomIndex < SaleDataManager.Instance.Rooms.Count)
            {
                var room = SaleDataManager.Instance.Rooms[roomIndex];
                if (room.CheckDateConflict(_data, checkInData, checkOutDate))
                {
                    SocialGUIManager.ShowPopupDialogFormat("房间{0}已经被预定", room.Name);
                    return(false);
                }
            }

            var roomerName = _roomerCtrl.GetContent();

            if (string.IsNullOrEmpty(roomerName))
            {
                SocialGUIManager.ShowPopupDialog("请填写房客姓名");
                return(false);
            }

            return(true);
        }
Example #2
0
 private void DeleteBtn()
 {
     if (!UserData.Instance.CheckIdentity(EBehaviorType.DeleteRecord))
     {
         return;
     }
     SocialGUIManager.ShowPopupDialog("确定删除该订单吗?", null, new KeyValuePair <string, Action>("确定", DeleteData),
                                      new KeyValuePair <string, Action>("取消", null));
 }
Example #3
0
 private void ClearData()
 {
     if (!UserData.Instance.CheckIdentity(EBehaviorType.DeleteAllData))
     {
         return;
     }
     SocialGUIManager.ShowPopupDialog("确定要清除所有订单数据吗?", null,
                                      new KeyValuePair <string, Action>("确定", () => SaleDataManager.Instance.ClearRecordsData()),
                                      new KeyValuePair <string, Action>("取消", null));
 }
Example #4
0
        private void OKBtn()
        {
            if (_curPayTypeCount == 0)
            {
                SocialGUIManager.ShowPopupDialog("至少有一种付款方式");
                return;
            }

            SaveData();
            SocialGUIManager.Instance.CloseUI <UICtrlChangePayType>();
        }
Example #5
0
        public static bool CheckYearValid(int year)
        {
            var res = year > DateTime.MinValue.Year && year < 3000;

            if (!res)
            {
                SocialGUIManager.ShowPopupDialog("年份超出范围");
            }

            return(res);
        }
Example #6
0
        public static bool CheckMonthValid(int month)
        {
            var res = month >= 1 && month <= 12;

            if (!res)
            {
                SocialGUIManager.ShowPopupDialog("月份输入有误");
            }

            return(res);
        }
Example #7
0
        public static bool CheckDayValid(int day)
        {
            var res = day >= 1 && day <= 31;

            if (!res)
            {
                SocialGUIManager.ShowPopupDialog("日期输入有误");
            }

            return(res);
        }
Example #8
0
        public static bool CheckHourValid(int hour)
        {
            var res = hour >= 0 && hour <= 24;

            if (!res)
            {
                SocialGUIManager.ShowPopupDialog("日期输入有误");
            }

            return(res);
        }
Example #9
0
        public bool TryAdminLogin(string name, string pwd)
        {
            for (int i = 0; i < (int)EUserType.Max; i++)
            {
                if (name == Account.AdminNames[i] && pwd == Account.Passwords[i])
                {
                    _account = new Account(name, (EUserType)i);
                    return(true);
                }
            }

            SocialGUIManager.ShowPopupDialog("用户名或密码错误。");
            return(false);
        }
Example #10
0
        protected override void RefreshView(object parameter)
        {
            _data = parameter as RoomRecord;
            if (_data == null)
            {
                SocialGUIManager.Instance.CloseUI <UICtrlUpdateRecord>();
                SocialGUIManager.ShowPopupDialog("订单数据错误");
                return;
            }

            _recordId.SetContent(_data.Id.ToString());
            _roomCtrl.SetOptions(_roomNames);
            _roomCtrl.SetCurVal(_data.RoomIndex);
            _priceCtrl.SetContent(_data.Price.ToString());
            _checkInCtrl.SetDate(_data.CheckInDate);
            _checkOutCtrl.SetDate(_data.CheckOutDate);
            _roomerCtrl.SetContent(_data.RoommerName);
            _roomerNumCtrl.SetContent(_data.RoommerNum);
            _stateCtrl.SetCurVal((int)_data.State);
            RefreshPayInfo();
        }
Example #11
0
        public bool CheckIdentity(EBehaviorType behaviorType, bool remind = true)
        {
            switch (behaviorType)
            {
            case EBehaviorType.SaveRecordData:
            case EBehaviorType.CreateRecord:
                if (_account.UserType > EUserType.Guest)
                {
                    return(true);
                }
                break;

            case EBehaviorType.ChangeRoomData:
            case EBehaviorType.ChangePayType:
            case EBehaviorType.DeleteAllData:
                if (_account.UserType == EUserType.AdminLeve2)
                {
                    return(true);
                }
                break;

            case EBehaviorType.UpdateRecord:
            case EBehaviorType.DeleteRecord:
                if (_account.UserType > EUserType.AdminLeve0)
                {
                    return(true);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException("behaviorType", behaviorType, null);
            }

            if (remind)
            {
                switch (behaviorType)
                {
                case EBehaviorType.SaveRecordData:
                    SocialGUIManager.ShowPopupDialog("您没有权限修改订单数据");
                    break;

                case EBehaviorType.ChangeRoomData:
                    SocialGUIManager.ShowPopupDialog("您没有权限修改房间数据");
                    break;

                case EBehaviorType.ChangePayType:
                    SocialGUIManager.ShowPopupDialog("您没有权限修改付款类型数据");
                    break;

                case EBehaviorType.DeleteAllData:
                    SocialGUIManager.ShowPopupDialog("您没有权限修删除所有数据");
                    break;

                case EBehaviorType.CreateRecord:
                    SocialGUIManager.ShowPopupDialog("您没有权限创建订单");
                    break;

                case EBehaviorType.UpdateRecord:
                    SocialGUIManager.ShowPopupDialog("您没有权限修改订单");
                    break;

                case EBehaviorType.DeleteRecord:
                    SocialGUIManager.ShowPopupDialog("您没有权限删除订单");
                    break;

                default:
                    throw new ArgumentOutOfRangeException("behaviorType", behaviorType, null);
                }
            }

            return(false);
        }
Example #12
0
 public void ClearRecordsData()
 {
     _dataLoadHandler.ClearRecordsData();
     _dataCollectHandler.Clear();
     SocialGUIManager.ShowPopupDialog("房间订单数据已清空。");
 }