示例#1
0
        private async void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEmpty())
            {
                return;
            }

            #region AddViolation

            try
            {
                var addViolation = new DViolation
                {
                    DViolationName = TxtName.Text.Trim() == string.Empty ? null : TxtName.Text
                };
                await Task.Run(() => addViolation.Add());
            }
            catch (Exception exception)
            {
                Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در ثبت اطلاعات\n" + exception.Message);
            }
            Window_Loaded(null, null);
            Utility.Message("پیام", "اطلاعات با موفقیت ثبت گردید", "Correct.png");

            #endregion
        }
示例#2
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                _violationData = await DViolation.GetData();
            }
            catch (Exception exception)
            {
                Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در دریافت اطلاعات\n" + exception.Message);
                Close();
                return;
            }
            _violationSearchData = _violationData;
            if (string.IsNullOrEmpty(TxtSearch.Text.Trim()) || _add)
            {
                DgdData.ItemsSource = _violationSearchData;
                TxtSearch.Text      = string.Empty;
            }
            else
            {
                TxtSearch_TextChanged(null, null);
            }
            DgdData.ItemsSource = _violationSearchData;

            BtnNew_Click(null, null);
        }
示例#3
0
        private async void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSelectDelete())
            {
                return;
            }
            var selectItem = _violationSearchData[DgdData.SelectedIndex];

            Utility.MyMessageBox("هشدار", "آیا از حذف اطمینان دارید؟ ", "Warning.png", false);
            if (!Utility.YesNo)
            {
                return;
            }
            try
            {
                var deleteViolation = new DViolation
                {
                    DId = selectItem.Id
                };
                await Task.Run(() => deleteViolation.Delete());
            }
            catch (Exception exception)
            {
                Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در حذف اطلاعات\n" + exception.Message);
                return;
            }
            Window_Loaded(null, null);
            Utility.Message("پیام", "اطلاعات با موفقیت حذف گردید", "Correct.png");
        }
示例#4
0
        private async void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSelectEdit() || !CheckEmpty())
            {
                return;
            }
            var selectItem = _violationSearchData[DgdData.SelectedIndex];

            try
            {
                var editViolation = new DViolation
                {
                    DId            = selectItem.Id,
                    DViolationName = TxtName.Text.Trim() == string.Empty ? null : TxtName.Text
                };
                await Task.Run(() => editViolation.Edit());
            }
            catch (Exception exception)
            {
                Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در ویرایش اطلاعات\n" + exception.Message);
                return;
            }
            Window_Loaded(null, null);
            Utility.Message("پیام", "اطلاعات با موفقیت ویرایش گردید", "Correct.png");
        }
示例#5
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                //_fileData = await DFile.GetData();
                _fileAllData = await DFile.GetAllData();

                _fileTypeData = await DFileType.GetData();

                _violationData = await DViolation.GetData();

                _creatPersonData = await DPerson.GetCreate();

                _creatPlaqueData = await DPlaque.GetCreate();
            }
            catch (Exception exception)
            {
                Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در دریافت اطلاعات\n" + exception.Message);
                Close();
                return;
            }
            //_fileSearchData = _fileData;
            _fileSearchAllData       = _fileAllData;
            CboFileType.ItemsSource  = _fileTypeData;
            CboViolation.ItemsSource = _violationData;
            DgdFile.ItemsSource      = _fileSearchAllData;
            BtnNew_Click(null, null);
        }
示例#6
0
        private async void BtnSelectViolation_Click(object sender, RoutedEventArgs e)
        {
            var winViolation = new WinViolation();

            winViolation.ShowDialog();
            try
            {
                _violationData = await DViolation.GetData();
            }
            catch (Exception exception)
            {
                Utility.MyMessageBox("خطا در بانک اطلاعاتی", "خطا در دریافت اطلاعات\n" + exception.Message);
                Close();
                return;
            }
            CboViolation.ItemsSource = _violationData;
        }