Пример #1
0
 public Message(DatingProfile sender, string messageTitle, string messageData)
 {
     this.sender       = sender;
     this.messageTitle = messageTitle;
     this.messageData  = messageData;
     isRead            = false;
 }
Пример #2
0
        static void Main(string[] args)
        {
            DatingProfile sean = new DatingProfile("Sean", "Laux", 29, "Male");

            sean.WriteBio("Loves to code");

            DatingProfile sarah = new DatingProfile("Sarah", "Pratt", 25, "Female");

            sarah.WriteBio("Loves coders");

            DatingProfile ruth = new DatingProfile("Ruth", "Rudeperson", 99, "Female");

            ruth.WriteBio("HAHA, sure loves coders!");

            sean.DisplayBio();
            ruth.DisplayBio();
            sarah.DisplayBio();



            sean.SendMessage("Hello Ruth", "What do you love about coders?", ruth);
            ruth.ReadMessage();
            ruth.SendMessage("Lol you're a nerd", "I was being ironic, coders are lame", sean);
            sarah.SendMessage("Hi!", "Hey Sean, what languages do you know?", sean);

            sean.ReadMessage();
        }
        //[Authorize]
        public async Task <IActionResult> Create([Bind("Id,DisplayName,FirstName,LastName,Age,Gender,Bio,UserAccountId")]
                                                 DatingProfile datingProfile, IFormFile FilePhoto)
        {
            if (FilePhoto.Length > 0)
            {
                //see for free images:pexels.com

                string photoPath = _webRoot.WebRootPath + "\\userPhotos\\";
                //get the name of the photo ie, filename of photo
                var fileName = Path.GetFileName(FilePhoto.FileName);

                using (var datastream = System.IO.File.Create(photoPath + fileName))
                {
                    await FilePhoto.CopyToAsync(datastream);

                    datingProfile.PhotoPath = fileName;
                }
            }

            if (ModelState.IsValid)
            {
                _context.Add(datingProfile);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(datingProfile));
        }
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Age,Gender,Bio,UserAccountId,DisplayName")] DatingProfile datingProfile,
                                                 IFormFile FilePhoto)
        {
            if (FilePhoto.Length > 0)
            {
                string photoPath = _webroot.WebRootPath + "\\userPhotos\\";
                var    fileName  = Path.GetFileName(FilePhoto.FileName);

                using (var stream = System.IO.File.Create(photoPath + fileName))
                {
                    await FilePhoto.CopyToAsync(stream);

                    datingProfile.PhotoPath = fileName;
                }
            }

            if (ModelState.IsValid)
            {
                _context.Add(datingProfile);
                await _context.SaveChangesAsync();

                return(RedirectToAction("ProfileInfo"));
            }
            return(View(datingProfile));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Age,Gender,Bio,UserAccountId,DisplayName")] DatingProfile datingProfile,
                                               IFormFile FilePhoto)
        {
            if (id != datingProfile.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(datingProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DatingProfileExists(datingProfile.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(datingProfile));
        }
Пример #6
0
 public void AddStardaterProfile(DatingProfile profile)
 {
     if (!profiles.Contains(profile) && profile.member != null)
     {
         profiles.Add(profile);
     }
 }
Пример #7
0
        public IActionResult ProfileInfo()
        {
            string        userID  = _userManager.GetUserId(User);
            DatingProfile profile = _context.DatingProfile.FirstOrDefault(predicate => predicate.UserAccountId == userID);

            if (profile == null)
            {
                return(RedirectToAction("Create"));
            }
            return(View(profile));
        }
Пример #8
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Age,Gender,Bio,UserAccountId")] DatingProfile datingProfile)
        {
            if (ModelState.IsValid)
            {
                _context.Add(datingProfile);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(datingProfile));
        }
Пример #9
0
    static void Main(string[] args)
    {
        DatingProfile Ted = new DatingProfile("Ted", "Dancing", 42, "Male");

        Ted.WriteBio("Loves the OutDoors");

        DatingProfile Babes = new DatingProfile("Babes", "Bunny", 39, "Female");

        Babes.WriteBio("Loves To Hike and Bike Ride");

        Ted.SendMessage("Hello Babes", "Wanna Take a Walk With Me", Babes);
        Babes.ReadMessage();
    }
Пример #10
0
        public IActionResult Send([Bind("MessageTitle, MessageText")] MailMessage mail, int toProfileId)
        {
            DatingProfile fromUser = _context.DatingProfile.FirstOrDefault(p => p.UserAccountId == _userManager.GetUserId(User));

            mail.FromProfileId = fromUser.Id;
            mail.IsRead        = false;
            mail.FromProfile   = fromUser;
            mail.ToProfileId   = toProfileId;

            _context.Add(mail);
            _context.SaveChanges();

            return(RedirectToAction("Browse", "DatingProfiles"));
        }
Пример #11
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Age,Gender,Bio,UserAccountId")] DatingProfile datingProfile)
        {
            if (ModelState.IsValid)
            {
                _context.Add(datingProfile);
                await _context.SaveChangesAsync();

                // Clean up the Home Page
                // Change Profile Info to go back to the Home Page
                return(RedirectToAction("Index", "Home"));
                // return RedirectToAction(nameof(Index)); ...commented out by th 08192020
            }
            return(View(datingProfile));
        }
Пример #12
0
        public IActionResult ProfileInfo()
        {
            // Get User ID.
            string        userID  = _userManager.GetUserId(User);
            DatingProfile profile = _context.DatingProfile.FirstOrDefault(p => p.UserAccountId == userID);

            if (profile == null)
            {
                // If no existing profile, create a profile.
                return(RedirectToAction("Create"));
            }


            return(View(profile));
        }
Пример #13
0
    static void Main(string[] args)
    {
        DatingProfile brian = new DatingProfile("Brian", "White", 38, "Male");

        brian.WriteBio("Outspoken and social type");

        DatingProfile kate = new DatingProfile("Kate", "Volvo", 30, "Female");

        kate.WriteBio("I am reserve but social");

        brian.SendMessage("Hello Kate", "Can we have a nice time together tomorrow?", kate);
        kate.ReadMessage();
        kate.SendMessage("Yeah sure", "What time would that be?");
        brian.ReadMessage();
        brian.SendMessage("Ok cool", "by 05:00pm", "See you then");
    }
Пример #14
0
        public IActionResult Inbox()
        {
            DatingProfile profile = _context.DatingProfile.FirstOrDefault(id => id.UserAccountId == _userManager.GetUserId(User));
            InboxView     inbox   = new InboxView();

            inbox.mailMessages = _context.MailMessage.Where(to => to.ToProfileId == profile.Id).ToList();

            List <DatingProfile> fromList = new List <DatingProfile>();

            foreach (var msg in inbox.mailMessages)
            {
                fromList.Add(_context.DatingProfile.FirstOrDefault(from => from.Id == msg.FromProfileId));
            }
            inbox.fromProfiles = fromList;

            return(View(inbox));
        }
Пример #15
0
    public void ContactForChat(DatingProfile sender, DatingProfile receiver)
    {
        if (sender == tedsProfile)
        {
            curProfile = sender;
            sender.SetChattingStatusWithTed(true);

            PrevSessionState = SessionState;
            SessionState     = SessionMode.BeingContacted;

            chatRequestTxt.text = incomingChatRequestText + sender.GetName() + "?";
        }
        else
        {
            sender.SetChattingStatus(true);
            receiver.SetChattingStatus(true);
        }
    }
Пример #16
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,DisplayName,Age,Gender,Bio,UserAccountId")] DatingProfile datingProfile,
                                               IFormFile FilePhoto)
        {
            if (id != datingProfile.Id)
            {
                return(NotFound());
            }

            if (FilePhoto.Length > 0)
            {
                string photoPath = _webroot.WebRootPath + "\\userPhotos\\";
                var    fileName  = Path.GetFileName(FilePhoto.FileName);

                using (var stream = System.IO.File.Create(photoPath + fileName))
                {
                    await FilePhoto.CopyToAsync(stream);

                    datingProfile.PhotoPath = fileName;
                }
            }


            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(datingProfile);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DatingProfileExists(datingProfile.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(datingProfile));
        }
Пример #17
0
    // Start is called before the first frame update
    void Start()
    {
        commsPanel   = commsPanel.GetComponent <PanelsBottom>();
        commsControl = FindObjectOfType <CommsController>();
        tedsProfile  = FindObjectOfType <Teddy>().transform.GetComponent <IDCharacter>().stardaterProfile;

        basicInfoTxt.supportRichText = true;
        profileTxt.supportRichText   = true;

        EnableScreen(false);

        curProfileIndex = 0;

        isActivated = false;

        curProfileInspectionImage    = profilePage;
        curChatButton                = acceptChatButton;
        curChatPendingTextFrameIndex = 0;

        SessionState     = SessionMode.Inactive;
        PrevSessionState = SessionMode.Inactive;
        InspectionState  = InspectionMode.LookingAtMainPage;
    }
Пример #18
0
            public void SendMessage(string messageTitle, string messageData, DatingProfile toProfile)
            {
                Message message = new Message(this, messageTitle, messageData);

                toProfile.AddMessage(message);
            }
Пример #19
0
    // Update is called once per frame
    void Update()
    {
        if (profiles.Count == 0)
        {
            curProfile = emptyProfile;
        }
        else
        {
            curProfile = profiles[curProfileIndex];
        }

        if (curProfile != null)
        {
            if (curProfile.StatusIsOnline())
            {
                statusIndicator.texture = onlineImage;
            }
            else
            {
                statusIndicator.texture = offlineImage;
            }

            numOfPicsInCurProfile = curProfile.profilePics.Count;
        }

        switch (SessionState)
        {
        case SessionMode.Inactive:

            datingSourceCamera.enabled = false;

            EnableScreen(false);

            curChatButton             = acceptChatButton;
            curProfileInspectionImage = dateScreenFrame;

            curProfileIndex    = 0;
            curProfilePicIndex = 0;

            break;

        case SessionMode.Browsing:

            datingSourceCamera.enabled = false;
            profilePicImage.enabled    = false;
            profilePage.enabled        = true;

            chatPendingWindow.enabled          = false;
            startChatButton.enabled            = false;
            startChatButtonHighlighter.enabled = false;

            profileTxt.enabled      = false;
            basicInfoTxt.enabled    = true;
            captionTxt.enabled      = false;
            chatPendingText.enabled = false;
            chatRequestTxt.enabled  = false;

            profilePage.color = new Color(profilePage.color.r, profilePage.color.g, profilePage.color.b, profileBgdAlphaWhenBrowsing);

            if (profiles.Count > 0 && curProfile != null)
            {
                statusIndicator.enabled = true;
                basicInfoTxt.text       = curProfile.GetBasicInfo();

                if (curProfile.customBgd != null)
                {
                    profilePage.texture = curProfile.customBgd;
                }
                else
                {
                    profilePage.texture = profileBgd;
                }
            }
            else
            {
                statusIndicator.enabled = false;
                basicInfoTxt.text       = noProfilesText;
            }

            break;

        case SessionMode.Inspecting:

            datingSourceCamera.enabled = false;
            profilePage.enabled        = true;
            chatPendingWindow.enabled  = false;

            basicInfoTxt.enabled    = false;
            chatPendingText.enabled = false;
            chatRequestTxt.enabled  = false;

            profilePage.color = new Color(profilePage.color.r, profilePage.color.g, profilePage.color.b, profileBgdAlphaWhenInspecting);

            if (curProfile != null)
            {
                startChatButton.enabled = true;
                startChatButton.texture = chatButtonImageInactive;
                statusIndicator.enabled = true;

                if (curProfileInspectionImage == profilePage)
                {
                    profileWindowHighlighter.enabled   = true;
                    startChatButtonHighlighter.enabled = false;
                }
                else if (curProfileInspectionImage == startChatButton)
                {
                    profileWindowHighlighter.enabled   = false;
                    startChatButtonHighlighter.enabled = true;
                }

                if (curProfile.StatusIsOnline())
                {
                    statusIndicator.texture = onlineImage;
                    startChatButton.color   = new Color(startChatButton.color.r, startChatButton.color.g, startChatButton.color.b, startChatButtonAvailableAlpha);
                }
                else
                {
                    statusIndicator.texture = offlineImage;
                    startChatButton.color   = new Color(startChatButton.color.r, startChatButton.color.g, startChatButton.color.b, startChatButtonNotAvailableAlpha);
                }

                if (curProfile.customBgd != null)
                {
                    profilePage.texture = curProfile.customBgd;
                }
                else
                {
                    profilePage.texture = profileBgd;
                }
            }

            switch (InspectionState)
            {
            case InspectionMode.LookingAtMainPage:

                profilePicImage.enabled = false;

                captionTxt.enabled = false;

                if (curProfile != null)
                {
                    profileTxt.text    = curProfile.GetCharacteristics();
                    profileTxt.enabled = true;
                }

                break;

            case InspectionMode.LookingAtLikesAndDislikes:

                profilePicImage.enabled = false;

                captionTxt.enabled = false;

                if (curProfile != null)
                {
                    profileTxt.text    = curProfile.GetLikesAndDislikes();
                    profileTxt.enabled = true;
                }

                break;

            case InspectionMode.LookingAtPictures:

                profilePicImage.enabled = true;
                profileTxt.enabled      = false;

                if (curProfile != null)
                {
                    if (curProfile.profilePics.Count > 0)
                    {
                        profilePicImage.rectTransform.sizeDelta = new Vector2(curProfile.profilePics[curProfilePicIndex].width, curProfile.profilePics[curProfilePicIndex].height);
                        profilePicImage.texture = curProfile.profilePics[curProfilePicIndex];

                        captionTxt.enabled = true;
                        captionTxt.text    = curProfile.profilePics[curProfilePicIndex].name;
                    }
                }
                else
                {
                    profilePicImage.texture = noProfilePicsTexture;
                    captionTxt.enabled      = false;
                }

                break;
            }

            break;

        case SessionMode.BeingContacted:

            datingSourceCamera.enabled = false;

            chatPendingWindow.enabled = true;
            acceptChatButton.enabled  = true;
            rejectChatButton.enabled  = true;

            chatRequestTxt.enabled = true;

            break;

        case SessionMode.Contacting:

            datingSourceCamera.enabled = false;

            if (Time.time - chatPendingWaitTimeRef > chatPendingWaitTime)
            {
                commsControl.StartDatingChat(curProfile.member);
                SessionState = SessionMode.Chatting;
            }
            else
            {
                chatPendingWindow.enabled = true;
                chatPendingText.enabled   = true;

                chatPendingText.text = chatPendingTextFrames[curChatPendingTextFrameIndex];

                if (Time.time - chatPendingTextRefTime > chatPendingTextFrameTime)
                {
                    curChatPendingTextFrameIndex = (curChatPendingTextFrameIndex + chatPendingTextFrames.Count + 1) % chatPendingTextFrames.Count;
                    chatPendingTextRefTime       = Time.time;
                }
            }

            break;

        case SessionMode.Chatting:

            datingSourceCamera.enabled = true;

            profilePage.enabled = true;
            profilePage.texture = chatVideoTexture;

            profilePage.color = new Color(profilePage.color.r, profilePage.color.g, profilePage.color.b, 1);

            profilePicImage.enabled = false;

            profileTxt.enabled = false;
            captionTxt.enabled = false;

            startChatButton.enabled = true;
            startChatButton.texture = chatButtonImageActive;

            chatPendingWindow.enabled = false;
            chatPendingText.enabled   = false;

            startChatButtonHighlighter.enabled = false;

            break;
        }
    }
Пример #20
0
    public void SendMessage(string messageTitle, string messageData, DatingProfile sentTo)
    {
        Messages message = new Messages(this, messageTitle, messageData);

        sentTo.AddToInbox(message);
    }
Пример #21
0
 internal void SendMessage(string v1, string v2, DatingProfile susie)
 {
     throw new NotImplementedException();
 }