示例#1
0
        public void assignDocNum()
        {
            if (DocNumSeq > 0)
            {
                return;
            }

            CompanyDocs doc = Session.FindObject <CompanyDocs>(CriteriaOperator.Parse("Company.Oid=? and DocType.Oid=?", Company.Oid, DocType.Oid));

            DocNumSeq = doc.NextDocNo;
            DocNum    = DocNumSeq.ToString();
            doc.NextDocNo++;
        }
示例#2
0
        protected override void OnSaved()
        {
            base.OnSaved();

            if (!(Session is NestedUnitOfWork) &&
                (Session.DataLayer != null) &&
                (Session.ObjectLayer is SimpleObjectLayer)
                )
            {
                DevExpress.Xpo.Metadata.XPClassInfo myClass = Session.GetClassInfo(typeof(Companies));
                CriteriaOperator  myCriteria = CriteriaOperator.Parse("1=1");
                SortingCollection sortProps  = new SortingCollection(null);
                sortProps.Add(new SortProperty("Oid", DevExpress.Xpo.DB.SortingDirection.Ascending));

                var LDocType = Session.GetObjects(myClass, myCriteria, sortProps, 0, false, true);

                //XPCollection<DocTypes> LDocType = new XPCollection<DocTypes>();
                //LDocType.Load();

                bool added = false;
                foreach (var dtl in LDocType)
                {
                    CompanyDocs findobj = Session.FindObject <CompanyDocs>(CriteriaOperator.Parse("DocType.Oid=? and Company.Oid=?", this.Oid, ((Companies)dtl).Oid));
                    if (findobj == null)
                    {
                        added = true;
                        int cnt = 0;
                        if (((Companies)dtl).CompanyDoc != null)
                        {
                            cnt = ((Companies)dtl).CompanyDoc.Count();
                        }

                        cnt++;
                        CompanyDocs obj = new CompanyDocs(Session);
                        obj.Company   = Session.FindObject <Companies>(new BinaryOperator("Oid", ((Companies)dtl).Oid, BinaryOperatorType.Equal));
                        obj.DocType   = Session.FindObject <DocTypes>(new BinaryOperator("Oid", this.Oid, BinaryOperatorType.Equal));
                        obj.NextDocNo = (cnt * 1000000) + 1;
                    }
                }
                if (added)
                {
                    Session.CommitTransaction();
                }
            }
        }
示例#3
0
        public override void AfterConstruction()
        {
            base.AfterConstruction();
            // Place your initialization code here (https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112834.aspx).

            IsHideTax            = false;
            IsPassAccept         = false;
            IsRejectWOApp        = true;
            IsDetail             = true;
            IsItem               = true;
            IsMileage            = true;
            PostToDocument       = PostToDocuments.JE;
            ApprovalBy           = ApprovalBys.User;
            IsConcurrentAppStage = false; // IsConcurrentAppStage always false
            BoCode               = "";
            BoName               = "";

            DevExpress.Xpo.Metadata.XPClassInfo myClass = Session.GetClassInfo(typeof(DocTypes));
            CriteriaOperator  myCriteria = new BinaryOperator("IsActive", true);
            SortingCollection sortProps  = new SortingCollection(null);

            sortProps.Add(new SortProperty("BoCode", DevExpress.Xpo.DB.SortingDirection.Ascending));

            var LDocType = Session.GetObjects(myClass, myCriteria, sortProps, 0, false, true);

            //XPCollection<DocTypes> LDocType = new XPCollection<DocTypes>();
            //LDocType.Load();

            int cnt = 0;

            foreach (var dtl in LDocType)
            {
                cnt++;
                CompanyDocs obj = new CompanyDocs(Session);
                obj.DocType   = Session.FindObject <DocTypes>(new BinaryOperator("Oid", ((DocTypes)dtl).Oid, BinaryOperatorType.Equal));
                obj.NextDocNo = (cnt * 1000000) + 1;
                this.CompanyDoc.Add(obj);
            }
        }