protected override void OnSaving() { base.OnSaving(); if (!(Session is NestedUnitOfWork) && (Session.DataLayer != null) && (Session.ObjectLayer is SimpleObjectLayer) ) { if (Session.IsNewObject(this)) { PurchaseDeliveryDocStatus ds = new PurchaseDeliveryDocStatus(Session); ds.DocStatus = DocStatus.Draft; ds.DocStatusRemarks = ""; if (!GeneralValues.IsNetCore) { ds.CreateUser = Session.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId); } else { ds.CreateUser = Session.FindObject <SystemUsers>(CriteriaOperator.Parse("UserName=?", GeneralValues.NetCoreUserName)); } ds.CreateDate = DateTime.Now; this.DocumentStatus.Add(ds); } else { } } }
//public void assignCurrDocStatus() //{ // if (DocumentStatus.Count > 0) // CurrDocStatus = DocumentStatus.OrderByDescending<PurchaseDeliveryDocStatus, DateTime?>(pp => pp.CreateDate).First<PurchaseDeliveryDocStatus>().DocStatus; //} public void AddDocStatus(DocStatus newstatus, string remarks) { PurchaseDeliveryDocStatus ds = new PurchaseDeliveryDocStatus(Session); ds.DocStatus = newstatus; ds.DocStatusRemarks = remarks; if (!GeneralValues.IsNetCore) { ds.CreateUser = Session.GetObjectByKey <SystemUsers>(SecuritySystem.CurrentUserId); } else { ds.CreateUser = Session.FindObject <SystemUsers>(CriteriaOperator.Parse("UserName=?", GeneralValues.NetCoreUserName)); } ds.CreateDate = DateTime.Now; this.DocumentStatus.Add(ds); }