Beispiel #1
0
 public void LoadDisplay(File file)
 {
     IWebContext _webcontext = new WebContext();
     UserSession _usersession = new UserSession();
     if (_usersession.CurrentUser != null)
     {
         if (_webcontext.AccountID > 0 && _usersession.CurrentUser.AccountID != _webcontext.AccountID)
         {
             if (file.IsPublicResource == true)
             {
                 Image1.ImageUrl = "~/Photo/ProfileAvatar.aspx?FileID=" + file.FileID;
                 Name.Text = file.FileName;
                 Date.Text = file.CreateDate.ToString();
                 Desc.Text = "File Share by"+ file.AccountID;
                 FileID.Text = file.FileID.ToString();
                 Ispublic.Checked = true;
                 LoadFriend();
             }
             else div1.Visible = false;
         }
         else
         {
             Image1.ImageUrl = "~/Photo/ProfileAvatar.aspx?FileID=" + file.FileID;
             Name.Text = file.FileName;
             Date.Text = file.CreateDate.ToString();
             Desc.Text = "File Share by" + file.AccountID;
             FileID.Text = file.FileID.ToString();
             Ispublic.Checked = file.IsPublicResource;
             LoadFriend();
         }
     }
 }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _usersession = new SPKTCore.Core.Impl.UserSession();
     _fi = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository();
     _f = new SPKTCore.Core.DataAccess.Impl.FriendRepository();
     _ac = new SPKTCore.Core.DataAccess.Impl.AccountRepository();
     _fs = new SPKTCore.Core.Impl.FriendService();
     _account = new Account();
 }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _usersession = new SPKTCore.Core.Impl.UserSession();
     _fi = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository();
     _f = new SPKTCore.Core.DataAccess.Impl.FriendRepository();
     _email = new SPKTCore.Core.Impl.Email();
     _presenter = new ProfileDisplayPresenter();
     _ac = new AccountRepository();
     _presenter.Init(this);
 }
Beispiel #4
0
 public void LoadFriend()
 {
     UserSession _usersession = new UserSession();
     FriendService frs = new FriendService();
     List<Object> usename = new List<object>();
     foreach (Account a in frs.SearchFriend(_usersession.CurrentUser))
     {
         usename.Add(a.DisplayName);
     }
     friend.DataSource = usename;
     friend.DataBind();
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //file1.Visible = false;
     _usersession = new UserSession();
     _webcontext = new WebContext();
     _for = new FolderRepository();
     re = new Redirector();
     if (_usersession.CurrentUser != null)
     {
        countA.Text=(_for.GetFoldersByAccountID1(_usersession.CurrentUser.AccountID)).Count.ToString();
       // pn.Height = 200 * (int.Parse(countA.Text));
     }
 }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _usersession = new UserSession();
            _ac = new AccountRepository();
            _pr = new UserProfilePresenter();
            _statusService = new SPKTCore.Core.Impl.StatusUpdateService();
            Friendship1.setidac(acid);
            com1.setidac(acid);

               // add.setidac(acid);
            mess1.setidac(acid);
            load();
            com1.setidst(idst);
            //mess1.setidac(Int32.Parse(Label3.Text));
        }
Beispiel #7
0
 public void LoadDisplay(Folder fo)
 {
     IWebContext _webcontext = new WebContext();
     UserSession _usersession = new SPKTCore.Core.Impl.UserSession();
     if (_webcontext.AccountID > 0 && _usersession.CurrentUser.AccountID != _webcontext.AccountID)
     {
         if (fo.IsPublicResource == true)
         {
             if (fo.FileDescID != null || fo.FileDescID != 0)
             {
                 Image1.ImageUrl = "~/Photo/ProfileAvatar.aspx?FileID=" + fo.FileDescID;
             }
             else
                 Image1.ImageUrl = "~/Photo/ProfileAvatar.aspx?FileID=" + 60;
             Name.Text = "Tên Album: " + fo.Name;
             Date.Text = "Ngày tạo: " + fo.CreateDate.ToString();
             Desc.Text = "Mô tả :" + fo.Description;
             FolderID.Text = fo.FolderID.ToString();
             Ispublic.Checked = true;
         }
         else div1.Visible = false;
     }
     else
     {
         if (fo.FileDescID != null || fo.FileDescID != 0)
         {
             Image1.ImageUrl = "~/Photo/ProfileAvatar.aspx?FileID=" + fo.FileDescID;
         }
         else
             Image1.ImageUrl = "~/Photo/ProfileAvatar.aspx?FileID=" + 60;
         Name.Text = "Tên Album: " + fo.Name;
         Date.Text = "Ngày tạo: " + fo.CreateDate.ToString();
         Desc.Text = "Mô tả :" + fo.Description;
         FolderID.Text = fo.FolderID.ToString();
         Ispublic.Checked = fo.IsPublicResource;
         LoadFriend();
     }
 }
Beispiel #8
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            AccountRepository ac = new AccountRepository();
            FileRepository fr = new FileRepository();
            WebContext webcontext = new WebContext();
            UserSession usersession = new UserSession();
            _usersession = new UserSession();

            if (webcontext.AccountID > 0 && usersession.CurrentUser.AccountID != webcontext.AccountID)
            {
                Share s = new Share();
                Account a = ac.GetAccountByID(webcontext.AccountID);
                File f = fr.GetFileByID(long.Parse(FileID.Text));
                s.Shared(_usersession.CurrentUser, a, f);
                pnm.Visible = false;
            }
            else
            {
                pnm.Visible = true;
            }
        }
Beispiel #9
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     AccountRepository ac = new AccountRepository();
     FileRepository fr = new FileRepository();
     _usersession = new UserSession();
     Share s = new Share();
     Account a = ac.GetAccountByUsername(friend.Text);
     File f = fr.GetFileByID(long.Parse(FileID.Text));
     s.Shared(a, _usersession.CurrentUser, f);
 }
Beispiel #10
0
 public void Init()
 {
     _usersession = new UserSession();
     _webcontext = new WebContext();
     _fi = new FileService();
 }
Beispiel #11
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     AccountRepository ac = new AccountRepository();
     FolderRepository fr = new FolderRepository();
     WebContext webcontext = new WebContext();
     UserSession usersession = new UserSession();
     _usersession = new UserSession();
         Share s = new Share();
         Account a = ac.GetAccountByUsername(friend.Text);
         Folder f = fr.GetFolderByID(long.Parse(FolderID.Text));
         s.Shared1(a, _usersession.CurrentUser, f);
 }
Beispiel #12
0
 private void SetLogedInSession(string username)
 {
     IAccountService accountService = new AccountService();
     Account account = accountService.GetAccountByUsername(username);
     IUserSession _userSession = new UserSession();
     _userSession.CurrentUser = account;
     _userSession.CurrentProfile = account.Profile;
 }
Beispiel #13
0
 private static void ClearLogedinSession()
 {
     IUserSession _userSession = new UserSession();
     _userSession.CurrentUser = null;
 }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _webcontext = new WebContext();
            _usersession = new SPKTCore.Core.Impl.UserSession();
            _fi = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository();
            _f = new SPKTCore.Core.DataAccess.Impl.FriendRepository();
            _email = new SPKTCore.Core.Impl.Email();
            _presenter = new ProfileDisplayPresenter();
            _ac = new AccountRepository();
            _presenter.Init(this);
            btn_de.Attributes.Add("onclick", "javascript:return confirm('Ban co muon xoa bạn?')");
            if (_usersession.CurrentUser == null)
            {
                btn_add_de.Visible = false;
                btn_de.Visible = false;
                btn_ok.Visible = false;
            }
            else
            {

                    if (_presenter.TestFriend(_account) == true || _presenter.TestFriend2(_account))
                    {
                        btn_add_de.Visible = false;
                        btn_de.Visible = true;
                        btn_ok.Visible = false;
                        if (_webcontext.SearchText == lblUsername.Text)
                        {
                            btn_de.Visible = true;
                            btn_de.Text = "Chào bạn";
                            btn_de.BackColor = System.Drawing.Color.Gray;
                        }
                    }

                    else
                    {
                        btn_add_de.Visible = true;
                        btn_de.Visible = false;
                        btn_ok.Visible = false;
                        if (_webcontext.SearchText == lblUsername.Text)
                        {
                            btn_add_de.Visible = true;
                            btn_add_de.Text = "Chào bạn";
                            btn_add_de.BackColor = System.Drawing.Color.Gray;

                        }
                    }
                    imgAvatar.ImageUrl = "~/Image/ProfileAvatar.aspx?AccountID=" + Int32.Parse(lblFriendID.Text);

            }
            more1.setacid(Int32.Parse(lblFriendID.Text));
        }
Beispiel #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _usersession = new SPKTCore.Core.Impl.UserSession();
     _fi = new SPKTCore.Core.DataAccess.Impl.FriendInvitationRepository();
     _f = new SPKTCore.Core.DataAccess.Impl.FriendRepository();
     _presenter = new ProfileDisplayPresenter();
     _presenter.Init(this);
     btn_de.Attributes.Add("onclick", "javascript:return confirm('Ban co muon xoa bạn?')");
     if (_usersession.CurrentUser == null)
     {
         btn_add_de.Visible = true;
         btn_de.Visible = false;
     }
     else
     {
         if (_presenter.TestFriend(_account) == true||_presenter.TestFriend2(_account))
         {
             btn_add_de.Visible = false;
             btn_de.Visible = true;
         }
         else
         {
             btn_add_de.Visible = true;
             btn_de.Visible = false;
         }
     }
 }
Beispiel #16
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!");
            }
        }