Esempio n. 1
0
        public bool ShouldShowStatus(StatusUpdate Status, Account AccountBeingViewed, Account Account)
        {
            bool result;
            if (Account != null)
            {
                if (Account.AccountID == AccountBeingViewed.AccountID)
                    return true;
                bool isFriend = _friendService.IsFriend(Account, AccountBeingViewed);
                if (Status.VisibilityLevelID == (int)VisibilityLevel.VisibilityLevels.Private)
                    result = false;

                else if ((Status.VisibilityLevelID == (int)VisibilityLevel.VisibilityLevels.Friends) && (isFriend))
                    result = true;
                else if (Status.VisibilityLevelID == (int)VisibilityLevel.VisibilityLevels.Public)
                    result = true;
                else
                    result = false;

                return result;
            }
            else
            {
                if (Status.VisibilityLevelID == (int)VisibilityLevel.VisibilityLevels.Public)
                    result = true;
                else
                    result = false;
                return result;
            }
        }
Esempio n. 2
0
 public void SaveStatusUpdate(String statusContent, int range)
 {
     status = new StatusUpdate();
     status.AccountID = account.AccountID;
     status.Status = statusContent;
     status.VisibilityLevelID = range;
     _statusUpdateService.SaveStatusUpdate(status);
 }
Esempio n. 3
0
 public void SaveStatusUpdate(StatusUpdate statusUpdate)
 {
     using (SPKTDataContext dc = conn.GetContext())
     {
         if (statusUpdate.StatusUpdateID > 0)
         {
             dc.StatusUpdates.Attach(statusUpdate, true);
         }
         else
         {
             statusUpdate.CreateDate = DateTime.Now;
             dc.StatusUpdates.InsertOnSubmit(statusUpdate);
         }
         dc.SubmitChanges();
     }
 }
Esempio n. 4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Folder folder = new Folder();
     folder.AccountID = _usersession.CurrentUser.AccountID;
     folder.CreateDate = DateTime.Now;
     folder.Description = TextBox2.Text;
     folder.Name = TextBox1.Text;
     folder.IsPublicResource = Ispublic.Checked;
     folder.Location = "location";
     long id=_for.SaveFolder(folder);
     _redirect.Redirect("~/Photo/CreateAlbum.aspx?FolderID=" + id);
     StatusUpdate st = new StatusUpdate();
     StatusUpdateRepository s = new StatusUpdateRepository();
     st.AccountID = _usersession.CurrentUser.AccountID;
     st.VisibilityLevelID = 1;
     st.Status = "Tạo Album mới" + TextBox1.Text;
     st.SenderID = _usersession.CurrentUser.AccountID;
     st.FileID = folder.FileDescID;
     s.SaveStatusUpdate(st);
 }
Esempio n. 5
0
        public void AddStatusUpdateAlert(StatusUpdate statusUpdate)
        {
            Init();

            alert.CreateDate = DateTime.Now;
            alert.AccountID = statusUpdate.SenderID;
            alert.AlertTypeID = (int)AlertType.AlertTypes.StatusUpdate;
            alertMessage = "<div class=\"AlertHeader\">" +
                            GetProfileImage(_userSession.CurrentUser.AccountID)
                            + GetProfileUrl(_userSession.CurrentUser.UserName) +
                            "   " + statusUpdate.Status + "</div>";

            /*alertMessage ="<a href='/UserProfile2.aspx?AccountID='"+ _accountRepository.GetAccountByID(statusUpdate.SenderID).UserName+"</a" + " viết lên tường nhà "
                    +"<a href='~/Profiles/UserProfile2.aspx?AccountID='"+ _accountRepository.GetAccountByID((int)statusUpdate.AccountID).UserName+"<\a>" + " : " + statusUpdate.Status;
             */

            alert.Message = alertMessage;
            SaveAlert(alert);
            SendAlertToFriends(alert);
        }
Esempio n. 6
0
 public void SaveStatusUpdate(StatusUpdate statusUpdate)
 {
     _statusRepository.SaveStatusUpdate(statusUpdate);
        // if(statusUpdate.SenderID!=statusUpdate.AccountID)
     _alertService.AddStatusUpdateAlert(statusUpdate);
 }
Esempio n. 7
0
        //}
        internal void SaveStatusUpdate(String statusContent, int range)
        {
            if (!_userSession.LoggedIn)
            {
                _view.Message("Chưa đăng nhập");
                return;
            }
            int accountID;
            int senderID;
            senderID = _userSession.CurrentUser.AccountID;
            accountID = _webContext.AccountID;
            bool IsAccount = true;
            if (accountID != senderID)
                IsAccount = false;
            if (accountID <= 0)
                accountID = senderID;

            StatusUpdate status;
            status = new StatusUpdate();
            status.AccountID = accountID;
            status.SenderID = senderID;
            status.Status = statusContent;
            status.VisibilityLevelID = range;

            IStatusUpdateService _statusUpdateService;
            _statusUpdateService = new StatusUpdateService();
            _statusUpdateService.SaveStatusUpdate(status);
            _view.LoadAlert(_alertService.GetAlerts(senderID, accountID), _statusUpdateService.GetStatusUpdateByID( _userSession.CurrentUser,_accountService.GetAccountByAccountID(accountID), IsAccount));
        }
Esempio n. 8
0
 partial void DeleteStatusUpdate(StatusUpdate instance);
Esempio n. 9
0
 partial void InsertStatusUpdate(StatusUpdate instance);
Esempio n. 10
0
		private void detach_StatusUpdates(StatusUpdate entity)
		{
			this.SendPropertyChanging();
			entity.Account = null;
		}
Esempio n. 11
0
		private void detach_StatusUpdates(StatusUpdate entity)
		{
			this.SendPropertyChanging();
			entity.VisibilityLevel = null;
		}
Esempio n. 12
0
        public void AddStatusUpdateAlert(StatusUpdate statusUpdate)
        {
            Init();

            alert.CreateDate = DateTime.Now;
            alert.AccountID = statusUpdate.SenderID;
            alert.AlertTypeID = (int)AlertType.AlertTypes.StatusUpdate;
            /*alertMessage = "<div >" +
                            GetProfileImage(_userSession.CurrentUser.AccountID)
                            + GetProfileUrl(_userSession.CurrentUser.UserName) +
                            "   " + statusUpdate.Status + "</div>";*/
            if (statusUpdate.SenderID == statusUpdate.AccountID)
            {
                if (statusUpdate.VisibilityLevelID != 3)
                {
                    alertMessage = "<a href=\"/Profiles/UserProfile2.aspx?AccountID=" + statusUpdate.SenderID.ToString() + "\">" +
                        _accountRepository.GetAccountByID(statusUpdate.SenderID).UserName + "</a>" +
                         "vừa mới đăng trạng thái: " + statusUpdate.Status;
                    alert.Message = alertMessage;
                    SaveAlert(alert);
                    //SendAlertToFriends(alert);
                }
            }

            /*else
            {
                alertMessage = "<a href='/UserProfile2.aspx?AccountID='" +statusUpdate.SenderID+">" + _accountRepository.GetAccountByID(statusUpdate.SenderID).UserName + "</a" + " viết lên tường nhà "
                        + "<a href='~/Profiles/UserProfile2.aspx?AccountID='" + statusUpdate.AccountID+">" + _accountRepository.GetAccountByID((int)statusUpdate.AccountID).UserName + "<\a>" + " : " + statusUpdate.Status;
            }*/
        }
Esempio n. 13
0
        internal void SaveStatusUpdate(String statusContent, int range)
        {
            if (!_userSession.LoggedIn)
            {
               // _view.Message("Chưa đăng nhập");
                return;
            }
            int accountID;
            int senderID;
            senderID = _userSession.CurrentUser.AccountID;
            accountID = _webContext.AccountID;
            if (accountID <= 0)
                accountID = senderID;
            StatusUpdate status;
            status = new StatusUpdate();
            status.AccountID = accountID;
            status.SenderID = senderID;
            status.Status = statusContent;
            status.VisibilityLevelID = range;

            IStatusUpdateService _statusUpdateService;
            _statusUpdateService = new StatusUpdateService();
            _statusUpdateService.SaveStatusUpdate(status);
            LogUtil.Logger.Writeln("SaveStatusUpdate: " + statusContent);
            _view.LoadStatus(GetStatusToShow(account), GetAlertToShow(account));
        }
Esempio n. 14
0
        public void UploadFile(HttpPostedFile file,string desc, bool Ispublic)
        {
            string extension = Path.GetExtension(file.FileName).ToLower();
            string mimetype;
            byte[] uploadedImage = new byte[file.InputStream.Length];
            switch (extension)
            {
                case ".png":
                case ".jpg":
                case ".gif":
                    mimetype = file.ContentType;
                    break;

                default:
                //    _view.ShowMessage("We only accept .png, .jpg, and .gif!");
                    return;
            }

            if (file.ContentLength / 1000 < 3000)
            {
                SPKTCore.Core.Domain.File fi = new SPKTCore.Core.Domain.File();
                fi.AccountID = _userSession.CurrentUser.AccountID;
                fi.CreateDate = DateTime.Now;
                if (_webcontext.FolderID > 1)
                {
                    fi.DefaultFolderID = _webcontext.FolderID;

                }
                else
                {
                    fi.DefaultFolderID = 10;
                }
                fi.Description = desc;
                fi.FileName = file.FileName;
                fi.FileSystemFolderID = 1;
                Guid guiname = Guid.NewGuid();
                fi.FileSystemName = guiname;
                string fileType="1";
                switch (fileType)
                {
                    case "1":
                        fi.FileSystemFolderID = (int)FileSystemFolder.Paths.Pictures;
                        switch (extension.ToLower())
                        {
                            case "jpg":
                                fi.FileTypeID = (int)SPKTCore.Core.Domain.File.Types.JPG;
                                break;
                            case "gif":
                                fi.FileTypeID = (int)SPKTCore.Core.Domain.File.Types.GIF;
                                break;
                            case "jpeg":
                                fi.FileTypeID = (int)SPKTCore.Core.Domain.File.Types.JPEG;
                                break;
                            default:
                                fi.FileTypeID = 1;
                                break;
                        }
                        break;

                    case "2":
                        fi.FileSystemFolderID = (int)FileSystemFolder.Paths.Videos;
                        switch (extension.ToLower())
                        {
                            case "wmv":
                                fi.FileTypeID = (int)SPKTCore.Core.Domain.File.Types.WMV;
                                break;
                            case "flv":
                                fi.FileTypeID = (int)SPKTCore.Core.Domain.File.Types.FLV;
                                break;
                            case "swf":
                                fi.FileTypeID = (int)SPKTCore.Core.Domain.File.Types.SWF;
                                break;
                            default:
                                fi.FileTypeID=4;
                                break;
                        }
                        break;

                }
                fi.FileTypeID = int.Parse(fileType);
                fi.IsPublicResource = Ispublic;
                fi.Size = file.ContentLength;
                file.InputStream.Read(uploadedImage, 0, uploadedImage.Length);
                fi.ContentFile = uploadedImage;
                FileRepository fr = new FileRepository();
                fr.Save(fi);
                Folder fo = _for.GetFolderByID(fi.DefaultFolderID);
                fo.FileDescID = fi.FileID;
                _for.SaveFolder(fo);
                if (_webcontext.FolderID == 1)
                {
                    UserSession _usersession = new UserSession();
                    StatusUpdate st = new StatusUpdate();
                    StatusUpdateRepository s = new StatusUpdateRepository();
                    st.AccountID = _usersession.CurrentUser.AccountID;
                    st.VisibilityLevelID = 1;
                    st.Status = "Tạo Ảnh mới" + fi.FileName;
                    st.SenderID = _usersession.CurrentUser.AccountID;
                    st.FileID = fi.FileID;
                    s.SaveStatusUpdate(st);
                }
            }
            else
            {
               // _view.ShowMessage("Ảnh của bạn quá lớn!");
            }
        }