Exemplo n.º 1
0
        public bool CheckValidation()
        {
            bool result = true;

            if (uiRoom.SelectedItem == null)
            {
                result = false;
                MessageBox.Show(ResourceHelper.GetReourceValue("CustomerDetails_RoomNotValid"), ResourceHelper.GetReourceValue("Common_ValidationError"), MessageBoxButton.OK);
            }
            if (uiDateFrom.SelectedDate.HasValue && uiDateTo.SelectedDate.HasValue && uiDateFrom.SelectedDate.Value > uiDateTo.SelectedDate.Value)
            {
                result = false;
                MessageBox.Show(ResourceHelper.GetReourceValue("Common_DateNotValid"), ResourceHelper.GetReourceValue("Common_ValidationError"), MessageBoxButton.OK);
            }

            if (result)
            {
                result = ucCustomerDetails.CheckValidation();
            }

            return(result);
        }
Exemplo n.º 2
0
 void gvwBookingService_Deleting(object sender, GridViewDeletingEventArgs e)
 {
     if (e.Items != null && e.Items.Count() > 0)
     {
         BookingRoomService deleteItem = e.Items.First() as BookingRoomService;
         if (deleteItem != null)
         {
             if (deleteItem.CanDelete)
             {
                 MessageBoxResult result = MessageBox.Show(ResourceHelper.GetReourceValue("Common_ConfirmDeleteNoParam"), ResourceHelper.GetReourceValue("Common_ConfirmationRequired"), MessageBoxButton.OKCancel);
                 if (result == MessageBoxResult.Cancel)
                 {
                     e.Cancel = true;
                 }
             }
             else
             {
                 MessageBoxResult result = MessageBox.Show(string.Format(ResourceHelper.GetReourceValue("Common_DeleteFailedBeingUsed"), deleteItem.Service),
                                                           ResourceHelper.GetReourceValue("Common_OperationFailed"), MessageBoxButton.OK);
                 e.Cancel = true;
             }
         }
     }
 }
Exemplo n.º 3
0
 private void CheckExistBookingdCompleted(bool bookingExists)
 {
     if (bookingExists)
     {
         MessageBox.Show(ResourceHelper.GetReourceValue("BookingAdmin_BookingExist"), ResourceHelper.GetReourceValue("Common_ValidationError"), MessageBoxButton.OK);
     }
     else
     {
         Booking        newBooking = ucBookingNew.GetSavedBooking();
         List <Booking> itemSource = gvwBooking.ItemsSource as List <Booking>;
         if (itemSource == null)
         {
             itemSource = new List <Booking>();
         }
         itemSource.Add(newBooking);
         gvwBooking.ItemsSource = null;
         gvwBooking.ItemsSource = itemSource;
         uiPopupNewBooking.Close();
     }
 }
Exemplo n.º 4
0
        void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (chkChangePasswordQuestionAnswer.IsChecked == true &&
                (string.IsNullOrEmpty(txtPasswordQuestion.Text) || string.IsNullOrEmpty(txtPasswordAnswer.Text)))
            {
                MessageBox.Show(ResourceHelper.GetReourceValue("UserAccount_QuestionPasswordEmpty"), ResourceHelper.GetReourceValue("Common_ValidationError"), MessageBoxButton.OK);
                return;
            }

            if (uiUsers.SelectedValue != null && (Guid)uiUsers.SelectedValue != Guid.Empty)//Means update user
            {
                Guid    userId  = (Guid)uiUsers.SelectedValue;
                AspUser aspUser = _aspUsers.FirstOrDefault(i => i.UserId == userId);
                if (aspUser != null)
                {
                    Globals.IsBusy = true;
                    aspUser        = GetSaveAspUser(aspUser);
                    DataServiceHelper.SaveAspUserAsync(aspUser, SaveAspUserCompleted);
                }
                if (chkChangePasswordQuestionAnswer.IsChecked == true &&
                    string.IsNullOrEmpty(txtInputPassword.Password))
                {
                    MessageBox.Show(ResourceHelper.GetReourceValue("UserAccount_.InputPasswordEmpty"), ResourceHelper.GetReourceValue("Common_ValidationError"), MessageBoxButton.OK);
                    return;
                }
            }
            else//means create new user
            {
                if (string.IsNullOrEmpty(uiUsers.Text) || string.IsNullOrEmpty(txtPassword.Password))
                {
                    MessageBox.Show(ResourceHelper.GetReourceValue("UserAccount_.UserPasswordEmpty"), ResourceHelper.GetReourceValue("Common_ValidationError"), MessageBoxButton.OK);
                    return;
                }
                AspUser newUser = new AspUser();
                newUser.OrganisationId = Globals.UserLogin.UserOrganisationId;
                newUser.UserName       = uiUsers.Text;
                newUser.Password       = txtPassword.Password;
                newUser = GetSaveAspUser(newUser);
                if (_currentOrgId > 0)
                {
                    newUser.OrganisationId = _currentOrgId;
                }
                if (string.IsNullOrEmpty(newUser.PasswordQuestion))
                {
                    newUser.PasswordQuestion = ResourceHelper.GetReourceValue("UserAccount_DefaultPasswordQuestion");
                }
                if (string.IsNullOrEmpty(newUser.PasswordAnswer))
                {
                    newUser.PasswordAnswer = ResourceHelper.GetReourceValue("UserAccount_DefaultPasswordAnswer");
                }
                Globals.IsBusy = true;
                DataServiceHelper.SaveAspUserAsync(newUser, CreateAspUserCompleted);
            }
        }
Exemplo n.º 5
0
        public void RebindUserAccountData()
        {
            bool exist = false;

            txtInputPassword.Password = string.Empty;
            if (uiUsers.SelectedValue != null && (Guid)uiUsers.SelectedValue != Guid.Empty)
            {
                Guid    userId  = (Guid)uiUsers.SelectedValue;
                AspUser aspUser = _aspUsers.FirstOrDefault(i => i.UserId == userId);
                if (aspUser != null)
                {
                    exist = true;
                    uiImageOnline.Visibility = chkResetPassword.Visibility = System.Windows.Visibility.Visible;
                    txtPassword.Password     = aspUser.Password;
                    txtPassword.IsEnabled    = false;
                    txtEmail.Text            = string.Empty;

                    if (!string.IsNullOrEmpty(aspUser.Email))
                    {
                        txtEmail.Text = aspUser.Email;
                    }
                    //uiEmployees.IsEnabled = false;
                    chkAccountApproved.IsChecked = aspUser.IsApproved;
                    chkResetPassword.IsChecked   = false;
                    txtResetPasswordInfo.Text    = string.Empty;
                    if (aspUser.IsLockedOut)
                    {
                        chkResetPassword.IsEnabled   = false;
                        chkAccountApproved.IsEnabled = false;
                        btnUnlock.IsEnabled          = this.IsEditable;
                        ucInformation.InfoMessage    = string.Format(ResourceHelper.GetReourceValue("UserAccount_LockedOutMessage"), aspUser.LastLockoutDate);
                    }
                    else
                    {
                        btnUnlock.IsEnabled          = false;
                        chkAccountApproved.IsEnabled = true;
                        chkResetPassword.IsEnabled   = true;
                        ucInformation.InfoMessage    = string.Format(ResourceHelper.GetReourceValue("UserAccount_CreatedInfo"), aspUser.CreationDate.ToString(), aspUser.LastActivityDate.ToString());
                    }
                    if (!string.IsNullOrEmpty(aspUser.PasswordQuestion))
                    {
                        txtPasswordQuestion.Text = aspUser.PasswordQuestion;
                    }
                    if (!string.IsNullOrEmpty(aspUser.PasswordAnswer))
                    {
                        txtPasswordAnswer.Text = aspUser.PasswordAnswer;
                    }

                    chkChangePasswordQuestionAnswer.IsChecked = false;

                    if (aspUser.IsOnline) /*This displays after adding new Admins incorrectly, as the UserID reset triggers this method, ie after saving a new siteAdmin as Org admin.*/
                    {                     /*Dont know where else it is used though, so shall leave for now*/
                        uiImageOnline.Source = new BitmapImage(new Uri(OnlineImage, UriKind.Relative));
                        nsTooltips.ToolTip tooltip = new nsTooltips.ToolTip()
                        {
                            DisplayTime  = new Duration(TimeSpan.FromSeconds(10)),
                            InitialDelay = new Duration(TimeSpan.FromMilliseconds(0)),
                            Content      = ResourceHelper.GetReourceValue("UserAccount_OnlineTooltip")
                        };
                        nsTooltips.ToolTipService.SetToolTip(uiImageOnline, tooltip);
                    }
                    else
                    {
                        uiImageOnline.Source = new BitmapImage(new Uri(OfflineImage, UriKind.Relative));
                        nsTooltips.ToolTip tooltip = new nsTooltips.ToolTip()
                        {
                            DisplayTime  = new Duration(TimeSpan.FromSeconds(10)),
                            InitialDelay = new Duration(TimeSpan.FromMilliseconds(0)),
                            Content      = ResourceHelper.GetReourceValue("UserAccount_OfflineTooltip")
                        };
                        nsTooltips.ToolTipService.SetToolTip(uiImageOnline, tooltip);
                    }
                }
            }

            if (!exist)
            {
                ResetControlStatus();
            }
        }
Exemplo n.º 6
0
        public bool CheckValidation()
        {
            bool result = true;

            if (string.IsNullOrEmpty(txtFirstName.Text) && string.IsNullOrEmpty(txtLastName.Text))
            {
                result = false;
                MessageBox.Show(ResourceHelper.GetReourceValue("CustomerDetails_RoomNotValid"), ResourceHelper.GetReourceValue("Common_ValidationError"), MessageBoxButton.OK);
            }

            return(result);
        }