예제 #1
0
        private void SaveEdit(object obj)
        {
            if (WpfMessageBox.Show("Редактирование", "Вы действительно хотите сохранить изменения?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
            {
                _model.db.ReservationSet.Remove(Cur_Item);
                _model.db.SaveChanges();
                Cur_Item.Time      = EditDate;
                Cur_Item.TablesSet = EditSelected_Table;
                Guests guests = _model.db.GuestsSet.Where(i => i.PhoneNumber == EditPhone).FirstOrDefault();
                if (guests != null)
                {
                    _model.db.GuestsSet.Remove(guests);
                    _model.db.SaveChanges();
                }
                if (guests == null)
                {
                    guests             = new Guests();
                    guests.PhoneNumber = EditPhone;
                    guests.FullName    = EditFullName;
                    _model.db.GuestsSet.Add(guests);
                }
                guests.FullName = EditFullName;
                _model.db.GuestsSet.Add(guests);
                Cur_Item.GuestsSet = guests;

                _model.db.ReservationSet.Add(Cur_Item);
                _model.db.SaveChanges();

                ListUpdate();
                Update?.Invoke(obj, null);

                WpfMessageBox.Show("Редактирование", "Редактирование успешно сохранено!", MessageBoxButton.OK, MessageBoxImage.Information);
                Hide(obj);
            }
        }
예제 #2
0
        private void SaveNewBooking(object obj)
        {
            Guests guests = _model.db.GuestsSet.Where(i => i.PhoneNumber == AddPhone).FirstOrDefault();

            if (guests == null)
            {
                guests             = new Guests();
                guests.PhoneNumber = AddPhone;
                guests.FullName    = AddFullName;
                _model.db.GuestsSet.Add(guests);
            }
            guests.FullName = AddFullName;
            _model.db.SaveChanges();

            Reservation reservation = new Reservation();

            reservation.GuestsSet = guests;
            reservation.TablesSet = AddSelected_Table;
            reservation.Time      = AddDate;

            _model.db.ReservationSet.Add(reservation);

            _model.db.SaveChanges();

            ListUpdate();
            Update?.Invoke(obj, null);

            WpfMessageBox.Show("Добавление", "Бронь успешно добавлена!", MessageBoxButton.OK, MessageBoxImage.Information);
            Hide(obj);
        }
예제 #3
0
 private void OnNewDatabaseRequested(ObservableTreeItem item)
 {
     try
     {
         if (item != null && SelectedItem.Type == ItemTypeModel.Folder)
         {
             AddDatabaseDialog dialog = new AddDatabaseDialog();
             if (dialog.ShowDialog() ?? false)
             {
                 string databasePath = dialog.DatabaseName.EndsWith(".db") ? Path.Combine(SelectedItem.Path, dialog.DatabaseName) : Path.Combine(SelectedItem.Path, String.Concat(dialog.DatabaseName, ".db"));
                 _sqliteService.BuildDatabase(databasePath);
                 item.Items.Add(new ObservableTreeItem
                 {
                     Name = dialog.DatabaseName,
                     Path = databasePath,
                     Type = ItemTypeModel.Database
                 });
                 ItemsCollectionChanged(this, new ItemsCollectionChangedEventArgs(Items.SelectMany(i => i.Items)));
             }
         }
         else
         {
             WpfMessageBox.ShowDialog("Invalid Item Selected", "Please select a folder to add a database to.", MessageBoxButton.OK, MessageIcon.Error);
         }
     }
     catch (Exception ex)
     {
         WpfMessageBox.ShowDialog("Error Building Database", ex.Message, MessageBoxButton.OK, MessageIcon.Error);
     }
 }
예제 #4
0
        private async void Del(object obj)
        {
            TableVisible      = true;
            HelpBtnVisibility = false;
            if (MessageBoxResult.Yes == WpfMessageBox.Show("Удаление", "Вы дейстивтельно хотите удалить выбранные элементы?\nОтменить это действие будет не возможно.", MessageBoxButton.YesNo, MessageBoxImage.Warning))
            {
                HelpBtnVisibility = true;
                EditMode          = true;
                var DelList = DishesList.FindAll(i => i.IsSelected == true);
                foreach (var item in DelList)
                {
                    _model.db.DishesSet.Remove(item);
                    DishesList.Remove(item);
                }

                await _model.db.SaveChangesAsync();

                OnPropertyChanged(new PropertyChangedEventArgs("DishesList"));
                EditMode     = false;
                TableVisible = false;
                UpdateEv(obj, null);
            }
            else
            {
                HelpBtnVisibility = true;
                TableVisible      = false;
            }
        }
예제 #5
0
        private void btnSalesVoucherExport_Click(object sender, RoutedEventArgs e)
        {
            if (!DateValidated(dpFromDateXML, dpToDateXML))
            {
                var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "Please select FROM DATE grater than or equal to TO DATE", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning);

                return;
            }

            CommonMethods commonMethods = new CommonMethods();
            string        path = string.Empty, firstLine = string.Empty;

            TallyXMLView tallyXMLView = new TallyXMLView();

            List <ModeofPaymentReportModel> modeofPaymentReportModel = new List <ModeofPaymentReportModel>();

            string fileName       = LoginDetail.OutletName.Trim().ToString() + "_TallySalesVoucher_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss");
            var    saveFileDialog = new SaveFileDialog
            {
                FileName   = fileName != "" ? fileName : "gpmfca-exportedDocument",
                DefaultExt = ".XML",
                Filter     = "Common Seprated Documents (.XML)|*.XML"
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                path = saveFileDialog.FileName;

                tallyXMLView.GenerateSalesVoucher(dpFromDateXML.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDateXML.SelectedDate.Value.ToString(CommonMethods.DateFormat), path);
            }
        }
예제 #6
0
        private void LanguageClicked_Event(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;

            if (btn == null)
            {
                return;
            }

            var code = (string)btn.Tag;

            foreach (var name in _names)
            {
                Debug.WriteLineIf(code == name.LangCode, "code == name.LangCode");
                name.Enabled = !code.Equals(name.LangCode, StringComparison.CurrentCultureIgnoreCase);
            }

            WpfMessageBox.Show(LanguageLibrary.Language.Default.language_set_msg, LanguageLibrary.Language.Default.title_language_set,
                               MessageBoxButton.OK, MessageBoxImage.Information);

            Settings.Default.Set("language", code);
            Settings.Default.Save();

            Process.Start(Application.ResourceAssembly.Location);
            Application.Current.Shutdown();
        }
예제 #7
0
        private async void DelProduct(object obj)
        {
            TableVisible = true;
            if (WpfMessageBox.Show("Удаление продуктов", "Вы действительно хотите удалить продукт(ы) ?", System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
            {
                Loading.Invoke(obj, null);
                await Task.Run(() =>
                {
                    List <Product> col = ListProduct.Where(item => item.IsSelected == true).ToList();
                    _model.db.ProductSet.RemoveRange(col);
                    _model.db.SaveChanges();
                    ListProduct = _model.db.ProductSet.ToList();



                    _waitHandle.Set();
                });

                _waitHandle.WaitOne();
                _can_edit = true;
                UpdateEv?.Invoke(obj, null);
                Loading?.Invoke(obj, null);
            }
            TableVisible = false;
        }
 private void btnChangePaymentMethod_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var order = (CustomerOrderHistoryModel)dgOrderList.SelectedItem;
         if (string.IsNullOrEmpty(order.Payment) || order.Payment.Contains(","))
         {
             var messageBoxResult = WpfMessageBox.Show(StatusMessages.CustomerOrderHistory, StatusMessages.PaymentMethodModifyNotAllow, MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning);
             cmbSelectPaymentMethod.Focus();
             return;
         }
         ppChangePaymentMethod.IsOpen = true;
         CustomerOrderViewModel    customerOrderViewModel = new CustomerOrderViewModel();
         List <PaymentMethodModel> paymentMethodModels    = new List <PaymentMethodModel>();
         paymentMethodModels = customerOrderViewModel.GetPaymentMethod();
         cmbSelectPaymentMethod.ItemsSource       = paymentMethodModels;
         cmbSelectPaymentMethod.Text              = "Select Payment";
         cmbSelectPaymentMethod.IsEditable        = true;
         cmbSelectPaymentMethod.IsReadOnly        = true;
         cmbSelectPaymentMethod.SelectedValuePath = "Id";
         cmbSelectPaymentMethod.DisplayMemberPath = "PaymentMethodName";
     }
     catch (Exception ex)
     {
         SystemError.Register(ex);
     }
 }
예제 #9
0
        public DialogResult ShowDialog(Control parent)
        {
#if TODO_XAML // EnableThemingInScope was removed as it uses PInvoke
            using (var visualStyles = new EnableThemingInScope(ApplicationHandler.EnableVisualStyles))
#endif
            {
                var messageDialog = new wup.MessageDialog(Text ?? "", Caption ?? "");
                messageDialog.ShowAsync();

#if TODO_XAML
                var element = parent == null ? null : parent.GetContainerControl();
                var window  = element == null ? null : element.GetParent <sw.Window>();
                sw.MessageBoxResult result;
                var buttons       = Convert(Buttons);
                var defaultButton = Convert(DefaultButton, Buttons);
                var icon          = Convert(Type);
                var caption       = Caption ?? ((parent != null && parent.ParentWindow != null) ? parent.ParentWindow.Title : null);
                if (window != null)
                {
                    result = WpfMessageBox.Show(window, Text, caption, buttons, icon, defaultButton);
                }
                else
                {
                    result = WpfMessageBox.Show(Text, caption, buttons, icon, defaultButton);
                }
                return(Convert(result));
#else
                return(DialogResult.Ok);                // TODO: this returns immediately, but the MessageDialog appears asynchronously. Fix the Eto API to be asynchronous.
#endif
            }
        }
예제 #10
0
        public async void FillDataGrid()
        {
            if (!string.IsNullOrEmpty((string)App.Current.Properties["CharacterGuildID"]))
            {
                try
                {
                    string responseBody = await client.GetStringAsync("api/Guild/" + App.Current.Properties["CharacterGuildID"]);

                    eventList = JsonConvert.DeserializeObject <IEnumerable <Event> >(responseBody);
                } catch (TimeoutException)
                {
                    WpfMessageBox.Show("Service unavailable", "An error occurred while contacting the server please try again later.", MessageBoxButton.OK, MessageBoxImage.Error);
                } catch (WebException)
                {
                    WpfMessageBox.Show("Web service error", "An error occured contacting the web service please try again later.", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                eventGrid.ItemsSource = eventList;

                eventGrid.Items.Refresh();
                GetJoinedEventsAsync();

                eventSearchBox.IsReadOnly      = false;
                filterByEventTypeBox.IsEnabled = true;
                filterByRoleBox.IsEnabled      = true;
                eventGrid.Visibility           = Visibility.Visible;
                dataGridMessage.Visibility     = Visibility.Hidden;
            }
        }
예제 #11
0
        private async void CrateNewDish(object obj)
        {
            Dishes new_dish = new Dishes();

            new_dish.Name = AddNewName;
            new_dish.Dishes_categories   = _model.db.Dishes_categoriesSet.FirstOrDefault(i => i.Name == AddNewCat);
            new_dish.Dishes_categoriesId = _model.db.Dishes_categoriesSet.FirstOrDefault(i => i.Name == AddNewCat).Id;
            new_dish.Weight     = AddNewWeight;
            new_dish.Price      = AddNewPric;
            new_dish.IsSelected = false;



            _model.db.DishesSet.Add(new_dish);
            await _model.db.SaveChangesAsync();

            DishesList.Add(new_dish);
            OnPropertyChanged(new PropertyChangedEventArgs("DishesList"));
            Clear();
            WpfMessageBox.Show("Добавление", "Новое блюдо успешно добавлено в меню", MessageBoxType.Information);
            TableVisible      = false;
            AddVisible        = false;
            HelpBtnVisibility = true;
            UpdateEv?.Invoke(obj, null);
        }
예제 #12
0
        private void Reset(object obj)
        {
            var UserReset = _model.db.StaffSet.Where(i => i.Id == Id).FirstOrDefault();

            if (UserReset == null)
            {
                return;
            }
            if (UserReset.secret_word == SecretWord || UserReset.secret_word == hashing.HashPassword(SecretWord))
            {
                _model.db.StaffSet.Remove(UserReset);
                _model.db.SaveChanges();
                UserReset.password = hashing.HashPassword(_p1);
                _model.db.StaffSet.Add(UserReset);
                _model.db.SaveChanges();
                _p1        = string.Empty;
                _p2        = string.Empty;
                SecretWord = string.Empty;
                DelVis?.Invoke(obj, null);
                WpfMessageBox.Show("Изменение пароля", "Пароль успешно изменен.", MessageBoxType.Information);
                DelVis?.Invoke(obj, null);
                ResetVis = false;
                pwb?.ClearPassword();
            }
            else
            {
                DelVis?.Invoke(obj, null);
                WpfMessageBox.Show("Изменение пароля", "Секретное слово неправильное.", MessageBoxType.Information);
                DelVis?.Invoke(obj, null);
            }
        }
예제 #13
0
        public async void GetItems()
        {
            if (!string.IsNullOrEmpty((string)App.Current.Properties["SelectedCharacter"]))
            {
                HttpResponseMessage equipmentResponseMessage = await client.GetAsync("gw2api/characters/" + App.Current.Properties["SelectedCharacter"] + "/equipment");

                HttpResponseMessage newResponse = equipmentResponseMessage;
                newResponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                newResponse.Content.Headers.ContentEncoding.Add("gzip");
                newResponse.Content.Headers.ContentType.CharSet = "utf-8";
                string jsonEquipmentResponse = await newResponse.Content.ReadAsStringAsync();

                Equipments equipments = JsonConvert.DeserializeObject <Equipments>(jsonEquipmentResponse);

                foreach (var equipmentSlot in equipments.Equipment)
                {
                    // Getting item
                    string itemResponseBody;
                    try
                    {
                        itemResponseBody = await client.GetStringAsync("gw2api/items/" + equipmentSlot.Id);
                    } catch (Exception e)
                    {
                        WpfMessageBox.Show("Item could not be displayed", "Error, while trying to get the item with id: " + equipmentSlot.Id, MessageBoxButton.OK, MessageBoxImage.Warning);
                        continue;
                    }
                    Item item = JsonConvert.DeserializeObject <Item>(itemResponseBody);
                    items.Add(item);
                }
            }
            FillWrapPanel();
        }
예제 #14
0
        public static void Register(Exception ex)
        {
            WpfMessageBox.Show(StatusMessages.AppTitle, ex.ToString(), MessageBoxButton.OK, EnumUtility.MessageBoxImage.Error);

            logger = LogManager.GetCurrentClassLogger();
            logger.Error(ex.ToString());
        }
예제 #15
0
 private void DisplayResult(MessageBoxResult result, WpfMessageBoxProperties msgProperties)
 {
     WpfMessageBox.Show(
         this,
         "Result is: DialogResult." + result + Environment.NewLine +
         "Checkbox is " + (msgProperties.IsCheckBoxChecked ? "" : "not ") + "checked" + Environment.NewLine +
         "Textbox value is: " + msgProperties.TextBoxText);
 }
예제 #16
0
        private void CloseWindow(object parameter = null)
        {
            var checkWin = new WpfMessageBox("アプリを終了します", MessageBoxButton.YesNo);

            checkWin.ShowDialog();
            if (checkWin.Result == MessageBoxResult.Yes)
            {
                App.Current.Shutdown(0);
            }
        }
예제 #17
0
 private void OnCancel()
 {
     try
     {
         Done();
     }
     catch (Exception ex)
     {
         WpfMessageBox.ShowDialog("Data Error", ex.Message, MessageBoxButton.OK, MessageIcon.Error);
     }
 }
예제 #18
0
        private void SetDefaults()
        {
            var result = WpfMessageBox.Show(
                "Reset all preferences to their default values?".Localize(),
                "Reset All Preferences".Localize(), System.Windows.MessageBoxButton.OKCancel);

            if (result == System.Windows.MessageBoxResult.OK)
            {
                m_settingsService.SetDefaults();
            }
        }
예제 #19
0
 private void OnEditVendor(Vendor vendor)
 {
     try
     {
         EditVendor(vendor);
     }
     catch (Exception ex)
     {
         WpfMessageBox.ShowDialog("Data Error", ex.Message, MessageBoxButton.OK, MessageIcon.Error);
     }
 }
예제 #20
0
        private void ReOauth(object parameter = null)
        {
            var checkWin = new WpfMessageBox("現在のアカウント情報を削除し、新しいアカウントを認証します", MessageBoxButton.YesNo);

            checkWin.ShowDialog();
            if (checkWin.Result == MessageBoxResult.Yes)
            {
                TokenIO.ResetSetting();
                GetToken();
            }
        }
예제 #21
0
        private void PerformTableOperation(object sender, MouseButtonEventArgs e)
        {
            try
            {
                TableViewModel tableViewModel    = new TableViewModel();
                var            tableListPanel    = sender as StackPanel;
                var            txtbTableId       = tableListPanel.Children[0] as TextBlock;
                var            txtbTableName     = tableListPanel.Children[1] as TextBlock;
                var            txtbTableStatusId = tableListPanel.Children[3] as TextBlock;
                var            txtbTableOrderId  = tableListPanel.Children[6] as TextBlock;

                if ((txtbTableStatusId.Text) == EnumUtility.TableStatus.Clean.ToString())
                {
                    var messageBoxResult = WpfMessageBox.Show(StatusMessages.DineInTitle, StatusMessages.DineInTableIsClean, MessageBoxButton.YesNo, EnumUtility.MessageBoxImage.Question);
                    if (messageBoxResult.ToString() == "Yes")
                    {
                        tableViewModel.UpdateTableStatus(txtbTableId.Text, (int)EnumUtility.TableStatus.Open);
                        GetDineInTableList();
                    }
                }

                if ((txtbTableStatusId.Text) == EnumUtility.TableStatus.Open.ToString())
                {
                    DineTable.TableId = Convert.ToInt32(txtbTableId.Text);
                    ((MainWindow)this.Owner).OrderCall(Convert.ToInt32(txtbTableId.Text), (int)EnumUtility.TableStatus.Open, Convert.ToInt32(txtbTableId.Text));
                    this.Close();
                }

                if ((txtbTableStatusId.Text) == EnumUtility.TableStatus.Occupied.ToString())
                {
                    if (!string.IsNullOrEmpty(txtbTableOrderId.Text))
                    {
                        DineTable.OrderId = Convert.ToInt32(txtbTableOrderId.Text);
                        DineTable.TableId = Convert.ToInt32(txtbTableId.Text);

                        if (DineTable.OrderId == 0)
                        {
                            //Froce Update Table Status
                            tableViewModel.UpdateTableStatus(txtbTableId.Text, (int)EnumUtility.TableStatus.Clean);
                        }
                        else
                        {
                            ((MainWindow)this.Owner).OrderCall(Convert.ToInt32(txtbTableOrderId.Text), (int)EnumUtility.TableStatus.Occupied, Convert.ToInt32(txtbTableId.Text));
                        }
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                SystemError.Register(ex);
            }
        }
예제 #22
0
        private void btnModeofPaymentReportExport_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!DateValidated(dpFromDatePayment, dpToDatePayment))
                {
                    var messageBoxResult = WpfMessageBox.Show(StatusMessages.AppTitle, "Please select FROM DATE grater than or equal to TO DATE", MessageBoxButton.OK, EnumUtility.MessageBoxImage.Warning);

                    return;
                }

                CommonMethods commonMethods = new CommonMethods();
                string        path = string.Empty, firstLine = string.Empty;

                CustomerOrderViewModel customerOrderViewModel = new CustomerOrderViewModel();

                List <ModeofPaymentReportModel> modeofPaymentReportModel = new List <ModeofPaymentReportModel>();
                modeofPaymentReportModel = customerOrderViewModel.GetModOfPaymentReport(dpFromDatePayment.SelectedDate.Value.ToString(CommonMethods.DateFormat), dpToDatePayment.SelectedDate.Value.ToString(CommonMethods.DateFormat));

                string fileName       = "ModeOfPaymentReport_" + DateTime.Now.ToString("MM-dd-yyyy_HHmmss");
                var    saveFileDialog = new SaveFileDialog
                {
                    FileName   = fileName != "" ? fileName : "gpmfca-exportedDocument",
                    DefaultExt = ".xlsx",
                    Filter     = "Common Seprated Documents (.xlsx)|*.xlsx"
                };

                if (saveFileDialog.ShowDialog() == true)
                {
                    path      = saveFileDialog.FileName;
                    firstLine = LoginDetail.ClientName;

                    DataTable dtData       = new DataTable();
                    DataTable dtDataResult = new DataTable();

                    dtData = commonMethods.ConvertToDataTable(modeofPaymentReportModel);

                    //X axis column: PaymentMethodName
                    //Y axis column: BillDate
                    //Z axis column: BillAmount
                    //Null value: "-";
                    //Sum of values: true

                    dtDataResult = commonMethods.GetInversedDataTable(dtData, "PaymentMethodName", "BillDate", "BillAmount", " ", true);

                    commonMethods.WriteExcelModeOfPaymentFile(dtDataResult, path, firstLine);
                }
            }
            catch (Exception ex)
            {
                SystemError.Register(ex);
            }
        }
예제 #23
0
        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            Logger    logger = LogManager.GetCurrentClassLogger();
            Exception ex     = e.Exception as Exception;

            var st    = new StackTrace(ex, true);
            var frame = st.GetFrame(0);
            var line  = frame.GetFileLineNumber();

            logger.Error().Exception(ex).Property("line-number", line).Write(); //using NLog.Fluent, .NET 4.5

            WpfMessageBox.Show(StatusMessages.AppTitle, ex.Message, MessageBoxButton.OK, EnumUtility.MessageBoxImage.Error);
        }
예제 #24
0
        private void updateCheck_CheckComplete(string val, bool error)
        {
            // if there is no error and new version is available, display message
            if (!error && !string.IsNullOrEmpty(val))
            {
                string message = "There is a newer version of this program available." + Environment.NewLine +
                                 string.Format("Your version is {0}".Localize(), m_updateCheck.AppVersion) + "." +
                                 Environment.NewLine +
                                 string.Format("The most recent version is {0}".Localize(), m_updateCheck.ServerVersion) +
                                 "." + Environment.NewLine +
                                 Environment.NewLine +
                                 "Would you like to download the latest version?".Localize();

                var dialog = new MessageBoxDialog("Update".Localize(), message, System.Windows.MessageBoxButton.YesNo,
                                                  System.Windows.MessageBoxImage.Information);

                if (dialog.ShowDialog() == true)
                {
                    // open SourceForge page in web browser
                    try
                    {
                        var p = new Process();
                        p.StartInfo.FileName    = val;
                        p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                        p.Start();
                        p.Dispose();
                    }
                    catch (Exception e)
                    {
                        WpfMessageBox.Show(
                            "Cannot open url:".Localize() + val + ".\n" +
                            "Error".Localize() + ":" + e.Message,
                            "Error".Localize(),
                            System.Windows.MessageBoxButton.OK,
                            System.Windows.MessageBoxImage.Error);
                    }
                }
            }
            else if (m_notifyUserIfNoUpdate)
            {
                if (error)
                {
                    WpfMessageBox.Show(val, "Error".Localize(), System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning);
                }
                else
                {
                    WpfMessageBox.Show("This software is up to date.".Localize(), "Updater".Localize(),
                                       System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
                }
            }
        }
예제 #25
0
 private void Edit(object obj)
 {
     if (Editmode == true)
     {
         TableVisible = !TableVisible;
         WpfMessageBox.Show("Режим редактирования", "Вы включили режим редактирования.\nВсе изменения будут автоматически сохранены.", MessageBoxButton.OK, MessageBoxImage.Warning);
         TableVisible = !TableVisible;
         Editmode     = false;
     }
     else
     {
         Editmode = true;
     }
 }
예제 #26
0
 private async void Del(object obj)
 {
     BgVis = true;
     if (WpfMessageBox.Show("Удаление", "Вы действительно хотите удалить бронь?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
     {
         _model.db.ReservationSet.Remove(Cur_Item);
         ResList.Remove(Cur_Item);
         Cur_Item = null;
         OnPropertyChanged(new PropertyChangedEventArgs("ResList"));
         Update?.Invoke(obj, null);
         await _model.db.SaveChangesAsync();
     }
     BgVis = false;
 }
        private void OnSaveAs(Document document)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            if (dialog.ShowDialog() ?? false)
            {
                document.FilePath = dialog.Path.EndsWith(".sqe") ? dialog.Path : string.Concat(dialog.Path, ".sqe");
                if (!File.Exists(document.FilePath) || (WpfMessageBox.ShowDialog("File Exists", "Overwrite existing file?", MessageBoxButton.YesNo, MessageIcon.Warning) ?? false))
                {
                    File.WriteAllText($"{document.FilePath}", document.Text);
                    document.IsSaved = true;
                }
            }
        }
예제 #28
0
        private async void MainWindowShow(object obj)
        {
            ILogin temp_obj = obj as ILogin;

            if (temp_obj == null)
            {
                return;
            }
            LoadVisible = true;
            _waitHandle = new AutoResetEvent(false);
            await Task.Run(() =>
            {
                foreach (var item in _model.db.StaffSet)
                {
                    if (item.login == Login && (item.password == temp_obj.GetPassword() || item.password == hashing.HashPassword(temp_obj.GetPassword())))
                    {
                        Cur_session.New_session(item.Staff_PosId, item.login, item.password, item.FirstName, item.LastName, item.Staff_Pos.Position, item.phone_number);
                        _waitHandle.Set();

                        break;
                    }
                }
                _waitHandle.Set();
            });

            _waitHandle.WaitOne();
            if (Cur_session.Id == -1)
            {
                WpfMessageBox.Show("Ошибка авторизации", "Пользователь с таким логином или паролем не найден.", 0, MessageBoxImage.Warning);
                LoadVisible = false;
                return;
            }
            if (Cur_session.Id == 1)
            {
                LoadVisible = false;
                _waitHandle.Close();
                AdminWnd adminWnd = new AdminWnd();
                adminWnd.Show();
                temp_obj.Close();
            }
            if (Cur_session.Id == 3)
            {
                LoadVisible = false;
                _waitHandle.Close();
                WaiterWnd waiterWnd = new WaiterWnd();
                waiterWnd.Show();
                temp_obj.Close();
            }
        }
예제 #29
0
        private void ButtonWpfMsgBoxWithTextBox_Click(object sender, RoutedEventArgs e)
        {
            var msgProperties = new WpfMessageBoxProperties()
            {
                Button           = MessageBoxButton.OKCancel,
                IsTextBoxVisible = true,
                Text             = "Some text",
                TextBoxText      = "Pre-defined text",
                Title            = "Some title",
            };

            MessageBoxResult result = WpfMessageBox.Show(this, ref msgProperties);

            DisplayResult(result, msgProperties);
        }
예제 #30
0
        private void ButtonWpfMsgBoxLongInstruction_Click(object sender, RoutedEventArgs e)
        {
            var msgProperties = new  WpfMessageBoxProperties()
            {
                Button = MessageBoxButton.OK,
                Header = "Here we have an example of a very very very very very very very very very very very very very very very very very long instruction text.",
                Image  = MessageBoxImage.Information,
                Text   = "Some text",
                Title  = "Some title",
            };

            MessageBoxResult result = WpfMessageBox.Show(this, ref msgProperties);

            DisplayResult(result);
        }