C# Class Purchasing.Mvc.Services.OrderService

Inheritance: IOrderService
Afficher le fichier Open project: ucdavis/Purchasing

Méthodes publiques

Méthode Description
Approve ( Order order ) : bool

Modifies an order's approvals according to the permissions of the given userId

Cancel ( Order order, string comment ) : void

The original creator of an order can cancel that order at any time

Complete ( Order order, OrderType newOrderType, string kfsDocType = null ) : string[]

Complete the last approval for an order, and return any errors that result

CreateApprovalsForNewOrder ( Order order, int conditionalApprovalIds = null, string accountId = null, string approverId = null, string accountManagerId = null ) : void

Will add the proper approval levels to an order. If a workgroup account or approver/acctManager is passed in, a split is not possible

Deny ( Order order, string comment ) : void

The order is denied by an actor. This requires a comment

Duplicate ( Order order ) : Order

Duplicates the given order info a new order, one that doesn't include the splits, approvals, or history of the given order

//TODO: should a duplicate order retain the same splits? //TODO: should approvals/create events be called automatically?

EditExistingOrder ( Order order ) : void

Handle editing an existing order without any rerouting

GetAccountsPayableIndexedListofOrders ( string received, string paid, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IndexedList
GetAdministrativeIndexedListofOrders ( string received, string paid, bool isComplete = false, bool showPending = false, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IndexedList
GetAdministrativeListofOrders ( bool isComplete = false, bool showPending = false, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IQueryable
GetCurrentOrderStatus ( Order order ) : OrderStatusCode

//get the lowest status code that still needs to be approved

GetCurrentOrderStatus ( int orderId ) : OrderStatusCode

Returns the current approval level that needs to be completed, or null if there are no approval steps pending

TODO: I think we can get rid of this and just query order.StatusCode as long as it is up to date

GetCurrentRequiredApprovals ( int orderId ) : IEnumerable

Returns all of the approvals that need to be completed for the current approval status level

GetIndexedListofOrders ( string received, string paid, bool isComplete = false, bool showPending = false, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), bool showCreated = false, System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IndexedList
GetListofOrders ( bool isComplete = false, bool showPending = false, string orderStatusCode = null, DateTime startDate = newDateTime?(), DateTime endDate = newDateTime?(), bool showCreated = false, DateTime startLastActionDate = newDateTime?(), DateTime endLastActionDate = newDateTime?() ) : IQueryable
HandleSavedForm ( Order order, Guid formSaveId ) : void

Looks for existing saved forms and associates them with the current order

OrderService ( IRepositoryFactory repositoryFactory, IEventService eventService, IUserIdentity userIdentity, ISecurityService securityService, IRepository workgroupPermissionRepository, IRepository approvalRepository, IRepository orderTrackingRepository, string>.IRepositoryWithTypedId organizationRepository, IRepository orderRepository, IQueryRepositoryFactory queryRepositoryFactory, IAccessQueryService accessQueryService, IFinancialSystemService financialSystemService, IIndexService indexService ) : System
ReRouteApprovalsForExistingOrder ( Order order, string approverId = null, string accountManagerId = null ) : void

Recreates approvals for the given order, removing all approvals at or above the current order level Should not affect conditional approvals?

ReRouteSingleApprovalForExistingOrder ( Approval approval, User user, bool notify = false ) : void
TraverseOrgs ( Organization organization, int maxLevel ) : List

Traverse down (recursively) the organization and gather all the workgroups

WillOrderBeSentToKfs ( OrderType newOrderType, string kfsDocType = null ) : bool

Private Methods

Méthode Description
AddApprovalSteps ( Order order, ApprovalInfo approvalInfo, Split split, int minLevel ) : void

Add in approval steps to either the order or split, depending on what is provided

AutoApprovable ( Order order, Split split, User approver ) : bool

Calculate the automatic approvals-- if any apply mark that approval level as complete

GetActiveOrders ( User user, List workgroups ) : List

Gets all orders for which the user has already acted on, but are not yet complete.

GetCompletedOrders ( User user, List workgroups ) : List

Gets the archive of all orders the user is in the tracking chain for including complete

GetManager ( string accountManagerId ) : User

Gets the manager given by account id, unless we want any manager which just returns null (goes to workgroup)

GetOrdersByDate ( IQueryable orders, DateTime startDate = newDateTime?(), DateTime endDate = newDateTime?(), DateTime startLastActionDate = newDateTime?(), DateTime endLastActionDate = newDateTime?() ) : IQueryable

Adds where clause to linq query to filter by date

GetOrdersByStatus ( IQueryable orders, bool isComplete = false, string orderStatusCode = null, string received = null, string paid = null ) : IQueryable

Adds where clause to linq query to filter orders by status

GetPendingOrders ( User user, List workgroups ) : List

Get the list of "pending" orders

List of orders pending at the user's status as well as one's they have requested

Method Details

Approve() public méthode

Modifies an order's approvals according to the permissions of the given userId
public Approve ( Order order ) : bool
order Order The order
Résultat bool

Cancel() public méthode

The original creator of an order can cancel that order at any time
public Cancel ( Order order, string comment ) : void
order Order
comment string
Résultat void

Complete() public méthode

Complete the last approval for an order, and return any errors that result
public Complete ( Order order, OrderType newOrderType, string kfsDocType = null ) : string[]
order Order
newOrderType OrderType
kfsDocType string
Résultat string[]

CreateApprovalsForNewOrder() public méthode

Will add the proper approval levels to an order. If a workgroup account or approver/acctManager is passed in, a split is not possible
public CreateApprovalsForNewOrder ( Order order, int conditionalApprovalIds = null, string accountId = null, string approverId = null, string accountManagerId = null ) : void
order Order The order. If it does not contain splits, you must pass along either workgroupAccount or acctManager
conditionalApprovalIds int The Ids of required conditional approvals for this order (the ones answered "yes")
accountId string Optional id of an account to use for routing
approverId string Optional approver userID
accountManagerId string AccountManager userID, required if account is not supplied
Résultat void

Deny() public méthode

The order is denied by an actor. This requires a comment
public Deny ( Order order, string comment ) : void
order Order
comment string
Résultat void

Duplicate() public méthode

Duplicates the given order info a new order, one that doesn't include the splits, approvals, or history of the given order
//TODO: should a duplicate order retain the same splits? //TODO: should approvals/create events be called automatically?
public Duplicate ( Order order ) : Order
order Order
Résultat Order

EditExistingOrder() public méthode

Handle editing an existing order without any rerouting
public EditExistingOrder ( Order order ) : void
order Order
Résultat void

GetAccountsPayableIndexedListofOrders() public méthode

public GetAccountsPayableIndexedListofOrders ( string received, string paid, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IndexedList
received string
paid string
orderStatusCode string
startDate System.DateTime
endDate System.DateTime
startLastActionDate System.DateTime
endLastActionDate System.DateTime
Résultat IndexedList

GetAdministrativeIndexedListofOrders() public méthode

public GetAdministrativeIndexedListofOrders ( string received, string paid, bool isComplete = false, bool showPending = false, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IndexedList
received string
paid string
isComplete bool
showPending bool
orderStatusCode string
startDate System.DateTime
endDate System.DateTime
startLastActionDate System.DateTime
endLastActionDate System.DateTime
Résultat IndexedList

GetAdministrativeListofOrders() public méthode

public GetAdministrativeListofOrders ( bool isComplete = false, bool showPending = false, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IQueryable
isComplete bool
showPending bool
orderStatusCode string
startDate System.DateTime
endDate System.DateTime
startLastActionDate System.DateTime
endLastActionDate System.DateTime
Résultat IQueryable

GetCurrentOrderStatus() public méthode

//get the lowest status code that still needs to be approved
public GetCurrentOrderStatus ( Order order ) : OrderStatusCode
order Order
Résultat OrderStatusCode

GetCurrentOrderStatus() public méthode

Returns the current approval level that needs to be completed, or null if there are no approval steps pending
TODO: I think we can get rid of this and just query order.StatusCode as long as it is up to date
public GetCurrentOrderStatus ( int orderId ) : OrderStatusCode
orderId int Id of the order
Résultat OrderStatusCode

GetCurrentRequiredApprovals() public méthode

Returns all of the approvals that need to be completed for the current approval status level
public GetCurrentRequiredApprovals ( int orderId ) : IEnumerable
orderId int Id of the order
Résultat IEnumerable

GetIndexedListofOrders() public méthode

public GetIndexedListofOrders ( string received, string paid, bool isComplete = false, bool showPending = false, string orderStatusCode = null, System.DateTime startDate = newDateTime?(), System.DateTime endDate = newDateTime?(), bool showCreated = false, System.DateTime startLastActionDate = newDateTime?(), System.DateTime endLastActionDate = newDateTime?() ) : IndexedList
received string
paid string
isComplete bool
showPending bool
orderStatusCode string
startDate System.DateTime
endDate System.DateTime
showCreated bool
startLastActionDate System.DateTime
endLastActionDate System.DateTime
Résultat IndexedList

GetListofOrders() public méthode

public GetListofOrders ( bool isComplete = false, bool showPending = false, string orderStatusCode = null, DateTime startDate = newDateTime?(), DateTime endDate = newDateTime?(), bool showCreated = false, DateTime startLastActionDate = newDateTime?(), DateTime endLastActionDate = newDateTime?() ) : IQueryable
isComplete bool
showPending bool
orderStatusCode string
startDate DateTime
endDate DateTime
showCreated bool
startLastActionDate DateTime
endLastActionDate DateTime
Résultat IQueryable

HandleSavedForm() public méthode

Looks for existing saved forms and associates them with the current order
public HandleSavedForm ( Order order, Guid formSaveId ) : void
order Order
formSaveId Guid
Résultat void

OrderService() public méthode

public OrderService ( IRepositoryFactory repositoryFactory, IEventService eventService, IUserIdentity userIdentity, ISecurityService securityService, IRepository workgroupPermissionRepository, IRepository approvalRepository, IRepository orderTrackingRepository, string>.IRepositoryWithTypedId organizationRepository, IRepository orderRepository, IQueryRepositoryFactory queryRepositoryFactory, IAccessQueryService accessQueryService, IFinancialSystemService financialSystemService, IIndexService indexService ) : System
repositoryFactory IRepositoryFactory
eventService IEventService
userIdentity IUserIdentity
securityService ISecurityService
workgroupPermissionRepository IRepository
approvalRepository IRepository
orderTrackingRepository IRepository
organizationRepository string>.IRepositoryWithTypedId
orderRepository IRepository
queryRepositoryFactory IQueryRepositoryFactory
accessQueryService IAccessQueryService
financialSystemService IFinancialSystemService
indexService IIndexService
Résultat System

ReRouteApprovalsForExistingOrder() public méthode

Recreates approvals for the given order, removing all approvals at or above the current order level Should not affect conditional approvals?
public ReRouteApprovalsForExistingOrder ( Order order, string approverId = null, string accountManagerId = null ) : void
order Order
approverId string
accountManagerId string
Résultat void

ReRouteSingleApprovalForExistingOrder() public méthode

public ReRouteSingleApprovalForExistingOrder ( Approval approval, User user, bool notify = false ) : void
approval Approval
user User
notify bool
Résultat void

TraverseOrgs() public méthode

Traverse down (recursively) the organization and gather all the workgroups
public TraverseOrgs ( Organization organization, int maxLevel ) : List
organization Organization
maxLevel int Loop breaker. Max depth of 99
Résultat List

WillOrderBeSentToKfs() public méthode

public WillOrderBeSentToKfs ( OrderType newOrderType, string kfsDocType = null ) : bool
newOrderType OrderType
kfsDocType string
Résultat bool