private AssetManager_Software mapViewModelToEntitySoftware(
            AssetManager_Software_vm VMSoftware)
        {
            ServiceDesk_Users createdBy    = _nsUserRepository.GetUserByUserName(VMSoftware.CreatedByUserName);
            ServiceDesk_Users modifiedBy   = _nsUserRepository.GetUserByUserName(VMSoftware.ModifiedByUserName);
            ServiceDesk_Users productOwner = _nsUserRepository.GetUserByUserName(VMSoftware.ProductOwnerUserName);
            ServiceDesk_Users productUser  = _nsUserRepository.GetUserByUserName(VMSoftware.ProductUsersUserName);
            ServiceDesk_Users publisher    = _nsUserRepository.GetUserByUserName(VMSoftware.PublisherUserName);
            var softwareAsset = new AssetManager_Software
            {
                SoftwareAssetNumber = VMSoftware.SoftwareAssetNumber,
                Name = VMSoftware.Name,
                AccountingReqNumber = VMSoftware.AccountingReqNumber,
                DateOfPurchase      = VMSoftware.DateOfPurchase,
                CreatedById         = createdBy.Id,
                CreatedDate         = VMSoftware.CreatedDate,
                AssociatedCompanyId = VMSoftware.AssociatedCompanyId,
                EndOfSupportDate    = VMSoftware.EndOfSupportDate,
                LicenseCount        = VMSoftware.LicenseCount,
                Notes               = VMSoftware.Notes,
                ModifiedById        = modifiedBy == null ? (int?)null : modifiedBy.Id,
                ModifiedDate        = VMSoftware.ModifiedDate,
                LicensingInfo       = VMSoftware.LicensingInfo,
                ProductOwnerId      = productOwner == null ? (int?)null : productOwner.Id,
                ProductUsersId      = productUser == null ? (int?)null : productUser.Id,
                PublisherId         = publisher.Id,
                SoftwareTypeId      = VMSoftware.SoftwareTypeId,
                SupportingCompanyId = VMSoftware.SupportingCompanyId
            };

            return(softwareAsset);
        }
Example #2
0
        private HelpDesk_Tickets mapViewModelToEntityTicket(HelpDesk_Tickets_vm VMTicket)
        {
            ServiceDesk_Users approvedBy = _nsUserRepository.GetUserByUserName(VMTicket.ApprovedByUserName);
            ServiceDesk_Users assignedTo = _nsUserRepository.GetUserByUserName(VMTicket.AssignedToUserName);
            ServiceDesk_Users requestor  = _nsUserRepository.GetUserByUserName(VMTicket.RequestorUserName);
            var vmT = new HelpDesk_Tickets
            {
                TicketNumber     = VMTicket.TicketNumber,
                Title            = VMTicket.Title,
                Description      = VMTicket.Description,
                Requestor        = requestor.Id,
                DepartmentID     = requestor.DepartmentId,
                LocationID       = requestor.LocationId,
                RequestDateTime  = VMTicket.RequestDateTime,
                RequestedDueDate = VMTicket.RequestedDueDate,
                TicketCategoryID = VMTicket.TicketCategoryID,
                PriorityCode     = VMTicket.PriorityCode,
                StatusID         = VMTicket.StatusID,
                AssignedTo       = assignedTo.Id,
                VendorID         = VMTicket.VendorID,
                VendorTicket     = VMTicket.VendorTicket,
                TicketTypeID     = VMTicket.TicketTypeID,
                NeedsApproval    = VMTicket.NeedsApproval,
                ApprovedBy       = approvedBy == null ? (int?)null : approvedBy.Id,
                ApprovedOn       = VMTicket.ApprovedOn
            };

            return(vmT);
        }
Example #3
0
        public NSUser_vm GetUserByUserName(string userName)
        {
            if (string.IsNullOrEmpty(userName))
            {
                throw new ArgumentNullException(userName);
            }

            var user = _nsUserRepository.GetUserByUserName(userName);

            return(mapEntityToViewModelUser(user));
        }
Example #4
0
        private HelpDesk_TicketComments mapViewModelToEntityTicketComments(HelpDesk_TicketComments_vm VMTicketComment)
        {
            ServiceDesk_Users assignedTo    = _nsUserRepository.GetUserByUserName(VMTicketComment.AuthorUserName);
            HelpDesk_Tickets  relatedTicket = _helpDeskTicketRepository.GetTicketByID(VMTicketComment.TicketID);

            return(new HelpDesk_TicketComments
            {
                Id = VMTicketComment.Id,
                Author = assignedTo.Id,
                Comment = VMTicketComment.Comment,
                CommentDateTime = DateTime.UtcNow,
                CommentTypeID = VMTicketComment.CommentTypeID,
                TicketID = relatedTicket.Id
            });
        }
Example #5
0
        private HelpDesk_Tasks mapViewModelToEntityTask(HelpDesk_Tasks_vm VMTask)
        {
            ServiceDesk_Users assignedTo = _nsUserRepository.GetUserByUserName(VMTask.AssignedToUserName);
            var tasks = new HelpDesk_Tasks
            {
                Id                    = VMTask.Id,
                TicketID              = VMTask.TicketID,
                Title                 = VMTask.Title,
                Description           = VMTask.Description,
                StatusID              = VMTask.StatusID,
                CreatedDateTime       = VMTask.CreatedDateTime,
                StatusChangedDateTime = VMTask.StatusChangedDateTime,
                AssignedTo            = assignedTo.Id
            };

            return(tasks);
        }