使用asp.net,C#.net,SQL server 2005将照片分享给朋友 [英] Share photos to friends using asp.net, C#.net, SQL server 2005

查看:99
本文介绍了使用asp.net,C#.net,SQL server 2005将照片分享给朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



i有2个表,比如tbl_userprofile,tbl_images。

在tbl_userprofile页面中有5个colums,
1.name,2.email,3.pwd,4.friends和5.location



tbl_images页面有4列有< br $>


1. imageid,2。图片名称,3。位置,4。分享



分享我我在asp.net中使用复选框,如果我想与朋友分享照片,我会选中该复选框。图片将显示用户个人资料页面。

你可以建议我这样做的任何想法。



请帮我写在sql和asp.net代码中查询以将照片添加到面板中..



i have 2 tables like tbl_userprofile,tbl_images.
in tbl_userprofile page there are 5 colums are there,
1.name,2.email,3.pwd,4.friends,and 5.location

tbl_images page there are 4 columns are there

1. imageid, 2. Image name, 3. Location, 4. share

for sharing i am using checkbox in asp.net, if i want to share photos to my friends i will checked that check box. that images will display the user profile page.
can u please suggest me the any idea for to do this.

please help me write query in sql and asp.net code for to shate photos to friens..

推荐答案

表格中应该有一个ID列 tbl_userprofile ,应为 UserID



用于分享图像

制作另一张桌子 tbl_sharedImages

栏目如下所示。



1. imageID - 来自表tbl_images的图像ID

2. sharedBy - 共享用户的用户ID,在您的条款中选中复选框。

3. sharedTo - 您想要分享的朋友的用户ID 。您可以使用此列进行自定义共享,也可以在不需要时删除此列。我的意思是如果你想要将图片显示给所有人,那么就不要使用它,如果你有一些自定义共享的选项,那么你必须存储你想要分享的用户ID。

4. sharedDate - 图片共享的日期和时间。

5. modifiedDate - 如果对共享图片进行了任何修改。

6. isDeleted - 用于检查行是否存在的额外列。默认值为0。



这是最简单的实现。这可以根据您的要求进行修改。但这是你可以申请的概念。

如果有任何问题,请检查并告诉我。



[更新]



相册分享的新要求



对于相册共享,您需要执行以下数据库内容。



1。为相册创建新表

tbl_albums



Colums可能是 -

> albumID - 相册ID

> albumName - 相册名称

> createdBy - 正在创建的用户的ID

> createdOn - 专辑制作的日期时间

> updatedBy - 正在更新相册的用户的ID

> updatedOn - 相册更新时的日期时间

> isDeleted - 用于检查行是否存在的额外列。默认值为0。



2。为相册中的图像创建新表

tbl_albumImages



Colums可能是 -

> ID - 此表的主键。

> albumID - 相册ID

> imageID - 图片ID



3。为共享相册创建新表

tbl_sharedAlbums



列可能是 -

> ID - 此表的主键。

> albumID - 表格中的相册ID tbl_albums

> sharedBy - 共享用户的用户ID。

> sharedTo - 您想要分享的朋友的UserID。您可以使用此列进行自定义共享,也可以在不需要时删除此列。我的意思是,如果您希望将相册显示给所有人,则不要使用它,如果您有一些自定义共享选项,那么您必须存储您要共享的UserID。

> sharedDate - 共享相册的日期和时间。

> modifiedBy - 修改过的用户的用户ID。

> modifiedDate - 如果对共享相册进行了任何修改。

> isDeleted - 用于检查行是否存在的额外列。默认值为0总是。



在编码中你必须这样做。

< font face =verdanasize =2>

1.在创建相册时,在表 tbl_albums 和<$ c中插入行$ c> tbl_albumImages 。

2.点击共享相册按钮,你必须在表格中插入行 tbl_sharedAlbums

3.在显示用户的专辑时,您只需要浏览此表并将 sharedBy 列与当前用户ID匹配。

如果存在,则转到步骤4.

4.在步骤3中从 albumID 中获取记录然后,您可以从表 tbl_albums 获取相册详细信息。

5.获取相册详细信息后,您必须检查是否有任何记录(图片)存在于表 tbl_albumImages

如果存在,则转到步骤6.

6.获取相册的所有 imageID ,并从您那里获取图像详细信息r表 tbl_images 并显示在配置文件中。



[/ update]



谢谢......
You should have an ID column in table tbl_userprofile, which should be UserID.

For Sharing Images
Make another table tbl_sharedImages.
Columns will be like below.

1. imageID - ID of image from table tbl_images
2. sharedBy - UserID of user who is sharing, in your terms checking the checkbox.
3. sharedTo - UserID of friends you want to share. You can use this column for custom sharing or can remove this column if not needed. I mean if you want the picture to be shown to all then don''t use it, if you have some options for custom sharing, then you have to store the UserIDs to which you want to share.
4. sharedDate - Date and Time when the picture is shared.
5. modifiedDate - If any modification is done to the shared picture.
6. isDeleted - extra column for checking the existence of row. Default is 0 always.

This is the most simple implementation. This can be modified according to your requirements. But this is the concept which you can apply.
Please check and let me know if any questions.

[update]

New requirement of Album Sharing

For Album Sharing, you need do the below DataBase stuffs.

1. Create new table for Albums
tbl_albums

Colums may be -
> albumID - ID of Album
> albumName - Name of Album
> createdBy - ID of User who is creating
> createdOn - DateTime of Album Creation
> updatedBy - ID of User who is updating the album
> updatedOn - DateTime when Album got Updated
> isDeleted - extra column for checking the existence of row. Default is 0 always.

2. Create new table for Images in Albums
tbl_albumImages

Colums may be -
> ID - Primary key of this table.
> albumID - ID of Album
> imageID - ID of Image

3. Create new table for Sharing of Albums
tbl_sharedAlbums

Columns may be -
> ID - Primary key of this table.
> albumID - ID of album from table tbl_albums
> sharedBy - UserID of user who is sharing.
> sharedTo - UserID of friends you want to share. You can use this column for custom sharing or can remove this column if not needed. I mean if you want the album to be shown to all then don''t use it, if you have some options for custom sharing, then you have to store the UserIDs to which you want to share.
> sharedDate - Date and Time when the album is shared.
> modifiedBy - UserID of user who modified.
> modifiedDate - If any modification is done to the shared album.
> isDeleted - extra column for checking the existence of row. Default is 0 always.

In coding you have to do like below.

1. While the creation of Album, insert rows in tables tbl_albums and tbl_albumImages.
2. On clicking of share album button, you have to insert row to the table tbl_sharedAlbums.
3. While showing the albums of user, you just need to go through this table and match sharedBy column with the current UserID.
If exists then go for step-4.
4. Fetch the records in step-3 and from the albumID column, you can then get the album details from table tbl_albums.
5. After getting the album details, then you have to check if any records (pictures) exists in table tbl_albumImages.
If exists, then go for step-6.
6. Get all imageID for the album and fetch the image details from your table tbl_images and show in the Profile.

[/update]

Thanks...


这篇关于使用asp.net,C#.net,SQL server 2005将照片分享给朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆