Esempio n. 1
0
        public override void AfterConstruction()
        {
            base.AfterConstruction();
            // Place your initialization code here (https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112834.aspx).
            SystemUsers usr = null;

            if (!GeneralValues.IsNetCore)
            {
                usr = Session.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId);
            }
            else
            {
                usr = Session.FindObject <SystemUsers>(CriteriaOperator.Parse("UserName=?", GeneralValues.NetCoreUserName));
            }
            if (usr != null && usr.Company != null)
            {
                Company = Session.GetObjectByKey <Company>(usr.Company.Oid);
            }
            PostToDocument = PostToDocument.Document;

            DocTypeSeriesDoc doc = new DocTypeSeriesDoc(Session);

            doc.NextDocNo = 1000001;
            Prefix        = "";
            this.DetailBO.Add(doc);
        }
Esempio n. 2
0
        public void AssignDocNumber()
        {
            if (DocNum > 0)
            {
                return;
            }
            DocTypeSeriesDoc doc = Session.FindObject <DocTypeSeriesDoc>(CriteriaOperator.Parse("DocTypeSeries.Company.Oid=? and DocTypeSeries.Oid=?", Company.Oid, DocTypeSeries.Oid));

            if (doc == null)
            {
                //doc = new DocTypeSeriesDoc(Session);
                //doc.DocTypeSeries = doc.Session.GetObjectByKey<DocTypeSeries>(DocTypeSeries.Oid);
                throw new Exception("Series next number not found");
            }
            DocNum = doc.NextDocNo;
            DocNo  = doc.DocTypeSeries.Prefix == null?DocNum.ToString() : doc.DocTypeSeries.Prefix.Trim() + DocNum.ToString();

            doc.NextDocNo++;
        }