日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

ASP.net:仿QQ短信(QQ郵箱里面的功能)

 昵稱10504424 2012-09-10

ASP.net:仿QQ短信(QQ郵箱里面的功能)

專題圖編號:ylbtechOpenSource

1,功能描述

 仿QQ短信(QQ郵箱里面的功能),登錄,短息主界面,發(fā)信息,單個話題對話。

2,技術(shù)與環(huán)境

操作系統(tǒng):

windows

開發(fā)語言:

C#

開發(fā)框架:

 

數(shù)據(jù)庫:

SQLServer

開發(fā)軟件:

Microsoft Visual Studio 2010

開發(fā)技術(shù):

 ASP.net

項目組長:

yuanbo

成員:

null

個人主頁:

http://www.cnblogs.com/ylbtech/

科研團隊:

ylbtech

教研團隊:

ylbtech

 

3,數(shù)據(jù)庫設(shè)計

 

復(fù)制代碼
-- =============================================
-- ylb;仿QQ短信
-- development time:11:35 2012-04-18
-- =============================================
use master
go
IF EXISTS (SELECT *
FROM   master..sysdatabases
WHERE  name = N'QQMessage')
DROP DATABASE QQMessage
GO
CREATE DATABASE QQMessage
GO
use QQMessage
go
-- =============================================
-- ylb;1,Users
-- remark:用戶表
-- =============================================
create table Users
(
userId int primary key identity(100,1),    --編號[PK]
nickname varchar(200) not null,        --昵稱
userpass varchar(200) not null,        --密碼
headImage varchar(200),            --頭像地址
username varchar(200),            --備注姓名
flag int default(0) check(flag in(0,1))    --標識,flag=1,說明此用戶已注銷,0:正常
)
go
-- =============================================
-- ylb;2,Note
-- remark:短信表
-- =============================================
create table Message
(
msgId int primary key identity(200,1),    --編號[PK]
toUserId varchar(200) not null,        --收信人編號[FK]
content varchar(500) not null,        --發(fā)新內(nèi)容
pubdate datetime default(getdate()),    --發(fā)送時間
sendUserId int        --發(fā)送用戶編號[FK]

)
-- =============================================
-- ylb;3,Friend
-- remark:好友表
-- =============================================
create table Friend
(
userId int not null,    --用戶編號
friendId int not null    --用戶好友編號

)
print '數(shù)據(jù)創(chuàng)建成功!'
-- =============================================
-- ylb;仿QQ短信
-- development time:11:35 2012-04-18
-- =============================================
use QQMessage
go
--InsertData
insert into Users(nickname,userpass,headImage) values('sunshine','m123','default.jpg')
insert into Users(nickname,userpass,headImage) values('rain','m123','default.jpg')
insert into Users(nickname,userpass,headImage) values('lanchong','m123','default.jpg')
insert into Users(nickname,userpass,headImage) values('sun','m123','default.jpg')
select * from Users
go
--修改備注
update Users set username='袁博' where userId=102
go
--登錄
select count(*) from Users where userId=100 and userpass='m123'
go
--刪除一組會話
delete Message where toUserId=100 and sendUserId=101 or toUserId=101 and sendUserId=100
go
--1,發(fā)送信息
--1,outBox
insert into Message(toUserId,content,sendUserId) values(100,'I is sunshie',101)
--2,inBox
insert into Message(toUserId,content,sendUserId) values(101,'Who are you?',100)
insert into Message(toUserId,content,sendUserId) values(100,'sunshie',101)
go
--2,我的收信列表
--2_1,List
select userId,nickname,headImage,username from Users
where userId in(select sendUserId from Message where toUserId=100)
or userId in(select toUserId from Message where sendUserId=100)
go
--2_2,附屬最近的一條短信
select top 1 msgId,toUserId,content,pubdate,sendUserId from Message
where toUserId=100 and sendUserId=101 or toUserId=101 and sendUserId=100
order by msgId desc
--最新的回復(fù)
select top 1 content from Message where toUserId=101 and sendUserId=100
order by msgId desc
go
select userId,nickname,headImage,username from Users
where userId in(select sendUserId from Message where toUserId=100)
select userId,nickname,headImage,username,content from Users u left join Message m
on u.userId=m.toUserId
go
--3,單機看詳細
select * from Users
select * from Message
go
--3_1,獲取備注
select nickname from Users where userId=1
go
--3_2,獲取列表
select * from Users u left join Message m
on u.userId=m.toUserId
go
--結(jié)論
select userId,nickname,headImage,username,msgId,content,pubdate,sendUserId from Users u
left join Message m on u.userId=m.toUserId
where toUserId=100 and sendUserId=101 or toUserId=101 and sendUserId=100
復(fù)制代碼

 

4,功能截圖

 4.1,前臺

4.1.1  /SignIn.aspx

 

 

 

4.1.2  /Menu.aspx  短息主界面

 

4.1.3  /Write.aspx  寫短消息

4.1.4  /Detail.aspx  單個對話組

 

5,代碼分析

 解決方案屬性圖

5.1,前臺

5.1.1  /Handler/SendMsg.ashx

復(fù)制代碼
<%@ WebHandler Language="C#" Class="SendMsg" %>
using System;
using System.Web;
public class SendMsg : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
//發(fā)送短信
int toUserId = Convert.ToInt32(context.Request["toUserId"]);
int sendUserId = Convert.ToInt32(context.Request["sendUserId"]);
MessageInfo dal = new MessageInfo()
{
ToUserId = toUserId,
SendUserId = sendUserId,
Content = context.Server.UrlDecode(context.Request["content"])
};
//Call Fun
int id= MessageOper.Add(dal);
context.Response.Write(id+"");
}
public bool IsReusable {
get {
return false;
}
}
}
復(fù)制代碼

 5.2,后臺


 

6,示例|講解案例下載

博客園講解:  http://ylbtech.cnblogs.com/

百度文庫開發(fā)文檔: http://passport.baidu.com/?business&aid=6&un=ylbtech#7

谷歌開源代碼下載: http://code.google.com/p/ylbtechopensource/downloads/list

請單擊“ver1.1 QQMessage”

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多