private void OnAddGroup()
 {
     if (_accessUtility.HasAccess(21))
     {
         AddGroupRequested(new Group());
     }
 }
Ejemplo n.º 2
0
 private void GLDataForm_AddedNewItem(object sender, Telerik.Windows.Controls.Data.DataForm.AddedNewItemEventArgs e)
 {
     if (_accessUtility.HasAccess(3))
     {
         _viewModel.AddGL((GL)e.NewItem);
     }
 }
Ejemplo n.º 3
0
 private void OnAddCurrency()
 {
     if (_accessUtility.HasAccess(28))
     {
         AddCurrencyRequested(new Currency());
     }
 }
Ejemplo n.º 4
0
 private void OnAddFinancialYear()
 {
     if (_accessUtility.HasAccess(40))
     {
         AddFinancialYearRequested(new FinancialYear());
     }
 }
 private void OnView(TLDocumentHeader tLDocumentHeader)
 {
     if (_accessUtility.HasAccess(65))
     {
         ViewTLDocumentItemRequested(tLDocumentHeader);
     }
 }
 private void OnAddUser()
 {
     if (_accessUtility.HasAccess(17))
     {
         AddUserRequested(new User());
     }
 }
 private void OnAddAccountDocument()
 {
     if (_accessUtility.HasAccess(34))
     {
         AddAccountDocumentRequested(new AccountDocument());
     }
 }
Ejemplo n.º 8
0
 private void OnAddTypeDocument()
 {
     if (_accessUtility.HasAccess(43))
     {
         AddTypeDocumentRequested(new TypeDocument());
     }
 }
 private void OnAddBank()
 {
     if (_accessUtility.HasAccess(25))
     {
         AddBankRequested(new Bank());
     }
 }
 private void addButton_Click(object sender, RoutedEventArgs e)
 {
     NavStateFalse();
     if (_accessUtility.HasAccess(9))
     {
         //(sender as FrameworkElement).Focus();
         var addNewCommand = RadDataFormCommands.AddNew as RoutedUICommand;
         addNewCommand.Execute(null, SLDataForm);
     }
     // if (_viewModel.AddSLCommand.CanExecute(null))
     //  SLDataForm.AddNewItem();
 }
Ejemplo n.º 11
0
 //step3
 private void CurrencyButton_Click(object sender, RoutedEventArgs e)
 {
     if (_accessUtility.HasAccess(62))
     {
         _viewModel.RaiseTestRequested(TypeEnum.Litter);
     }
 }
Ejemplo n.º 12
0
        private void onSave()
        {
            if (_accessUtility.HasAccess(1))
            {
                try
                {
                    var editableSystemAccountingSettingModel = AutoMapper.Mapper.Map <EditableSystemAccountingSettingModel, SystemAccountingSettingModel>(SystemAccountingSettingModel);
                    //     if ((SystemAccountingSettingModel.GLLength != null && SystemAccountingSettingModel.GLLength != "" && SystemAccountingSettingModel.GLLength != "0") &&
                    //(SystemAccountingSettingModel.TLLength != null && SystemAccountingSettingModel.TLLength != "" && SystemAccountingSettingModel.TLLength != "0") &&
                    //(SystemAccountingSettingModel.SLLength != null && SystemAccountingSettingModel.SLLength != "" && SystemAccountingSettingModel.SLLength != "0") &&
                    //(SystemAccountingSettingModel.DLLength != null && SystemAccountingSettingModel.DLLength != "" && SystemAccountingSettingModel.DLLength != "0"))
                    //{
                    //    editableSystemAccountingSettingModel.StatusAcc = "1";
                    //}
                    //else
                    //{
                    //    editableSystemAccountingSettingModel.StatusAcc = "0";
                    //}
                    _systemAccountingSettingsService.SaveSystemAccountingSettingModel(editableSystemAccountingSettingModel);
                    // Error?.Invoke(".تغییرات انجام شد");
                    MessageBox.Show("تنظیمات حسابداری با موفقیت انجام شد..", "اطلاعات");
                }
                catch (Exception ex)
                {
                    Failed(ex);
                }

                //  MessageBox.Show("تنظیمات حسابداری با موفقیت انجام شد..","اطلاعات");
            }
        }
Ejemplo n.º 13
0
 //step3
 private void AccButton_Click(object sender, RoutedEventArgs e)
 {
     if (_accessUtility.HasAccess(67))
     {
         _viewModel.RaiseTestRequested(TypeEnum.Profits);
     }
 }
 public void onSave()
 {
     if (_accessUtility.HasAccess(2))
     {
         _companyInformationsService.SaveCompanyInformationModel(CompanyInformationModel);
     }
 }
        private async void OnAddDocumentNumbering()
        {
            if (_accessUtility.HasAccess(37))
            {
                _allAccountDocuments = await _accountDocumentsService.GetAccountDocumentsAsync();

                AccountDocuments = new ObservableCollection <AccountDocument>(_allAccountDocuments);
                if (AccountDocuments?.Any() != true)
                {
                    Error(".نوع سند ثبت نشده است");
                }
                else
                {
                    AddDocumentNumberingRequested(new DocumentNumbering());
                }
            }
        }
        private async void OnAddExchangeRate()
        {
            if (_accessUtility.HasAccess(31))
            {
                _allCurrencies = await _currenciesService.GetCurrenciesAsync();

                Currencies = new ObservableCollection <Currency>(_allCurrencies);

                if (Currencies?.Any() != true)
                {
                    Error(".ارز ثبت نشده است");
                }
                else
                {
                    AddExchangeRateRequested(new ExchangeRate());
                }
            }
        }
Ejemplo n.º 17
0
 private void RadPathButton_Click(object sender, RoutedEventArgs e)
 {
     if (_accessUtility.HasAccess(20))
     {
         permission p = new permission();
         ((DataViewModel)p.DataContext).SelectedUser = (User)((RadPathButton)sender).DataContext;
         p.Width    = 1300;
         p.Height   = 800;
         p.CanClose = true;
         p.Owner    = Window.GetWindow(this);
         p.Show();
     }
 }
        private void TLDataForm_AddedNewItem(object sender, Telerik.Windows.Controls.Data.DataForm.AddedNewItemEventArgs e)
        {
            if (_accessUtility.HasAccess(6))
            {
                var x = e.NewItem as TL;
                TLItem = ((TL)e.NewItem);
                _viewModel.AddTLCommand.Execute(null);
                //if (_viewModel.EnableSave==true)
                //{
                //x.TLCode = _viewModel.TL.TLCode;
                //x.Title = _viewModel.TL.Title;
                //x.Title2 = _viewModel.TL.Title2;
                //x.Status = _viewModel.TL.Status;
                // x.GL.GLId = _viewModel.TL.GL.GLId;

                // x.AccountTLEnum = _viewModel.TL.AccountTLEnum;
                _viewModel.AddTL((TL)e.NewItem);
            }
            //}
            //else
            //{
            //    saveButton.IsEnabled = false;
            //}
        }
Ejemplo n.º 19
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (_accessUtility.HasAccess(66))
            {
                ObservableCollection <object> tLDocHeaders = RadGridView1.SelectedItems;
                if (tLDocHeaders.Count > 0)
                {
                    Deleting();
                    if (_dialogResult == true)
                    {
                        var list = RadGridView1.SelectedItems;
                        _viewModel.DeleteTLDocumentHeader((tLDocHeaders));
                        _viewModel.LoadTLDocumentHeaders();
                        var manager = new RadDesktopAlertManager(AlertScreenPosition.TopCenter);

                        var alert = new RadDesktopAlert
                        {
                            FlowDirection = FlowDirection.RightToLeft,
                            Header        = "اطلاعات",
                            Content       = ".حذف با موفقیت انجام شد",
                            ShowDuration  = 1200,
                        };
                        manager.ShowAlert(alert);
                    }
                    else
                    {
                        var manager = new RadDesktopAlertManager(AlertScreenPosition.TopCenter);

                        var alert = new RadDesktopAlert
                        {
                            FlowDirection = FlowDirection.RightToLeft,
                            Header        = "اطلاعات",
                            Content       = "سند برای حذف وجود ندارد.",
                            ShowDuration  = 1200,
                        };
                        manager.ShowAlert(alert);
                    }
                }
            }
        }
Ejemplo n.º 20
0
        private void ContextMenuClick(object sender, RoutedEventArgs e)
        {
            //GL gl = ClickedTreeViewItem.DataContext as GL;
            //TL tl = ClickedTreeViewItem.DataContext as TL;
            var SystemAccountingSettingModel = _systemAccountingSettingsService.GetSystemAccountingSettingModel();

            int.TryParse(SystemAccountingSettingModel.GLLength, out int SystemAccountingSettingModelGLLength);

            // var SystemAccountingSettingModelGLLength = int.Parse(SystemAccountingSettingModel.GLLength);
            long   lastGLCode   = _gLsService.GetLastGLCode() + 1;
            var    lastGLLenght = (lastGLCode.ToString()).Length;
            string tag          = (e.OriginalSource as RadMenuItem).Tag as string;

            if (ClickedTreeViewItem == null)
            {
                if (lastGLLenght == SystemAccountingSettingModelGLLength)
                {
                    AddGLTreeItemWindow addGLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddGLTreeItemWindow>();
                    var treeGL = addGLTreeItemWindow0.DataContext as AddGLTreeItemWindowViewModel;
                    //   treeGL.GL = gl;
                    treeGL.SaveClicked += (g) =>
                    {
                        //addTLTreeItemWindow0.DataItem.GL = gl;
                        g.ImageUrl = "../../Resources/cian.png";
                        _vm.AddGL(g);
                        g.GLId = _vm.GetGLId(g.GLCode);
                        _vm.Items.Add(g);
                        //_vm.Save();
                        addGLTreeItemWindow0.Close();
                        // gl.TLs.Add(addTLTreeItemWindow0.DataItem);
                        //     gl.IsExpanded = true; // Ensure that the new child is visible
                        //using (var uow = new SainaDbContext())
                        //{
                        //    uow.GLs.Add(g);
                        //    uow.SaveChanges();
                        //    addGLTreeItemWindow0.Close();
                        //}
                    };
                    addGLTreeItemWindow0.Width    = 1000;
                    addGLTreeItemWindow0.Height   = 500;
                    addGLTreeItemWindow0.CanClose = true;
                    addGLTreeItemWindow0.Owner    = Window.GetWindow(this);
                    addGLTreeItemWindow0.Show();
                }
                else
                {
                    DialogParameters parameters = new DialogParameters();
                    parameters.OkButtonContent = "بستن";
                    parameters.Header          = "اخطار";
                    parameters.Content         = " شماره گذاری این حساب  به پایان رسیده است";
                    RadWindow.Alert(parameters);
                }
            }
            else if (ClickedTreeViewItem.DataContext is GL gl)
            {
                if (tag == "newGL")
                {
                    if (_accessUtility.HasAccess(70))
                    {
                        if (lastGLLenght == SystemAccountingSettingModelGLLength)
                        {
                            AddGLTreeItemWindow addGLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddGLTreeItemWindow>();
                            var treeGL = addGLTreeItemWindow0.DataContext as AddGLTreeItemWindowViewModel;
                            //   treeGL.GL = gl;
                            treeGL.SaveClicked += (g) =>
                            {
                                //addTLTreeItemWindow0.DataItem.GL = gl;
                                g.ImageUrl = "../../Resources/cian.png";
                                _vm.AddGL(g);
                                g.GLId = _vm.GetGLId(g.GLCode);
                                _vm.Items.Add(g);
                                //_vm.Save();
                                addGLTreeItemWindow0.Close();
                                // gl.TLs.Add(addTLTreeItemWindow0.DataItem);
                                gl.IsExpanded = true; // Ensure that the new child is visible
                                                      //using (var uow = new SainaDbContext())
                                                      //{
                                                      //    uow.GLs.Add(g);
                                                      //    uow.SaveChanges();
                                                      //    addGLTreeItemWindow0.Close();
                                                      //}
                            };
                            addGLTreeItemWindow0.Width    = 1000;
                            addGLTreeItemWindow0.Height   = 500;
                            addGLTreeItemWindow0.CanClose = true;
                            addGLTreeItemWindow0.Owner    = Window.GetWindow(this);
                            addGLTreeItemWindow0.Show();
                        }

                        else
                        {
                            DialogParameters parameters = new DialogParameters();
                            parameters.OkButtonContent = "بستن";
                            parameters.Header          = "اخطار";
                            parameters.Content         = " شماره گذاری این حساب  به پایان رسیده است";
                            RadWindow.Alert(parameters);
                        }
                    }
                    // break;
                }
                else if (tag == "newTL")
                {
                    if (_accessUtility.HasAccess(70))
                    {
                        AddTLTreeItemWindow addTLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddTLTreeItemWindow>();
                        var treeTL = addTLTreeItemWindow0.DataContext as AddTLTreeItemWindowViewModel;

                        treeTL.TL           = new TL();
                        treeTL.TL.GLId      = gl.GLId;
                        treeTL.TL.GL        = gl;
                        treeTL.SaveClicked += (t) =>
                        {
                            //addTLTreeItemWindow0.DataItem.GL = gl;
                            //t.GLId = gl.GLId;
                            t.ImageUrl = "../../Resources/cian.png";
                            _vm.AddTL(t);
                            t.GLId = _vm.GetTLId(t.TLCode);
                            gl.TLs.Add(t);
                            //_vm.Save();
                            addTLTreeItemWindow0.Close();
                            gl.IsExpanded = true; // Ensure that the new child is visible
                                                  //using (var uow = new SainaDbContext())
                                                  //{
                                                  //    uow.TLs.Add(t);
                                                  //    //uow.Entry(gl).State = EntityState.Modified;
                                                  //    var vv = uow.SaveChanges();
                                                  //    addTLTreeItemWindow0.Close();
                                                  //}
                        };
                        addTLTreeItemWindow0.Width    = 1000;
                        addTLTreeItemWindow0.Height   = 500;
                        addTLTreeItemWindow0.CanClose = true;
                        addTLTreeItemWindow0.Owner    = Window.GetWindow(this);
                        addTLTreeItemWindow0.Show();
                    }
                }
                else if (tag == "edit")
                {
                    if (_accessUtility.HasAccess(71))
                    {
                        AddGLTreeItemWindow addGLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddGLTreeItemWindow>();
                        var treeGL = addGLTreeItemWindow0.DataContext as AddGLTreeItemWindowViewModel;
                        treeGL.GL = gl;
                        using (var uow = new SainaDbContext())
                        {
                            var hasGL = uow.GLs.FirstOrDefault(x => x.GLId == gl.GLId)?.TLs?.Any() == true;
                            if (hasGL == true)
                            {
                                addGLTreeItemWindow0.gLCodeTextbox.IsEnabled = false;
                            }
                            treeGL.SaveClicked += (g) =>
                            {
                                //addTLTreeItemWindow0.DataItem.GL = gl;
                                g.GLId     = gl.GLId;
                                g.ImageUrl = "../../Resources/cian.png";
                                // gl.TLs.Add(addTLTreeItemWindow0.DataItem);
                                gl.IsExpanded = true; // Ensure that the new child is visible
                                                      // _vm.Save();

                                uow.GLs.Attach(g);
                                uow.Entry <GL>(g).State = EntityState.Modified;
                                //  uow.GLs(g);
                                var x = uow.SaveChanges();
                                addGLTreeItemWindow0.Close();
                            };
                        }
                        addGLTreeItemWindow0.Width    = 1000;
                        addGLTreeItemWindow0.Height   = 500;
                        addGLTreeItemWindow0.CanClose = true;
                        addGLTreeItemWindow0.Owner    = Window.GetWindow(this);
                        addGLTreeItemWindow0.Show();
                    }
                    // break;
                }
                else if (tag == "delete")
                {
                    if (_accessUtility.HasAccess(72))
                    {
                        using (var uow = new SainaDbContext())
                        {
                            var hasGL = uow.GLs.FirstOrDefault(x => x.GLId == gl.GLId)?.TLs?.Any() == true;

                            if (hasGL == false)
                            {
                                DialogParameters parameters = new DialogParameters();
                                parameters.OkButtonContent     = "بله، مطمئنم";
                                parameters.CancelButtonContent = "خیر";
                                parameters.Header  = "اخطار";
                                parameters.Content = "آیا برای حذف  مطمئن هستید؟";
                                parameters.Closed  = OnClosed;
                                RadWindow.Confirm(parameters);
                                _dialogResult = _dialogResult == true;
                                // _dialogResult == true;
                            }
                            else
                            {
                                DialogParameters parameters = new DialogParameters();
                                parameters.OkButtonContent = "بستن";
                                parameters.Header          = "اخطار";
                                parameters.Content         = ".امکان حذف وجود ندارد";
                                // parameters.Closed = OnClosed;
                                RadWindow.Alert(parameters);
                                _dialogResult = false;
                            }
                            if (_dialogResult == true)
                            {
                                //  uow.GLs.Attach(gl);
                                var test = uow.GLs.ToList().Select(x => x.GLId);
                                _vm.Items.Remove(gl);
                                uow.Database.ExecuteSqlCommand($"Delete Info.GLs where  GLId={gl.GLId} ");
                                // uow.RejectChanges();
                                // uow.GLs.Attach(new GL { GLId = gl.GLId });
                                //uow.Entry<GL>(gl).State = EntityState.Deleted;
                                //// uow.GLs.Remove(new GL { GLId=gl.GLId});
                                uow.SaveChanges();
                                var manager = new RadDesktopAlertManager(AlertScreenPosition.TopCenter, new Point(0, 0), 100);

                                var alert = new RadDesktopAlert
                                {
                                    FlowDirection = FlowDirection.RightToLeft,
                                    Header        = "اطلاعات",
                                    Content       = ".حذف با موفقیت انجام شد",
                                    ShowDuration  = 5000,
                                };
                                manager.ShowAlert(alert);
                            }
                        }
                    }
                }
            }
            else if (ClickedTreeViewItem.DataContext is TL tl)
            {
                if (tag == "newTL")
                {
                    if (_accessUtility.HasAccess(70))
                    {
                        AddTLTreeItemWindow addTLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddTLTreeItemWindow>();
                        gl = tl.GL;
                        var treeTL = addTLTreeItemWindow0.DataContext as AddTLTreeItemWindowViewModel;
                        treeTL.TL      = new TL();
                        treeTL.TL.GLId = gl.GLId;
                        treeTL.TL.GL   = gl;
                        //treeTL.SelectedGL = gl;
                        //treeTL.TL = new TL { GL = gl, GLId = gl.GLId };
                        treeTL.SaveClicked += (t) =>
                        {
                            //   t.GLId = gl.GLId;
                            t.ImageUrl = "../../Resources/cian.png";
                            _vm.AddTL(t);
                            t.GLId = _vm.GetTLId(t.TLCode);
                            gl.TLs.Add(t);
                            addTLTreeItemWindow0.Close();

                            gl.IsExpanded = true; // Ensure that the new child is visible
                                                  //using (var uow = new SainaDbContext())
                                                  //{
                                                  //    uow.TLs.Add(t);
                                                  //   // uow.Entry(gl).State = EntityState.Modified;

                            //    uow.SaveChanges();
                            //    addTLTreeItemWindow0.Close();
                            //}
                        };
                        addTLTreeItemWindow0.Width    = 1000;
                        addTLTreeItemWindow0.Height   = 500;
                        addTLTreeItemWindow0.CanClose = true;
                        addTLTreeItemWindow0.Owner    = Window.GetWindow(this);
                        addTLTreeItemWindow0.Show();
                    }
                }
                else if (tag == "newSL")
                {
                    if (_accessUtility.HasAccess(70))
                    {
                        AddSLTreeItemWindow addSLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddSLTreeItemWindow>();
                        var treeSL = addSLTreeItemWindow0.DataContext as AddSLTreeItemWindowViewModel;
                        treeSL.SL      = new SL();
                        treeSL.SL.TLId = tl.TLId;
                        treeSL.SL.TL   = tl;
                        //treeSL.SelectedTL = tl;
                        //treeSL.SL = new SL { TL = tl, TLId = tl.TLId };
                        treeSL.SaveClicked += (s) =>
                        {
                            //addTLTreeItemWindow0.DataItem.GL = gl;
                            // s.TLId = tl.TLId;
                            s.ImageUrl = "../../Resources/cian.png";
                            _vm.AddSL(s);
                            s.TLId = _vm.GetSLId(s.SLCode);

                            tl.SLs.Add(s);
                            // _vm.Save();
                            addSLTreeItemWindow0.Close();
                            tl.IsExpanded = true; // Ensure that the new child is visible
                                                  //using (var uow = new SainaDbContext())
                                                  //{
                                                  //    uow.SLs.Add(s);
                                                  //    uow.Entry(tl).State = EntityState.Modified;

                            //    uow.SaveChanges();
                            //    addSLTreeItemWindow0.Close();
                            //}
                        };
                        addSLTreeItemWindow0.Width    = 1000;
                        addSLTreeItemWindow0.Height   = 500;
                        addSLTreeItemWindow0.CanClose = true;
                        addSLTreeItemWindow0.Owner    = Window.GetWindow(this);
                        addSLTreeItemWindow0.Show();
                    }
                }
                else if (tag == "edit")
                {
                    if (_accessUtility.HasAccess(71))
                    {
                        AddTLTreeItemWindow addTLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddTLTreeItemWindow>();
                        var treeTL = addTLTreeItemWindow0.DataContext as AddTLTreeItemWindowViewModel;
                        treeTL.TL = tl;
                        using (var uow = new SainaDbContext())
                        {
                            var hasTL = uow.TLs.FirstOrDefault(x => x.TLId == tl.TLId)?.SLs?.Any() == true;
                            if (hasTL == true)
                            {
                                addTLTreeItemWindow0.tLCodeTextbox.IsEnabled = false;
                            }
                            treeTL.SaveClicked += (t) =>
                            {
                                //addTLTreeItemWindow0.DataItem.GL = gl;
                                t.TLId     = tl.TLId;
                                t.ImageUrl = "../../Resources/cian.png";
                                // gl.TLs.Add(addTLTreeItemWindow0.DataItem);
                                tl.IsExpanded = true; // Ensure that the new child is visible

                                uow.TLs.Attach(t);
                                uow.Entry <TL>(t).State = EntityState.Modified;
                                //  uow.GLs(g);
                                //  uow.GLs(g);
                                uow.SaveChanges();
                                addTLTreeItemWindow0.Close();
                            };
                        }
                        addTLTreeItemWindow0.Width    = 1000;
                        addTLTreeItemWindow0.Height   = 500;
                        addTLTreeItemWindow0.CanClose = true;
                        addTLTreeItemWindow0.Owner    = Window.GetWindow(this);
                        addTLTreeItemWindow0.Show();
                    }
                }
                else if (tag == "delete")
                {
                    if (_accessUtility.HasAccess(72))
                    {
                        using (var uow = new SainaDbContext())
                        {
                            var hasTL = uow.TLs.FirstOrDefault(x => x.TLId == tl.TLId)?.SLs?.Any() == true;

                            if (hasTL == false)
                            {
                                DialogParameters parameters = new DialogParameters();
                                parameters.OkButtonContent     = "بله، مطمئنم";
                                parameters.CancelButtonContent = "خیر";
                                parameters.Header  = "اخطار";
                                parameters.Content = "آیا برای حذف  مطمئن هستید؟";
                                parameters.Closed  = OnClosed;
                                RadWindow.Confirm(parameters);
                                _dialogResult = _dialogResult == true;
                                // _dialogResult == true;
                            }
                            else
                            {
                                DialogParameters parameters = new DialogParameters();
                                parameters.OkButtonContent = "بستن";
                                parameters.Header          = "اخطار";
                                parameters.Content         = ".امکان حذف وجود ندارد";
                                // parameters.Closed = OnClosed;
                                RadWindow.Alert(parameters);
                                _dialogResult = false;
                            }
                            if (_dialogResult == true)
                            {
                                //  uow.GLs.Attach(gl);
                                //   var test = uow.TLs.ToList().Select(x => x.TLId);
                                foreach (var item in _vm.Items)
                                {
                                    item.TLs.Remove(tl);
                                }
                                uow.Database.ExecuteSqlCommand($"Delete Info.TLs where  TLId={tl.TLId} ");
                                // uow.RejectChanges();
                                // uow.GLs.Attach(new GL { GLId = gl.GLId });
                                //uow.Entry<GL>(gl).State = EntityState.Deleted;
                                //// uow.GLs.Remove(new GL { GLId=gl.GLId});
                                uow.SaveChanges();
                                var manager = new RadDesktopAlertManager(AlertScreenPosition.TopCenter, new Point(0, 0), 100);

                                var alert = new RadDesktopAlert
                                {
                                    FlowDirection = FlowDirection.RightToLeft,
                                    Header        = "اطلاعات",
                                    Content       = ".حذف با موفقیت انجام شد",
                                    ShowDuration  = 5000,
                                };
                                manager.ShowAlert(alert);
                            }
                        }
                    }
                }
            }
            else if (ClickedTreeViewItem.DataContext is SL)
            {
                SL sl = ClickedTreeViewItem.DataContext as SL;

                if (tag == "newSL")
                {
                    if (_accessUtility.HasAccess(70))
                    {
                        AddSLTreeItemWindow addSLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddSLTreeItemWindow>();

                        tl = sl.TL;
                        var treeSL = addSLTreeItemWindow0.DataContext as AddSLTreeItemWindowViewModel;
                        treeSL.SL           = new SL();
                        treeSL.SL.TLId      = tl.TLId;
                        treeSL.SL.TL        = tl;
                        treeSL.SaveClicked += (s) =>
                        {
                            s.TLId     = tl.TLId;
                            s.ImageUrl = "../../Resources/cian.png";
                            tl.SLs.Add(s);
                            _vm.AddSL(s);
                            // _vm.Save();
                            addSLTreeItemWindow0.Close();

                            tl.IsExpanded = true;     // Ensure that the new child is visible
                                                      //using (var uow = new SainaDbContext())
                                                      //{
                                                      //    uow.SLs.Add(s);
                            ////    uow.Entry(tl).State = EntityState.Modified;

                            //    uow.SaveChanges();
                            //    addSLTreeItemWindow0.Close();
                            //}
                        };


                        addSLTreeItemWindow0.Width    = 1000;
                        addSLTreeItemWindow0.Height   = 500;
                        addSLTreeItemWindow0.CanClose = true;
                        addSLTreeItemWindow0.Owner    = Window.GetWindow(this);
                        addSLTreeItemWindow0.Show();
                    }
                }
                else if (tag == "edit")
                {
                    if (_accessUtility.HasAccess(71))
                    {
                        AddSLTreeItemWindow addSLTreeItemWindow0 = SmObjectFactory.Container.GetInstance <AddSLTreeItemWindow>();
                        var treeSL = addSLTreeItemWindow0.DataContext as AddSLTreeItemWindowViewModel;
                        treeSL.SL = sl;
                        using (var uow = new SainaDbContext())
                        {
                            var hasItem = uow.AccDocumentItems.Any(x => x.SLId == sl.SLId);
                            if (hasItem == true)
                            {
                                addSLTreeItemWindow0.sLCodeTextbox.IsEnabled = false;
                                addSLTreeItemWindow0.DL1.IsEnabled           = false;
                                addSLTreeItemWindow0.DL2.IsEnabled           = false;
                            }
                            treeSL.SaveClicked += (s) =>
                            {
                                //addTLTreeItemWindow0.DataItem.GL = gl;
                                s.SLId     = sl.SLId;
                                s.ImageUrl = "../../Resources/cian.png";
                                // gl.TLs.Add(addTLTreeItemWindow0.DataItem);
                                sl.IsExpanded = true; // Ensure that the new child is visible

                                uow.SLs.Attach(s);
                                uow.Entry <SL>(s).State = EntityState.Modified;
                                //  uow.GLs(g);
                                uow.SaveChanges();
                                addSLTreeItemWindow0.Close();
                            };
                        }
                        addSLTreeItemWindow0.Width    = 1000;
                        addSLTreeItemWindow0.Height   = 500;
                        addSLTreeItemWindow0.CanClose = true;
                        addSLTreeItemWindow0.Owner    = Window.GetWindow(this);
                        addSLTreeItemWindow0.Show();
                    }
                }
                else if (tag == "delete")
                {
                    if (_accessUtility.HasAccess(72))
                    {
                        using (var uow = new SainaDbContext())
                        {
                            var hasItem = uow.AccDocumentItems.Any(x => x.SLId == sl.SLId);


                            if (hasItem == false)
                            {
                                DialogParameters parameters = new DialogParameters();
                                parameters.OkButtonContent     = "بله، مطمئنم";
                                parameters.CancelButtonContent = "خیر";
                                parameters.Header  = "اخطار";
                                parameters.Content = "آیا برای حذف  مطمئن هستید؟";
                                parameters.Closed  = OnClosed;
                                RadWindow.Confirm(parameters);
                                _dialogResult = _dialogResult == true;
                                // _dialogResult == true;
                            }
                            else
                            {
                                DialogParameters parameters = new DialogParameters();
                                parameters.OkButtonContent = "بستن";
                                parameters.Header          = "اخطار";
                                parameters.Content         = ".امکان حذف وجود ندارد";
                                // parameters.Closed = OnClosed;
                                RadWindow.Alert(parameters);
                                _dialogResult = false;
                            }
                            if (_dialogResult == true)
                            {
                                //  uow.GLs.Attach(gl);
                                //   var test = uow.TLs.ToList().Select(x => x.TLId);
                                foreach (var item in _vm.Items)
                                {
                                    foreach (var x in item.TLs)
                                    {
                                        if (x.SLs.Remove(sl))
                                        {
                                            break;
                                        }
                                    }
                                }
                                uow.Database.ExecuteSqlCommand($"Delete Info.SLs where  SLId={sl.SLId} ");
                                // uow.RejectChanges();
                                // uow.GLs.Attach(new GL { GLId = gl.GLId });
                                //uow.Entry<GL>(gl).State = EntityState.Deleted;
                                //// uow.GLs.Remove(new GL { GLId=gl.GLId});
                                uow.SaveChanges();
                                var manager = new RadDesktopAlertManager(AlertScreenPosition.TopCenter, new Point(0, 0), 100);

                                var alert = new RadDesktopAlert
                                {
                                    FlowDirection = FlowDirection.RightToLeft,
                                    Header        = "اطلاعات",
                                    Content       = ".حذف با موفقیت انجام شد",
                                    ShowDuration  = 5000,
                                };
                                manager.ShowAlert(alert);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 21
0
        private void OnExport()
        {
            if (_accessUtility.HasAccess(61))
            {
                var errorMessage         = "";
                var getDocumentNumbering = _accDocumentHeadersService.GetDocumentNumbering();
                var dateDocument         = _appContextService.CurrentFinancialYear;
                EndNumber = getDocumentNumbering.EndNumber;
                var lastAccDocumentHeaderCode = _accDocumentHeadersService.GetLastAccDocumentHeaderCode(_appContextService.CurrentFinancialYear);
                if (lastAccDocumentHeaderCode > EndNumber)
                {
                    Error("شماره گذاری اسناد به پایان رسیده،لطفا شماره گذاری اسناد را بررسی نمایید");
                }
                else
                {
                    var             startYear       = _currencyExchangesService.GetStartFinancialYear(dateDocument);
                    PersianCalendar persianCalendar = new PersianCalendar();
                    if (DocumentDate == null)
                    {
                        Error("تاریخ تسعیر خالی می باشد");
                    }
                    else if (DocumentDate != null)
                    {
                        var DocDate = persianCalendar.GetYear(DocumentDate.Value);

                        if (DocDate != dateDocument)
                        {
                            Error("تاریخ تسعیر با سال مالی تطابق ندارد");
                        }

                        else
                        {
                            var GetEnd = GetEndExchange(dateDocument);
                            AccDocumentItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_currencyExchangesService.GetGroupedAccDocumentItems(GetEnd.Value.Date, DocumentDate.Value.Date));
                            var c = AccDocumentItems.Count;
                            //   AccDocumentItems = new ObservableCollection<AccDocumentItemGroupedDTO>(await _currencyExchangesService.GetGroupedAccDocumentItemsAsync(StartFinancialYear.Date, DocumentDate.Value.Date));
                            if (!AccDocumentItems.Any())
                            {
                                Error("سندی تا این تاریخ برای تسعیر وجود ندارد");
                            }
                            else
                            {
                                if (AccHeaderDate == null)
                                {
                                    Error("تاریخ سند خالی می باشد");
                                }

                                else if (AccHeaderDate != null)
                                {
                                    var accHeaderDate = persianCalendar.GetYear(AccHeaderDate.Value);

                                    if (accHeaderDate > dateDocument)
                                    {
                                        Error(" تاریخ سند با سال مالی تطابق ندارد");
                                    }

                                    else
                                    {
                                        if (SL == null)
                                        {
                                            errorMessage += $"لطفا معین خود را انتخاب کنید {Environment.NewLine}";

                                            // Error("معین خود را انتخاب کنید.");
                                        }
                                        else if (SL != null)
                                        {
                                            if (SL.DLType1 != 0 && DLs1 == null)
                                            {
                                                errorMessage += $"تفصیل اول نمی تواند خالی باشد {Environment.NewLine}";
                                            }
                                            if (SL.DLType2 != 0 && DLs2 == null)
                                            {
                                                errorMessage += $" تفصیل دوم نمی تواند خالی باشد {Environment.NewLine}";
                                            }
                                            if (Description1 == "" || Description1 == null)
                                            {
                                                errorMessage += $" شرح آرتیکل 1  نباید خالی باشد {Environment.NewLine}";
                                            }
                                        }
                                        if (errorMessage.Length > 0)
                                        {
                                            Error(errorMessage);
                                        }
                                        else
                                        {
                                            var getHeader = _tLDocumentsService.GetAccDocumentHeaders(GetEnd.Value.Date, DocumentDate.Value.Date);
                                            if (getHeader == true)
                                            {
                                                Information?.Invoke("در بین اسناد وضعیت پیش نویس وجود دارد");
                                            }
                                            else
                                            {
                                                IsBusy = true;

                                                AccDocumentHeader = new AccDocumentHeader();
                                                var startNumber = getDocumentNumbering.StartNumber;

                                                if (lastAccDocumentHeaderCode == 0)
                                                {
                                                    lastAccDocumentHeaderCode = startNumber;
                                                }
                                                else
                                                {
                                                    lastAccDocumentHeaderCode++;
                                                }
                                                Enabled  = false;
                                                IsEnable = false;
                                                //lastAccDocumentHeaderCode = _accDocumentHeadersService.GetLastAccDocumentHeaderCode(dateDocument);
                                                var lastDailyNumberCode             = _accDocumentHeadersService.GetLastDailyNumberCode1();
                                                var stringLastAccDocumentHeaderCode = lastAccDocumentHeaderCode.ToString();
                                                var stringlastDailyNumberCode       = lastDailyNumberCode.ToString();
                                                var lastAccDocumentHeadersCode      = stringLastAccDocumentHeaderCode;
                                                var lastDayAccDocumentHeadersCode   = stringLastAccDocumentHeaderCode;
                                                AccDocumentHeader.DailyNumber          = int.Parse($"{stringlastDailyNumberCode}");
                                                AccDocumentHeader.DocumentNumber       = int.Parse($"{lastAccDocumentHeadersCode}");
                                                AccDocumentHeader.ManualDocumentNumber = int.Parse($"{lastAccDocumentHeadersCode}");
                                                AccDocumentHeader.SystemFixNumber      = int.Parse($"{lastAccDocumentHeadersCode}");
                                                AccDocumentHeader.HeaderDescription    = "هدر سند تسعیر";
                                                AccDocumentHeader.DocumentDate         = AccHeaderDate.Value;
                                                AccDocumentHeader.Exporter             = _appContextService.CurrentUser.FriendlyName;
                                                AccDocumentHeader.SystemName           = System.Environment.MachineName;
                                                AccDocumentHeader.Status = StatusEnum.Temporary;

                                                AccDocumentHeader.TypeDocumentId = 6;
                                                AccRow = 1;
                                                string AccRowCode = AccRow.ToString();
                                                //  var editingAccDocumentHeader = Mapper.Map<EditableAccDocumentHeader, AccDocumentHeader>(AccDocumentHeader);
                                                // Mapper.Map( AccDocumentItemListViewModel.AccDocumentItems.ToList(), editingAccDocumentHeader.AccDocumentItems);
                                                if (DocumentDate == null)
                                                {
                                                    DocumentDate = _currencyExchangesService.GetEndFinancialYear1(dateDocument);
                                                }
                                                var accItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_currencyExchangesService.GetGroupedAccDocumentItems(GetEnd.Value.Date, DocumentDate.Value.Date));
                                                var accList  = AccDocumentItems.Select((xd, i) => new AccDocumentItem
                                                {
                                                    AccDocumentHeaderId = AccDocumentHeader.AccDocumentHeaderId,
                                                    CurrencyId          = xd.CurrencyId,
                                                    SLId         = (xd.SLId),
                                                    DL1Id        = (xd.DL1Id),
                                                    DL2Id        = (xd.DL2Id),
                                                    Description1 = Description1,
                                                    Description2 = Description2,
                                                    Credit       = (xd.SumDebit - xd.SumCredit) < 0 ? Math.Abs(xd.SumDebit - xd.SumCredit) : 0,
                                                    Debit        = (xd.SumDebit - xd.SumCredit) > 0 ? Math.Abs(xd.SumDebit - xd.SumCredit) : 0,
                                                    //  HasExchange= xd.HasExchange = true
                                                });
                                                using (var _uow = new Saina.Data.Context.SainaDbContext())
                                                {
                                                    foreach (var item in AccDocumentItems)
                                                    {
                                                        var cmd = $@"UPDATE Acc.AccDocumentItems SET HasExchange=1 WHERE AccDocumentItemId={item.AccDocumentItemId} ";

                                                        _uow.Database.ExecuteSqlCommand(cmd);
                                                    }
                                                }
                                                AccDocumentHeader.AccDocumentItems = new ObservableCollection <AccDocumentItem>(accList.ToList());
                                                _accDocumentHeadersService.AddAccDocumentHeader(AccDocumentHeader);
                                                // _accDocumentItemsService.AddAccDocumentItemsAsync(accList);
                                                var remainRial = accList.Sum(di => di.Debit - di.Credit);

                                                // var remainCurrencies = sumDebitCurrencies - sumCreditCurrencies;
                                                var remainCurrencies = _currencyExchangesService.GetRemainExchanges(GetEnd.Value.Date, DocumentDate.Value.Date);
                                                if (remainCurrencies == null)
                                                {
                                                    remainCurrencies = 0;
                                                }
                                                var lastCurrency = _currencyExchangesService.GetLastCurrencyDocAsync();

                                                var remain = (remainCurrencies) - remainRial;
                                                if (remain > 0)
                                                {
                                                    Debit  = Math.Abs(remain.Value);
                                                    Credit = 0;
                                                }
                                                else
                                                {
                                                    Credit = Math.Abs(remain.Value);
                                                    Debit  = 0;
                                                }
                                                if (remain != 0)
                                                {
                                                    var accItem = new AccDocumentItem {
                                                        AccDocumentHeaderId = AccDocumentHeader.AccDocumentHeaderId, SLId = (SL.SLId), DL1Id = AccDocumentItem.DL1Id, DL2Id = AccDocumentItem.DL2Id, Description1 = Description1, Description2 = Description2, Credit = Credit, Debit = Debit
                                                    };
                                                    _accDocumentItemsService.AddAccDocumentItemAsync(accItem);
                                                }


                                                EndFinancialYear = _currencyExchangesService.GetEndFinancialYear1(_appContextService.CurrentFinancialYear);
                                                GetEnd           = GetEndExchange(dateDocument);

                                                //  AccDocumentItems = new ObservableCollection<AccDocumentItemGroupedDTO>(await _currencyExchangesService.GetGroupedAccDocumentItemsAsync(GetEnd.Value.Date, EndFinancialYear.Date));
                                                AccDocumentItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_currencyExchangesService.GetGroupedAccDocumentItems(GetEnd.Value.Date, EndFinancialYear.Date));
                                                Information("سند با موفقیت ثبت شد");

                                                Enabled  = true;
                                                IsEnable = true;
                                                IsBusy   = false;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // public long lastAccDocumentHeaderCode { get; set; }
        private async void OnExport()
        {
            if (_accessUtility.HasAccess(68))
            {
                var errorMessage         = "";
                var getDocumentNumbering = await _accDocumentHeadersService.GetDocumentNumberingAsync();

                var dateDocument = _appContextService.CurrentFinancialYear;
                EndNumber = getDocumentNumbering.EndNumber;
                var lastAccDocumentHeaderCode = _accDocumentHeadersService.GetLastAccDocumentHeaderCode(_appContextService.CurrentFinancialYear);
                if (lastAccDocumentHeaderCode > EndNumber)
                {
                    Error("شماره گذاری اسناد به پایان رسیده،لطفا شماره گذاری اسناد را بررسی نمایید");
                }
                else
                {
                    if (AccDocumentItems1.Count == 0)
                    {
                        Error("سندی برای سود زیانی وجود ندارد");
                    }
                    else
                    {
                        var startYear = _currencyExchangesService.GetStartFinancialYear(dateDocument);

                        PersianCalendar persianCalendar = new PersianCalendar();
                        if (AccHeaderDate == null)
                        {
                            Error("تاریخ سند خالی می باشد");
                        }
                        else
                        {
                            var x = persianCalendar.GetYear(AccHeaderDate.Value);

                            if (x != dateDocument)
                            {
                                Error("تاریخ را درست وارد نمایید");
                            }
                            else
                            {
                                if (SL == null)
                                {
                                    errorMessage += $"لطفا معین خود را انتخاب کنید {Environment.NewLine}";

                                    // Error("معین خود را انتخاب کنید.");
                                }
                                else if (SL != null)
                                {
                                    if (SL.DLType1 != 0 && DLs1 == null)
                                    {
                                        errorMessage += $"تفصیل اول نمی تواند خالی باشد {Environment.NewLine}";
                                    }
                                    if (SL.DLType2 != 0 && DLs2 == null)
                                    {
                                        errorMessage += $" تفصیل دوم نمی تواند خالی باشد {Environment.NewLine}";
                                    }
                                    if (Description1 == "" || Description1 == null)
                                    {
                                        errorMessage += $" شرح آرتیکل 1  نباید خالی باشد {Environment.NewLine}";
                                    }
                                }
                                if (errorMessage.Length > 0)
                                {
                                    Error(errorMessage);
                                }
                                else
                                {
                                    var startNumber = getDocumentNumbering.StartNumber;

                                    if (lastAccDocumentHeaderCode == 0)
                                    {
                                        lastAccDocumentHeaderCode = startNumber;
                                    }
                                    else
                                    {
                                        lastAccDocumentHeaderCode++;
                                    }
                                    AccDocumentHeader = new AccDocumentHeader();
                                    var lastDailyNumberCode = await _accDocumentHeadersService.GetLastDailyNumberCode();

                                    var stringLastAccDocumentHeaderCode = lastAccDocumentHeaderCode.ToString();
                                    var stringlastDailyNumberCode       = lastDailyNumberCode.ToString();
                                    var lastAccDocumentHeadersCode      = stringLastAccDocumentHeaderCode;
                                    var lastDayAccDocumentHeadersCode   = stringLastAccDocumentHeaderCode;
                                    AccDocumentHeader.DailyNumber          = int.Parse($"{stringlastDailyNumberCode}");
                                    AccDocumentHeader.DocumentNumber       = int.Parse($"{lastAccDocumentHeadersCode}");
                                    AccDocumentHeader.ManualDocumentNumber = int.Parse($"{lastAccDocumentHeadersCode}");
                                    AccDocumentHeader.SystemFixNumber      = int.Parse($"{lastAccDocumentHeadersCode}");
                                    AccDocumentHeader.HeaderDescription    = "هدر سند سود و زیانی";
                                    AccDocumentHeader.Status         = StatusEnum.Temporary;
                                    AccDocumentHeader.DocumentDate   = AccHeaderDate.Value;
                                    AccDocumentHeader.Exporter       = _appContextService.CurrentUser.FriendlyName;
                                    AccDocumentHeader.SystemName     = System.Environment.MachineName;
                                    AccDocumentHeader.TypeDocumentId = 1;
                                    AccRow = 1;
                                    //  string AccRowCode = AccRow.ToString();
                                    //  var editingAccDocumentHeader = Mapper.Map<EditableAccDocumentHeader, AccDocumentHeader>(AccDocumentHeader);
                                    // Mapper.Map( AccDocumentItemListViewModel.AccDocumentItems.ToList(), editingAccDocumentHeader.AccDocumentItems);
                                    await _accDocumentHeadersService.AddAccDocumentHeaderAsync(AccDocumentHeader);

                                    if (DocumentDate == null)
                                    {
                                        DocumentDate = await _currencyExchangesService.GetEndFinancialYear(dateDocument);
                                    }
                                    var accItems = new ObservableCollection <AccDocumentItemGroupedDTO>(_closeProfitLossAccountsService.GetGroupedAccDocumentItems(_appContextService.CurrentFinancialYear));
                                    var accList  = AccDocumentItems1.Select((xd, i) => new AccDocumentItem {
                                        AccDocumentHeaderId = AccDocumentHeader.AccDocumentHeaderId, SLId = (xd.SLId), DL1Id = (xd.DL1Id), DL2Id = (xd.DL2Id), Description1 = Description1, Description2 = Description2, Credit = (xd.SumDebit - xd.SumCredit) < 0 ? Math.Abs(xd.SumDebit - xd.SumCredit) : 0, Debit = (xd.SumDebit - xd.SumCredit) > 0 ? Math.Abs(xd.SumDebit - xd.SumCredit) : 0
                                    });
                                    _accDocumentItemsService.AddAccDocumentItemsAsync(accList);
                                    var remainSum = accList.Sum(di => di.Debit - di.Credit);
                                    if (remainSum > 0)
                                    {
                                        Credit = remainSum;
                                        Debit  = 0;
                                    }
                                    else
                                    {
                                        Debit  = Math.Abs(remainSum);
                                        Credit = 0;
                                    }
                                    if (remainSum != 0)
                                    {
                                        var accItem = new AccDocumentItem {
                                            AccDocumentHeaderId = AccDocumentHeader.AccDocumentHeaderId, SLId = (SL.SLId), DL1Id = AccDocumentItem.DL1Id, DL2Id = AccDocumentItem.DL2Id, Description1 = Description1, Description2 = Description2, Credit = Credit, Debit = Debit
                                        };
                                        _accDocumentItemsService.AddAccDocumentItemAsync(accItem);
                                    }
                                    EndFinancialYear = await _currencyExchangesService.GetEndFinancialYear(dateDocument);

                                    AccDocumentItems  = new ObservableCollection <AccDocumentItemGroupedDTO>(_closeProfitLossAccountsService.GetGroupedAccDocumentItems(_appContextService.CurrentFinancialYear));
                                    AccDocumentItems1 = null;
                                    AccDocumentItems1 = new ObservableCollection <AccDocumentItemGroupedDTO>();
                                    //  AccDocumentItems1 = new ObservableCollection<AccDocumentItemGroupedDTO>(AccDocumentItems1.Except(selectedAccDocumentItems.Cast<AccDocumentItemGroupedDTO>()));

                                    Information("سند با موفقیت ثبت شد");
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 23
0
        private async void OnPermanentConvertDocument()
        {
            if (_accessUtility.HasAccess(60))
            {
                var dateDocument = _appContextService.CurrentFinancialYear;
                var username     = _appContextService.CurrentUser.FriendlyName;
                //if (StatusConvert != "")
                //{
                //    if (StatusConvert == "Date")
                //    {
                if (ToDate != null)
                {
                    var x = await _convertDocumentsService.CanUpdate(dateDocument, ToDate.Value.Date);

                    if (x == false)
                    {
                        await _convertDocumentsService.UpdateAccToDateAsync(dateDocument, StatusEnum.End, ToDate.Value.Date, StatusEnum.Permanent, username);


                        AccDocumentHeaders = new ObservableCollection <AccDocumentHeaderDTO>(await _accDocumentHeadersService.GetAccDocumentHeadersAsync(_appContextService.CurrentFinancialYear));
                        await GetLast(dateDocument);

                        // Get();
                        Information("تبدیل اسناد دائم با موفقیت انجام شد");
                    }
                    else
                    {
                        Information("در بین اسناد وضعیت پیش نویس  یا موقت وجود دارد، امکان تبدیل اسناد وجود ندارد");
                    }
                }
                else
                {
                    Error(".لطفا تاریخ  خود را وارد نمایید");
                }
            }
            //}
            //else if (StatusConvert == "Number")
            //{
            //    if (ToNumber != 0)
            //    {
            //        var x = await _convertDocumentsService.UpdateAccToNumberAsync(dateDocument, StatusEnum.End, ToNumber, StatusEnum.Permanent);
            //        AccDocumentHeaders = new ObservableCollection<AccDocumentHeaderDTO>(await _accDocumentHeadersService.GetAccDocumentHeadersAsync(_appContextService.CurrentFinancialYear));
            //        Get();

            //        Information("تبدیل اسناد دائم با موفقیت انجام شد");

            //    }
            //    else
            //    {
            //        Error(".لطفا تاریخ  خود را وارد نمایید");

            //    }
            //}
            //}
            //else
            //{
            // if (ToDate != null && ToNumber != 0)
            // {
            //     Error(".لطفا تنها تاریخ یا تنهاعدد خود را وارد نمایید");

            // }
            //else if (ToDate != null)
            // {
            //     await _convertDocumentsService.UpdateAccToDateAsync(dateDocument, StatusEnum.End, ToDate.Value.Date, StatusEnum.Permanent);
            //     AccDocumentHeaders = new ObservableCollection<AccDocumentHeaderDTO>(await _accDocumentHeadersService.GetAccDocumentHeadersAsync(_appContextService.CurrentFinancialYear));
            //     Assign("Date");
            //     Get();
            //     Information("تبدیل اسناد دائم با موفقیت انجام شد");

            // }
            // else if (ToNumber != 0)
            // {
            //     await _convertDocumentsService.UpdateAccToNumberAsync(dateDocument, StatusEnum.End, ToNumber, StatusEnum.Permanent);
            //     AccDocumentHeaders = new ObservableCollection<AccDocumentHeaderDTO>(await _accDocumentHeadersService.GetAccDocumentHeadersAsync(_appContextService.CurrentFinancialYear));
            //     Assign("Number");
            //     Get();
            //     Information("تبدیل اسناد دائم با موفقیت انجام شد");


            // }
            //    else
            //    {
            //        Error(".لطفا تاریخ یا عدد خود را وارد نمایید");

            //    }
            //}
        }