Example #1
0
        public void Open(IDocumentBase uc)
        {
            MetroTabPage pg = new MetroFramework.Controls.MetroTabPage();

            pg.StyleManager   = ERPFramework.GlobalInfo.StyleManager;
            pg.UseStyleColors = true;
            pg.AutoScroll     = false;
            pg.SizeChanged   += Pg_SizeChanged;

            pg.Text  = uc.Title;
            uc.Exit += Uc_Exit;

            MetroUserControl muc = uc as MetroUserControl;

            muc.UseStyleColors = true;
            ERPFramework.GlobalInfo.StyleManager.Clone(muc);
            pg.Controls.Add(muc);

            TabPages.Add(pg);
            int p = TabPages.Count - 1;

            SelectedTab = pg;
            muc.Size    = new Size(pg.Width, pg.Height - 5);
            pg.StyleManager.Update();
            muc.Focus();
        }
Example #2
0
        /// <summary>
        /// 增加Tab;
        /// </summary>
        /// <param name="doc"></param>
        public void AddDocument(IDocumentBase doc)
        {
            if (doc == null)
            {
                throw new ArgumentNullException(nameof(doc));
            }

            if (!(doc is DocumentBase document))
            {
                throw new InvalidOperationException($"{doc.GetType()} is not a valid type,please user ${nameof(IDocumentService.CreateNewDocument)} instead.");
            }

            if (VM.Documents.FirstOrDefault(p => p == doc) != null)
            {
                SelectedDocument = doc;
                return;
            }

            CommonEventHelper.GetEvent <DocumentAddingEvent>().Publish((doc, this));

            document.CloseRequest += Document_CloseRequest;

            VM.Documents.Add(document);

            CommonEventHelper.PublishEventToHandlers((doc, this as IDocumentService), _documentAddedEventHandlers);
            CommonEventHelper.GetEvent <DocumentAddedEvent>().Publish((doc, this));

            SelectedDocument = document;
        }
Example #3
0
 protected DataReaderUpdater(SqlProxyConnection conn, IDocumentBase documentBase)
 {
     System.Diagnostics.Debug.Assert(conn != null, "Connection is null");
     myTable = typeof(TTable).GetField("Name").GetValue(null).ToString();
     sqlCN   = documentBase != null && documentBase.Connection != null
         ? documentBase.Connection
         : conn;
     this.documentBase = documentBase;
 }
Example #4
0
 public CounterManager(int key, int Year, string description, IDocumentBase iDocumentBase)
 {
     counterKey       = key;
     this.description = description;
     trCounter        = new RRCounter(iDocumentBase);
     tuCounterValue   = new DUCounterValue(iDocumentBase);
     currentYear      = Year;
     trCounter.Find(Year, key);
     currentCode = MakeCode();
 }
Example #5
0
 public bool Init(IErrorHandler errorHandler, IEventAggregator EventAggregator, IDocumentBase DefaultDocument)
 {
     _errorHandler = errorHandler;
     ExpeditorTaskV.DataContext = this;
     Region           = ExpeditorTaskV;
     _defaultDocument = DefaultDocument;
     _visingCore.init(_errorHandler, _defaultDocument.Connect, _defaultDocument.User);
     _visirovkaReport.init(_defaultDocument.Connect, _defaultDocument.User);
     _parusAccess.Init(_defaultDocument.Connect, _defaultDocument.User.UserId,
                       _defaultDocument.User.ConnectionInform.Password,
                       _defaultDocument.User.ConnectionInform.Server);
     LoadData();
     return(true);
 }
Example #6
0
        /// <summary>
        /// 移除Tab;
        /// </summary>
        /// <param name="doc"></param>
        public void RemoveDocument(IDocumentBase doc)
        {
            if (doc == null)
            {
                throw new ArgumentNullException(nameof(doc));
            }

            if (!(doc is DocumentBase document))
            {
                throw new InvalidOperationException($"{doc.GetType()} is not a valid type,please user ${nameof(IDocumentService.CreateNewDocument)} instead.");
            }

            var cEvg = new CancelEventArgs();

            CommonEventHelper.GetEvent <DocumentClosingEvent>().Publish((doc, cEvg, this));
            if (cEvg.Cancel)
            {
                return;
            }

            VM.Documents.Remove(document);

            CommonEventHelper.PublishEventToHandlers((doc as IDocumentBase, this as IDocumentService), _documentClosedEventHandlers);
            CommonEventHelper.GetEvent <DocumentClosedEvent>().Publish((doc, this));

            document.CloseRequest -= Document_CloseRequest;

            if (VM.Documents.Count == 0)
            {
                SelectedDocument = null;
                CommonEventHelper.GetEvent <DocumentsCleared>().Publish(this);
            }

#if DEBUG
            for (int i = 0; i < 2; i++)
            {
                System.GC.Collect();
                System.GC.WaitForPendingFinalizers();
            }
#endif
        }
        /// <summary>
        /// Attach Counter
        /// </summary>
        /// <param name="key"></param>
        /// <param name="curDate"></param>
        /// <param name="transaction"></param>
        public virtual void AttachCounterType(int key, DateTime curDate, IDocumentBase documentBase)
        {
            year = curDate.Year;

            rRCounter = new RRCounter(null);
            if (!rRCounter.Find(curDate.Year, key))
            {
                MetroFramework.MetroMessageBox.Show(GlobalInfo.MainForm, Properties.Resources.Msg_MissingCounter,
                                                    Properties.Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            counterProperties = new CounterProperties();
            counterProperties.PrefixVisible   = rRCounter.GetValue <bool>(EF_Counter.HasPrefix);
            counterProperties.PrefixReadOnly  = rRCounter.GetValue <bool>(EF_Counter.PrefixRO);
            counterProperties.PrefixType      = rRCounter.GetValue <PrefixSuffixType>(EF_Counter.PrefixType);
            counterProperties.PrefixSeparator = rRCounter.GetValue <string>(EF_Counter.PrefixSep);
            counterProperties.PrefixDefault   = GetPrefixSuffixValue(counterProperties.PrefixType, year, rRCounter.GetValue <string>(EF_Counter.PrefixValue));
            counterProperties.PrefixValue     = "";
            counterProperties.PrefixLen       = counterProperties.PrefixDefault.Length;

            counterProperties.CounterLen = rRCounter.GetValue <int>(EF_Counter.CodeLen);

            counterProperties.SuffixVisible   = rRCounter.GetValue <bool>(EF_Counter.HasSuffix);
            counterProperties.SuffixReadOnly  = rRCounter.GetValue <bool>(EF_Counter.SuffixRO);
            counterProperties.SuffixType      = rRCounter.GetValue <PrefixSuffixType>(EF_Counter.SuffixType);
            counterProperties.SuffixSeparator = rRCounter.GetValue <string>(EF_Counter.SuffixSep);
            counterProperties.SuffixDefault   = GetPrefixSuffixValue(counterProperties.SuffixType, year, rRCounter.GetValue <string>(EF_Counter.SuffixValue));
            counterProperties.SuffixValue     = "";
            counterProperties.SuffixLen       = counterProperties.SuffixDefault.Length;

            counterText.SetProperties(counterProperties);

            counterUpdater = new CounterManager(key, curDate.Year, rRCounter.GetValue <string>(EF_Counter.Description), documentBase);

            ShowButton = true;
            ImageOn    = Properties.Resources.Automatic16;
            ImageOff   = Properties.Resources.Manual16;

            this.Refresh();
        }
Example #8
0
 public DUCounterValue(IDocumentBase iDocumentBase = null)
     : base(iDocumentBase)
 {
 }
Example #9
0
 protected DataReaderUpdater(IDocumentBase documentBase)
     : this(GlobalInfo.DBaseInfo.dbManager.DB_Connection, documentBase)
 {
 }
Example #10
0
 public bool Init(IErrorHandler _errorHandler, IEventAggregator EventAggregator, IBLVisirovkaCore BLVisirovkaCore, IDocumentBase DocumentBase, UDOSight Claim)
 {
     _mainEventAggregator       = EventAggregator;
     _visingCore                = BLVisirovkaCore;
     _claimHistoryV.DataContext = this;
     Region = _claimHistoryV;
     ExecuteLoadHistoryCommand(Claim);
     return(true);
 }
Example #11
0
 public RRReadAllPreference(IDocumentBase iDocumentBase = null)
     : base(iDocumentBase)
 {
 }
Example #12
0
 public DRFindPreference(IDocumentBase iDocumentBase = null)
     : base(iDocumentBase)
 {
 }
Example #13
0
 public RRCounter(IDocumentBase iDocumentBase = null)
     : base(iDocumentBase)
 {
 }
Example #14
0
 public DUCodes(IDocumentBase iDocumentBase = null)
     : base(iDocumentBase)
 {
 }
Example #15
0
        public bool Init(IErrorHandler errorHandler, IEventAggregator EventAggregator, IDocumentBase DefaultDocument, IBootStrapper Comp,
                         IBLVisirovkaCore BLVisirovkaCore, UDOSight Sight)
        {
            _errorHandler        = errorHandler;
            _mainEventAggregator = EventAggregator;
            _сomp            = Comp;
            _defaultDocument = DefaultDocument;
            _visingCore      = BLVisirovkaCore;

            _sight = Sight;



            HtmlBody = _sight.WANTDATECREATE;
            _editClaimV.DataContext = this;
            Region = _editClaimV;

            //Устанавливаем ссылки на открытие окна браузера в подтрабности
            SetNavigateStringDemand();

            _claimVM.Init(_errorHandler, _eventAggregator, _visingCore, _defaultDocument, _sight);



            ClaimVRegion = _claimVM.Region;

            _remainMaterialsVM.Init(_errorHandler, _eventAggregator, _visingCore, _сomp, _defaultDocument, _sight);
            RemainMaterialVRegion = _remainMaterialsVM.Region;

            _invoiceForTransmissionInUnitVM.Init(_errorHandler, _eventAggregator, _defaultDocument, false);
            InvoiceForTransmissionInUnitVRegion = _invoiceForTransmissionInUnitVM.Region;


            _departmentOredersVM.Init(_errorHandler, _eventAggregator, _defaultDocument, _сomp);
            DepartmentOredersVRegion = _departmentOredersVM.Region;
            _claimHistoryVM.Init(_errorHandler, _eventAggregator, _visingCore, _defaultDocument, _sight);
            RevisionHistoryClaimVRegion = _claimHistoryVM.Region;

            _claimVM.Unloaded += _claimVM_Unloaded;

            if (_sight.RN != 0)
            {
                //посылаем сообщение загрузить расходные накладные на оипуск в подразделение
                _eventAggregator.GetEvent <SavingNewInvoiceForTransmissionInUnitEvent>().Publish(new RelationshipBetweenDocuments {
                    INDOCUMENT = _sight.DepartmentOrder.RN, INUNITCODE = "DepartmentsOrders"
                });
                //посылаем сообщение загрузить заявки по номенклатурному номеру
                var x = (Sight.DepartmentOrder != null ? (((DepartmentOrderSpecifacation)Sight.DepartmentOrder.DepartmentOrderSpecifacation[0]).NomenclatureNumber.NOMENCODE ?? "") : "");
                _eventAggregator.GetEvent <FindUDOSightEvent>().Publish(new FUDOSight {
                    DepartmentOrder = new FDepartmentOrder {
                        ORDSTATE = ParusModel.DepartmentOrder.DepartmentOrderState.All, DepartmentOrderSpecifacations = new FDepartmentOrderSpecifacation {
                            NomenclatureNumber = new FNomenclatureNumber {
                                NOMENCODE = x
                            }
                        }
                    }, AgnlistTOV = new FAgnlist {
                        RN = new List <long>()
                    }, STATE = new List <UDOSightSTATE>(), RN = new List <long?>()
                });
            }
            //подписываемся на сообщение о взятие материала что бы загрузить потребность
            _eventAggregator.GetEvent <TakeMaterialEvent>().Subscribe(message => { TakeMaterials((RemainMaterial)message.Material); });
            return(true);
        }
Example #16
0
 private void OnSelectedTabChanged(object sender, IDocumentBase e)
 {
     CommonEventHelper.GetEvent <SelectedDocumentChangedEvent>().Publish((e, this));
 }
Example #17
0
        public bool Init(IErrorHandler _errorHandler, IEventAggregator EventAggregator, IBLVisirovkaCore BLVisirovkaCore, IDocumentBase DocumentBase, UDOSight e)
        {
            _visingCore           = BLVisirovkaCore;
            _mainEventAggregator  = EventAggregator;
            ClaimView.DataContext = this;
            Claim = e;
            UserRightsVisirovka.Init(DocumentBase.User);

            Region = ClaimView;

            //Подписываемся на сообщение о взятии материалла
            _mainEventAggregator.GetEvent <TakeMaterialEvent>()
            .Subscribe(
                message => { ExecuteTakeMaterialToClaimCommand((RemainMaterial)message.Material); });

            loadData();

            Claim.PropertyChanged += Claim_PropertyChanged;

            return(true);
        }
Example #18
0
 public DRUsers(IDocumentBase iDocumentBase = null)
     : base(iDocumentBase)
 {
 }
Example #19
0
 public DRVersion(IDocumentBase iDocumentBase = null)
     : base(iDocumentBase)
 {
 }
 public void AttachCounterType(int key, DateTime curDate, IDocumentBase documentBase)
 {
     CounterType = key;
 }