示例#1
0
        private async void BtnDelete_OnClick(object sender, RoutedEventArgs e)
        {
            if (!(StackItem.DataContext is Line item))
            {
                return;
            }

            var massage = await BasicClass.ShowBasicMessage(this, "تنبيه", "هل ترغب في حذف الاشتراك ؟ ",
                                                            MessageDialogStyle.AffirmativeAndNegative);

            if (massage != MessageDialogResult.Affirmative)
            {
                return;
            }

            using (_line)
            {
                _line.Line.Delete(item);
                await _line.Line.SaveAsync();
            }

            StackItem.DataContext = new Customer();

            await PopulateDgv();
        }
示例#2
0
        private async void BtnDelet_OnClick(object sender, RoutedEventArgs e)
        {
            if (!(StackItems.DataContext is Customer item))
            {
                return;
            }

            var massage = await BasicClass.ShowBasicMessage(this,
                                                            "تنبيه",
                                                            "هل ترغب في حذف الاشتراك ؟ ",
                                                            MessageDialogStyle.AffirmativeAndNegative);

            if (massage != MessageDialogResult.Affirmative)
            {
                return;
            }

            using (_customerServices)
            {
                _customerServices.CustomerRepository.Delete(item);
                await _customerServices.CustomerRepository.SaveAsync();
            }

            StackItems.DataContext = new Customer();

            await PopulateDatGrid();
        }
示例#3
0
        private async void BtnLogin_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                using (_loginServices)
                {
                    var usr = await _loginServices.CheckUser(NameTextBox.Text, FloatingPasswordBox.Password);

                    if (!usr)
                    {
                        await BasicClass.ShowBasicMessage(this, "تنبيه", "الرجاء التأكد من صحة إسم المستخدم وكلمة المرور", MessageDialogStyle.Affirmative);

                        return;
                    }
                    else
                    {
                        this.Hide();
                        //App.User = usr;
                        BasicClass.OpenWindow(new MainWindow());
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);

                MessageBox.Show(exception.InnerException?.Message);
            }
        }
        private async void BtnSave_OnClick(object sender, RoutedEventArgs e)
        {
            if (!(StackItems.DataContext is Payment item))
            {
                return;
            }

            using (_paymentServices)
            {
                var checkedItem = await _paymentServices.PaymentRepository
                                  .AnyAsync(x => x.Id == item.Id);

                if (!checkedItem)
                {
                    var checkName = await _paymentServices.PaymentRepository
                                    .AnyAsync(x => x.CustomerId == item.CustomerId && x.DateOfPay == item.DateOfPay);


                    if (checkName)
                    {
                        BasicClass.Notifier.ShowError("هذا المشترك تم إضافة دفعة له بنفس التاريخ مسبقاً");
                        return;
                    }

                    var checkedSanad = await _paymentServices.CheckSanad(item.Sanad);

                    if (checkedSanad)
                    {
                        var massage = await BasicClass.ShowBasicMessage(this,
                                                                        "تنبيه",
                                                                        "رقم السند مسجل مسبقاً ... هل ترغب بالاستمرار ؟ ",
                                                                        MessageDialogStyle.AffirmativeAndNegative);

                        if (massage != MessageDialogResult.Affirmative)
                        {
                            return;
                        }
                    }

                    await _paymentServices.PaymentRepository.AddAsync(item);

                    await _paymentServices.PaymentRepository.SaveAsync();
                }
                else
                {
                    await _paymentServices.PaymentRepository.UpdateAsync(item, item.Id);

                    await _paymentServices.PaymentRepository.SaveAsync();
                }

                SystemSounds.Exclamation.Play();
                BtnNew_OnClick(sender, e);
                await PopulateDataGrid();
            }
        }