//public BuySellDocStatementENUM IsSaleOrPurchase(BuySellDoc buySellDoc) //{ // if (buySellDoc.CustomerId.IsNullOrWhiteSpace() && buySellDoc.OwnerId.IsNullOrWhiteSpace()) // { // ErrorsGlobal.Add("Both Customer and Owner are empty.", "Event_CreateViewAndSetupSelectList"); // throw new Exception(); // } // if (buySellDoc.CustomerId.IsNullOrWhiteSpace()) // { // //this is a purchase order // return BuySellDocStatementENUM.SaleOrderStatement; // } // if (buySellDoc.OwnerId.IsNullOrWhiteSpace()) // { // //this is a sale. // return BuySellDocStatementENUM.PurchaseOrderStatement; // } // ApplicationUser ownerUser = OwnerBiz.GetUserForEntityrWhoIsNotAdminFor(buySellDoc.OwnerId); // ownerUser.IsNullThrowException(); // if (UserId == ownerUser.Id) // { // //this is a purchase // return BuySellDocStatementENUM.SaleOrderStatement; // } // //get the CustomerUser // ApplicationUser customerUser = CustomerBiz.GetUserForEntityrWhoIsNotAdminFor(buySellDoc.CustomerId); // customerUser.IsNullThrowException(); // if (UserId == customerUser.Id) // { // //this is a sale // return BuySellDocStatementENUM.PurchaseOrderStatement; // } // throw new Exception("Unknown type"); //} public override void Event_ModifyIndexItem(IndexListVM indexListVM, IndexItemVM indexItem, ICommonWithId icommonWithId) { base.Event_ModifyIndexItem(indexListVM, indexItem, icommonWithId); BuySellDoc buySellDoc = icommonWithId as BuySellDoc; buySellDoc.IsNullThrowException("Unable to unbox buySellDoc"); //we need to know if this is a sale or a purchase order ////get current user's PersonId first... //BuySellDocumentTypeENUM buySellDocumentTypeEnum = IsSaleOrPurchaseOrDelivery(buySellDoc); //buySellDoc.BuySellDocumentTypeEnum = buySellDocumentTypeEnum; indexItem.Name = buySellDoc.FullName(); //Person person = UserBiz.GetPersonFor(UserId); }