zoukankan      html  css  js  c++  java
  • webQQ(腾讯)EmailTMessage(腾讯微博记事本)

    专题图编号:ylbtechOpenSource

    1,功能描述
     
    2,技术与环境

    操作系统:

    windows

    开发语言:

    C#

    开发框架:

     

    数据库:

    开发软件:

    Microsoft Visual Studio 2010

    开发技术:

     ASP.net

    项目组长:

    yuanbo

    成员:

    null

    个人主页:

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

    科研团队:

    ylbtech

    教研团队:

    ylbtech

    3,数据库设计
    use master
    go
    -- =============================================
    -- ylb:仿腾讯微博/记事本
    -- developmentTime:11:47 2012-04-24
    -- linkUrl:http://t.qq.com/messages/note.php
    -- =============================================
    
    IF EXISTS (SELECT * 
           FROM   master..sysdatabases 
           WHERE  name = N'TQQMessage')
        DROP DATABASE TQQMessage
    GO
    
    CREATE DATABASE TQQMessage
    GO
    
    use TQQMessage
    
    go
    -- =============================================
    -- ylb1,Note
    -- remark:记事本
    -- =============================================
    create table Note
    (
    noteId int primary key identity(100,1),        --编号[PK]
    content varchar(140),            --内容
    pubdate datetime default(getdate()),    --发布时间[DF]
    userId int                 --用户编号[FK]
    )
    go
    select *from Note
    
    -- =============================================
    -- ylbTestData
    -- =============================================
    go
    --1,发表一条
    insert into Note(content,userId) values('哦 知道别人在拒绝,只是你知道我是怎么样想的吗?不知道了。所以你才这样做。.',100)
    
    go
    --2,统计发表的数量,根据userId
    select count(*) from Note where userId=100
    
    go
    --3,查询记事本列表,根据userId
    select noteId,content,pubdate from Note
    where userId=100
    order by noteId desc
    
    go
    --4,修改一条记事,根据noteId
    update Note set content='newContent' where noteId=100
    
    go
    --5,删除记事,根据noteId
    delete Note where noteId=100
    4,功能截图

     4.1,前台

    4.1.1

    4.1.2

    5,代码分析

    5.1,前台

         /Note.aspx

    View Code
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Note.aspx.cs" Inherits="Note" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <link type="text/css" href="css/style_120419.css" />
        <style type="text/css">
            .mainmain{ margin:auto;}
            .main{ width:400px;  background-color:White; margin:auto; margin-top:30px; margin-bottom:30px}
            .left{ float:right;}
        </style>
        <script type="text/javascript" src="js/jquery-1.4.1.js"></script>
        <script type="text/javascript">
            //发送记事本
            var sendNote = function () {
                var data = { 
                type: 'add',
                content: $("#content").val() }
    
                $.post("DataMessage.aspx", data);
                //清空文本框
                $("#content").val("");
    
            }
            //2,删除一条信息
            var deleteNote = function (noteId) {
                var data = {
                    type: "delete",
                    noteId: noteId
                }
    
                $.post("DataMessage.aspx", data);
            }
            //3,修改一条信息
            var updateNote = function (noteId, content) {
                var data = {
                    type: 'update',
                    noteId: noteId,
                    content: content
                }
    
                $.post("DataMessage.aspx", data);
    
            }
        </script>
    </head>
    <body class="mainmain">
    <div class="main">
    <hr />
        <h3>记事本</h3>
        <hr />
        <div id="noteBox">
            <div>
                <textarea id="content" name="content" rows="3" style=" 396px"></textarea>
            </div>
            <div style="padding-right:20px; padding-left:20px;">
                
            <span class="left">&nbsp <input id="btnSendNote" type="button" value="发送" onclick="sendNote()" /></span>
            <span class="left">还能输入<em>140</em></span>
            </div>
        </div>
        <hr />
        <div>
        <h3>共有<span class="noteNum">0</span>条记事</h3>
        </div>
        <hr />
        <asp:Panel ID="pnlEmpty" runat="server">
        <div style=" margin:30px;">
        <strong>这里是微博宁静的一角,只留给自己</strong>
        </div>
        </asp:Panel>
        <asp:Panel ID="pnlFull" runat="server">
            <div class="listWrapper">
            <asp:Repeater ID="rptList" runat="server">
            <ItemTemplate>
            <div class="msgBox">
                    <div class="msgCnt">
                        蓝蓝的天,暖暖的阳光洒满大地。在树荫的一角坐着一个少年。看着翠绿的草、树枝,感受着生命的美好,思索着未来,对未来充满憧憬。</div>
                    <div class="pubTime">
                        <span class="time">1分钟前</span></div>
                    <p class="btnBox">
                        <a class="replyMsg btn" href="http://t.qq.com/messages/note.php#">修改</a>
                        <a class="btn delBtn" onclick='deleteNote(<%#Eval("noteId") %>)'
                            href="javascript:void(0)">删除</a></p>
                </div>
            </ItemTemplate>
            </asp:Repeater>
            </div>
        </asp:Panel>
    </div>
    
    </body>
    </html>

     /DataMessage.aspx 信息处理页面

    View Code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class DataMessage : System.Web.UI.Page
    {
        #region 记事本,异步操作方法
        /// <summary>
        /// 1,Add 
        /// </summary>
        /// <param name="userId"></param>
        private void Add(int userId)
        {
            string content = Request["content"];
            
            //Call Fun
            NoteOper.Add(content, userId);
    
        }
        /// <summary>
        /// 2,Delete
        /// </summary>
        private void Delete()
        {
            int noteId = Convert.ToInt32(Request["noteId"]);
    
            //Call Fun
            NoteOper.Delete(noteId);
        }
        /// <summary>
        /// 3,Update
        /// </summary>
        private void Update()
        {
            int noteId = Convert.ToInt32(Request["noteId"]);
            string content = Request["content"];
    
            //Call Fun
            NoteOper.Update(noteId, content);
        }
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            //布局全局变量
            int userId = 101;
    
            string type = Request["type"];
            //根据不同类别,调用不同方法
            switch (type)
            { 
                case "add":
    
                    Add(userId);
                    break;
                case "delete":
    
                    Delete();
                    break;
                case "update":
    
                    Update();
                    break;
    
            }
            Response.End();
        }
    }

    5.2,后台

    6,示例|讲解案例下载

    博客园讲解:  http://ylbtech.cnblogs.com/

    百度文库开发文档: http://passport.baidu.com/?business&aid=6&un=ylbtech#7

    谷歌开源代码下载: http://code.google.com/p/ylbtechopensource/downloads/list

    请单击“TQQMessage”

    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
    最终目标

     代码的国际化标准示例 ylb,tech”,最大程度地规范软件编程开发统一,优质, 高效,易学,为建设软件强国(中国)而努力。

     

  • 相关阅读:
    WPF 模拟UI 键盘录入
    rabbitmq使用dead letter机制来进行retry
    工厂设计模式
    python 内置速度最快算法(堆排)
    简单工厂设计模式
    杂类
    MorkDown 常用语法总结
    使用python列表推导式进行99乘法表
    linux 命令free -m 命令结果分析
    理解记忆三种常见字符编码:ASCII, Unicode,UTF-8
  • 原文地址:https://www.cnblogs.com/ylbtech/p/2670114.html
Copyright © 2011-2022 走看看