示例#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);
        }
示例#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));
 }
示例#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));
 }
示例#4
0
        private void OKBtn()
        {
            if (_curPayTypeCount == 0)
            {
                SocialGUIManager.ShowPopupDialog("至少有一种付款方式");
                return;
            }

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

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

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

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

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

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

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

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

            return(res);
        }
示例#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);
        }
示例#10
0
        private void SearchByRecordId(int id)
        {
            var record = SaleDataManager.Instance.GetRoomRecord(id);

            if (record != null)
            {
                _records.Clear();
                _records.Add(record);
                RefreshView();
            }
            else
            {
                SocialGUIManager.ShowPopupDialogFormat("没有订单号为{0}的订单", id);
            }
        }
示例#11
0
        void Awake()
        {
            Instance = this;
            InitUIRoot <UIRoot>(GetType().Name, 999, (int)EUIGroupType.Max);
            UIRoot.Canvas.pixelPerfect = false;

            CanvasScaler cs = UIRoot.GetComponent <CanvasScaler>();

            cs.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            cs.referenceResolution = new Vector2(UIConstDefine.UINormalScreenWidth, UIConstDefine.UINormalScreenHeight);
            cs.screenMatchMode     = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
            cs.matchWidthOrHeight  = 0.432f;

            InitUI(GetType());
            StartCoroutine(ProcessUIAutoSetup());
        }
示例#12
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();
        }
示例#13
0
        private void SearchByName(string name)
        {
            _records.Clear();
            var records = SaleDataManager.Instance.RoomRecords;

            for (int i = records.Count - 1; i >= 0; i--)
            {
                var record = records[i];
                if (record.RoommerName == name)
                {
                    _records.Add(record);
                }
            }

            if (_records.Count == 0)
            {
                SocialGUIManager.ShowPopupDialogFormat("没有房客姓名为{0}的订单", name);
            }
            else
            {
                RefreshView();
            }
        }
示例#14
0
        private void SearchByRoomId(int id)
        {
            _records.Clear();
            var records = SaleDataManager.Instance.RoomRecords;

            for (int i = records.Count - 1; i >= 0; i--)
            {
                var record = records[i];
                if (record.RoomIndex + 1 == id)
                {
                    _records.Add(record);
                }
            }

            if (_records.Count == 0)
            {
                SocialGUIManager.ShowPopupDialogFormat("没有房间号为{0}的订单", id);
            }
            else
            {
                RefreshView();
            }
        }
示例#15
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);
        }
示例#16
0
 public void ClearRecordsData()
 {
     _dataLoadHandler.ClearRecordsData();
     _dataCollectHandler.Clear();
     SocialGUIManager.ShowPopupDialog("房间订单数据已清空。");
 }