protected void Page_Load(object sender, EventArgs e) { //_profileRepository = new ProfileRepository(); _fr = new FileRepository(); _userSession = new UserSession(); _accountRepository = new AccountRepository(); _webContext = new WebContext(); if (_userSession.LoggedIn && _userSession.CurrentUser != null) { account = _userSession.CurrentUser; file = _fr.GetFileByID(fileID); } //show the appropriate image if (file != null) { //Response.Clear(); Response.ContentType = "jpg"; Response.BinaryWrite(file.ContentFile.ToArray()); } }
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; } }
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); }