예제 #1
0
        /// <summary>
        /// Determines whether [has edit permission for inventory staff].
        /// </summary>
        /// <param name="companyId">The company identifier.</param>
        /// <param name="userId">The user identifier.</param>
        /// <returns></returns>
        public bool HasEditPermissionForInventoryStaff(int companyId, int userId, int?locationId)
        {
            FinanceBL   financeBL   = new FinanceBL(DataContext);
            InventoryBL inventoryBL = new InventoryBL(DataContext);

            bool hasPackageSelected = financeBL.HasPackageSelectedForFreeTrailEndedCompany(companyId);

            return((Utils.IsCompanyInventoryAdmin(companyId, userId) ||
                    (!locationId.HasValue && inventoryBL.IsCompanyInventoryStaffMemberAnyLocation(companyId, userId)) ||
                    (locationId.HasValue && Utils.IsCompanyInventoryStaffMember(companyId, userId, locationId, DataContext))) &&
                   !this.HasCompanySuspendedbySBAdmin(companyId) && hasPackageSelected && !IsCompanySuspended(companyId));
        }