public void CreateObjectFromPurchaseOrder(PurchaseLine _PurchaseLine, Services.Packages.Purchase _PurchaseOrder, string SessionToken) { ModelSession session = PurchaseLineSecureService.CheckSessionImp(SessionToken); //if (!Services.Packages.Security.PurchaseSecureService.CheckAccessImp(_PurchaseOrder, SessionToken, "Create OrderLines")) // throw new UnauthorizedAccessException("Access Denied"); _PurchaseLine.Reload(); if (!_PurchaseLine.Exists && !Services.Packages.Security.PurchaseSecureService.CheckAccessImp(_PurchaseOrder, SessionToken, "Create OrderLines")) throw new UnauthorizedAccessException("Access Denied"); else if (_PurchaseLine.Exists && !PurchaseLineSecureService.CheckAccessImp(_PurchaseLine, SessionToken, "Update")) throw new UnauthorizedAccessException("Access Denied"); _PurchaseLine.Owner = session.User; _PurchaseLine.PurchaseOrder = _PurchaseOrder; _PurchaseLine.Create(); }
public void CreateObject(PurchaseLine _PurchaseLine, string SessionToken) { ModelSession session = PurchaseLineSecureService.CheckSessionImp(SessionToken); if (!PurchaseLineSecureService.CheckUserRightsImp(session.User.Name, "Create " + typeof(PurchaseLine).FullName)) throw new UnauthorizedAccessException("Access Denied"); _PurchaseLine.Owner = session.User; _PurchaseLine.Create(); }