开始

邮件管理通常用在各个内部系统中,为了方便快捷的使用现有的代码开发一个邮件管理系统而诞生的、

准备条件

这是我的设计表结构,大家一看就懂了

 
--邮件接收表
CREATE TABLE [dbo].[TAB_MAILSENDRESERVED](
[FID] [nvarchar](36) NULL,
[MAILGUID] [nvarchar](36) NULL,
[SENDUSERID] [nvarchar](36) NULL,--发送人
[RESERVEDUSERID] [nvarchar](36) NULL,--接收人
[SENDTIME] [datetime] NULL,
[sorttime] [int] identity(1,1) ,
[ISBACKMSG] [int] DEFAULT ((0)) ,
[STATUE] [int] DEFAULT ((0)),
[ISDELETE] [int] DEFAULT ((0)),
[SENDUSERNAME] [nvarchar](200) NULL,
[RESERVEDNAME] [nvarchar](200) NULL
)
 
--邮件主题表
CREATE TABLE [dbo].[TAB_MAIL](
[ID] [nvarchar](36) NULL,
[TITLE] [nvarchar](300) NULL,
[CONTENT] [text] NULL,
[ISATTACHFILE] [int] default(0) ,
[USINGCOUNT] [int] NULL
)
 
 
 
--邮件附件表
CREATE TABLE [dbo].[TAB_MAILFILES](
[FILEID] [nvarchar](36) NULL,
[FILEPATH] [nvarchar](100) NULL,
[FILETYPE] [nvarchar](10) NULL,
[FILESIZE] [nvarchar](10) NULL,
[USINGCOUNT] [int] default(0) ,--这个很重要(判断当前多少用户使用该附件,最后一个删除邮件主体数据的才能物理删除该附件)
[FILENAMES] [nvarchar](200) NULL
)
 
 

现在只需要一个用户表中一个ID字段或者UserID字段。

截图:

  地址在这里:http://10086bank.com/  里面的”邮件“

界面截图:(写新邮件,收件箱,发件箱,回收站之间可以拖动顺序) 界面打开默认获取收件箱数据。 如图:

支持自己给自己发邮件,定时发送邮件。

前端JS

var userid = 1002; //test demo using value
var filepath = []; //路径
var filename = []; //名称
var filesize = []; //大小
var ckidlist = []; //判断是否存在
var pagesizeindex = "", persize = 5;
var gettype = 0; //0收件箱/1发件箱/2回收站 $(function () {
$("#WNewEmail").hide(); //新邮件框隐藏
$("#divsysmsg").hide(); //提示框
$("myModalA").hide(); //选择人list
$("#DivViewDT").hide(); //邮件详情 jQuery("#divall").validationEngine(); //验证
jQuery("#divpeoplelistitle").validationEngine(); //验证 //写新邮件
$("#newemialdiv").click(function () {
$("#WNewEmail").show();
$("#divshow").hide(); //关闭列表
$("#DivViewDT").hide(); $("#inputSendobj").val(""); //选人id
$("#inputSendobjName").val(""); //选人name
$("#date01").val(""); //标题
$("#textarea2").val("")//内容
$("#lablefile").html(""); //显示附件名称 filename = [];
filepath = [];
filesize = []; $("#FilelistTbody").html(""); //clear files
$("#MailFileList2").hide(); $("body[style='margin:4px; font:10pt Arial,Verdana; cursor:text']").html("<br _moz_editor_bogus_node='TRUE'></br>"); });
//取消写新邮件
$("#btnclosedffsdfla").click(function () {
$("#WNewEmail").hide();
$("#divmaillist").show();
});
//关闭写新邮件
$("#btncanceldiv").click(function () {
$("#WNewEmail").hide();
$("#divmaillist").show();
});
//关闭列表
$("#close").click(function () {
$("#divshow").hide();
});
//modal show 选择发送人员
$("#inputSendobjName").click(function () {
$("#myModalA").modal("show");
scname = "scname";
GetOrgName($("#searchpeopletxt").val());
});
//文本框查找机构
$("#searchpeopletxt").keyup(function () {
GetOrgName($("#searchpeopletxt").val());
});
//关闭详细 显示列表
$("#A4close").click(function () {
$("#DivViewDT").hide();
$("#divmaillist").show();
});
//check 选择人员提交
$("#lasure").click(function () { var inputSendobjName = "";
ckidlist = []; $("#inputSendobj").val("");
var ob = $("input[name='checkboxA']");
$(ob).each(function () {
if ($(this).attr("checked") == "checked") {
$("#inputSendobj").val($("#inputSendobj").val() + $(this).attr("id") + ","); ckidlist.push($(this).attr("id")); inputSendobjName = inputSendobjName + $(this).attr("myname") + ",";
}
});
if ($("#inputSendobj").val() != "") {
$("#inputSendobj").val($("#inputSendobj").val().substr(0, $("#inputSendobj").val().length - 1));
inputSendobjName = inputSendobjName.substr(0, inputSendobjName.length - 1);
}
$("#inputSendobjName").val(inputSendobjName);
$("#Checkboxall").attr("checked", false);
});
//全选
$("#Checkboxall").click(function () {
if ($("#Checkboxall").attr("checked") == "checked") {
var objall = $("input[name = 'checkboxA']");
$(objall).each(function () {
$(this).attr("checked", true);
})
return;
}
else {
var objall = $("input[name = 'checkboxA']");
$(objall).each(function () {
$(this).attr("checked", false);
})
return;
}
});
//反选
$("#Checkboxback").click(function () {
if ($("#Checkboxback").attr("checked") == "checked") {
var objall = $("input[name = 'checkboxA']");
$(objall).each(function () {
if ($(this).attr("checked") == "checked")
$(this).attr("checked", false);
})
return;
}
else {
var objall = $("input[name = 'checkboxA']");
$(objall).each(function () {
if ($(this).attr("checked") == false)
$(this).attr("checked", true);
})
return;
}
});
//提交新邮件
$("#btnsavedata").click(function () { if (!jQuery('#divall').validationEngine('validate')) {
return;
} if ($("#inputSendobj").val() == "") { alert("请选择收件人"); return false; } var para = {
"topeople": $("#inputSendobj").val(),
"title": $("#date01").val(),
"content": encodeURIComponent($("#textarea2").val()),
"filepath": filepath.toString(),
"filename": filename.toString(),
"filesize": filesize.toString(),
"type": "addmsg",
"ttime": $("#txtsendtime").val() + " " + $("#txthour").val() + ":" + $("#txtmini").val() + ":00",
"userid": userid
}; $.post("userajax/Mail.aspx", para, function (data) {
$("#inputSendobj").val(""); //选人
$("#date01").val(""); //标题
$("#textarea2").val("")//内容
$("#lablefile").html(""); //显示附件名称 filename = [];
filepath = [];
filesize = []; pagesizeindex = "";
GetSendBox();
}) });
$("#btnmore").click(function () {
if (gettype == 0)
GetResBox();
else if (gettype == 1)
GetSendBox();
else if (gettype == 2)
GetRebBox();
}) //发
$("#A1").click(function () {
pagesizeindex = "";
GetSendBox();
});
//收
$("#A2").click(function () {
pagesizeindex = "";
GetResBox();
});
//回
$("#A3").click(function () {
pagesizeindex = "";
GetRebBox();
}); //发
function GetSendBox() {
$("#thlable009").html("收件人");
gettype = 1;
$("#DivViewDT").hide();
$("#divmaillist").show(); if (pagesizeindex == "")
$("#datalist").html(""); $("#WNewEmail").hide();
$("#divshow").show();
$("#hlistname").html("<i class='icon-user'></i>发件箱"); $.post("userajax/Mail.aspx", { "type": "getmysenddata", "userid": userid, "searchtype": "1", "pagesizeindex": pagesizeindex }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == null || data == "no" || data == "") { $("#datainfoa").html("无数据!"); $("#btnmore").hide(); return; }
$("#datainfoa").html(""); var objresult = $.parseJSON(data); if (objresult == null) {
$("#btnmore").hide();
return;
} pagesizeindex = objresult[objresult.length - 1].sorttime; if (objresult.length < persize)
$("#btnmore").hide();
else
$("#btnmore").show(); for (var i = 0; i < objresult.length; i++) {
$("#datalist").append("<tr id='TRList" + objresult[i].sorttime + "'><td>" + objresult[i].RESERVEDNAME + "</td><td class='center'>" + objresult[i].SENDTIME + "</td><td class='center'>" + objresult[i].TITLE + "</td><td class='center'><span class='label label-important'>" + "已发送" + "</span></td><td>" + (objresult[i].ISATTACHFILE == '1' ? "<span class='icon32 icon-color icon-link' title='.icon32 .icon-color .icon-link ' onclick=maildo('file','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')></span>" : " ") + "</td><td class='center'><table border='0'><tr border='0'><td><a class='btn btn-success' onclick=maildo('view','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-zoom-in icon-white'></i> 查看</a></td><td><a class='btn btn-info' onclick=maildo('forw','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-edit icon-white'></i> 转发</a></td><td><a class='btn btn-danger' onclick=maildo('deleteoutbox','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-trash icon-white'></i> 删除</a></td></tr></table></td></tr>");
}
})
} //收
function GetResBox() {
$("#thlable009").html("发件人");
gettype = 0;
$("#DivViewDT").hide();
$("#divmaillist").show(); if (pagesizeindex == "")
$("#datalist").html(""); $("#WNewEmail").hide();
$("#divshow").show();
$("#hlistname").html("<i class='icon-user'></i>收件箱"); $.post("userajax/Mail.aspx", { "type": "getmysenddata", "userid": userid, "searchtype": "0", "pagesizeindex": pagesizeindex }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == null || data == "no" || data == "") { $("#datainfoa").html("无数据!"); $("#btnmore").hide(); return; }
$("#datainfoa").html("");
var objresult = $.parseJSON(data); if (objresult == null) {
$("#btnmore").hide();
return;
} pagesizeindex = objresult[objresult.length - 1].sorttime; if (objresult.length < persize)
$("#btnmore").hide();
else
$("#btnmore").show(); for (var i = 0; i < objresult.length; i++) {
$("#datalist").append("<tr id='TRList" + objresult[i].sorttime + "'><td>" + objresult[i].SENDUSERNAME + "</td><td class='center'>" + objresult[i].SENDTIME + "</td><td class='center'>" + objresult[i].TITLE + "</td><td class='center'>" + (objresult[i].STATUE == "0" || objresult[i].STATUE == 0 ? "<span class='label label-important'>" : "<span class='label'>") + "" + (objresult[i].STATUE == "0" || objresult[i].STATUE == 0 ? "新邮件" : "已读") + "</span></td><td>" + (objresult[i].ISATTACHFILE == '1' ? "<span class='icon32 icon-color icon-link' title='.icon32 .icon-color .icon-link ' onclick=maildo('file','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')></span>" : " ") + "</td><td class='center'><table border='0'><tr border='0'><td><a class='btn btn-success' onclick=maildo('view','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-zoom-in icon-white'></i> 查看</a></td><td><a class='btn btn-info' onclick=maildo('forw','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-edit icon-white'></i> 转发</a></td><td><a class='btn btn-danger' onclick=maildo('deleteinbox','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-trash icon-white'></i> 删除</a></td></tr></table></td></tr>");
}
})
} //回
function GetRebBox() {
$("#thlable009").html("收件人");
gettype = 2;
$("#DivViewDT").hide();
$("#divmaillist").show(); if (pagesizeindex == "")
$("#datalist").html(""); $("#WNewEmail").hide();
$("#divshow").show();
$("#hlistname").html("<i class='icon-user'></i>回收站"); $.post("userajax/Mail.aspx", { "type": "getmysenddata", "userid": userid, "searchtype": "2", "pagesizeindex": pagesizeindex }, function (data) { if (data == "-999") { alert("登录失效.请重新登录!"); return false; } if (data == null || data == "no" || data == "") { $("#datainfoa").html("无数据!"); $("#btnmore").hide(); return; } $("#datainfoa").html("");
var objresult = $.parseJSON(data); if (objresult == null) {
$("#btnmore").hide();
return;
} pagesizeindex = objresult[objresult.length - 1].sorttime; if (objresult.length < persize)
$("#btnmore").hide();
else
$("#btnmore").show(); for (var i = 0; i < objresult.length; i++) {
$("#datalist").append("<tr id='TRList" + objresult[i].sorttime + "'><td>" + objresult[i].RESERVEDNAME + "</td><td class='center'>" + objresult[i].SENDTIME + "</td><td class='center'>" + objresult[i].TITLE + "</td><td class='center'><span class='label'>已进回收站</span></td><td>" + (objresult[i].ISATTACHFILE == '1' ? "<span class='icon32 icon-color icon-link' title='.icon32 .icon-color .icon-link ' onclick=maildo('filedelete','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')></span>" : " ") + "</td><td class='center'><table border='0'><tr border='0'><td><a class='btn btn-success' onclick=maildo('backview','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-zoom-in icon-white'></i> 还原</a></td><td><a class='btn btn-danger' onclick=maildo('deleteon','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-trash icon-white'></i> 彻底删除</a></td></tr></table></td></tr>");
}
})
} load(); //页面加载 默认显示收件箱
function load() {
GetResBox();
} //删除附件(多个)
$("#spdelete").click(function () {
if (confirm("确定删除吗?") == false) return; if (ismyupload == 0) { filename = []; filepath = []; filesize = []; $("#spdelete").hide(); $("#lablefile").html(""); return; }
$.post("userajax/Mail.aspx", { "type": "deletefile", "pathlist": filepath.toString() }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == "1")
$("#spdelete").hide();
$("#lablefile").html("");
})
}) /*
// 文件上传 ------------------------- begin(华丽的分隔符) ---------------------------
var button = $('#adlaimgFile'), interval;
new AjaxUpload(button, {
action: 'userajax/FileMail.ashx',
name: 'imgFile',
onSubmit: function (file, ext) {
this.disable();
interval = window.setInterval(function () {
var text = button.text();
}, 200);
},
onComplete: function (file, response) {
window.clearInterval(interval);
this.enable();
response = response.replace(/<pre>/ig, "").replace(/<\/pre>/ig, ""); //过滤
var obj = $.parseJSON(response);
if (obj[0].filetruename == "ferror") { alert("该文件类型不允许上传!"); return false; }
if (obj[0].filetruename == "big") { alert("文件过大!"); return false; }
filename.push(obj[0].filetruename);
filepath.push(obj[0].filepath);
filesize.push(obj[0].filesize); LoadJSFile();
}
});
*/ // window.onload = load(); //默认加载收件箱数据
})
//dom end //标识是否为自己上传变量
var ismyupload = 1; //加载列表
function LoadJSFile() {
$("#FilelistTbody").html(""); if (filename.length > 0) {
$("#MailFileList2").show();
}
else {
$("#MailFileList2").hide();
return;
}
for (var i = 0; i < filename.length; i++)
$("#FilelistTbody").append("<tr id='trf" + i + "'><td>" + filename[i] + "</td><td class='center'>" + filesize[i] + "k </td><td class='center'>" + filename[i].substr(filename[i].lastIndexOf(".") + 1) + "</td><td class='center'><span class='icon icon-color icon-close' onclick=deleteBypath('" + encodeURIComponent(filepath[i]) + "','" + i + "')> </span></td></tr>");
} //删除单个附件
function deleteBypath(id, i) {
if(confirm("确定删除吗?")==false)return; //不能删除邮件转发的附件
if (ismyupload == 0) {
filename.pop(i);
filepath.pop(i);
filesize.pop(i);
$("#trf" + i).remove();
if (filename.length < 1)
$("#MailFileList2").hide();
else
$("#MailFileList2").show();
return;
}
//物理删除
$.post("userajax/Mail.aspx", { "type": "deletefileone", "pathlist": id }, function (data) {
if(data=="-999"){alert("登录失效.请重新登录!");return false;}
if (data == "1")
$("#trf" + i).remove();
filename.pop(i);
filepath.pop(i);
filesize.pop(i);
if (filename.length < 1)
$("#MailFileList2").hide();
else
$("#MailFileList2").show();
})
} //function for button
function maildo(type, id,num) {
//收件箱删除 伪删除
if (type == "deleteinbox") {
if (confirm("确定删除吗?") == false) return;
$.post("userajax/Mail.aspx", { "type": "deleteinbox", "userid": userid, "idlist": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
$("#TRList" + num).remove();
MSG();
//pagesizeindex = "";
//GetResBox();
});
}
//发件箱删除 伪删除
else if (type == "deleteoutbox") {
if (confirm("确定删除吗?") == false) return;
$.post("userajax/Mail.aspx", { "type": "deleteoutbox", "userid": userid, "idlist": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
$("#TRList" + num).remove();
MSG();
//pagesizeindex = "";
//GetSendBox();
});
}
//回收站返回
else if (type == "backview") {
$.post("userajax/Mail.aspx", { "type": "backview", "userid": userid, "idlist": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
$("#TRList" + num).remove();
MSG();
//pagesizeindex = "";
//GetRebBox();
});
}
//回收站彻底删除
else if (type == "deleteon") {
if (confirm("确定删除吗?") == false) return;
$.post("userajax/Mail.aspx", { "type": "deleteon", "userid": userid, "idlist": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
$("#TRList" + num).remove();
MSG();
//pagesizeindex = "";
//GetRebBox();
});
}
//查看邮件
else if (type == "view") {
$("#DivViewDT").show();
$.post("userajax/Mail.aspx", { "type": "view", "userid": userid, "idlist": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; } // if ($("#TRList" + id).html().toString().indexOf('新邮件') > -1)
// $("#TRList" + id).html($("#TRList" + id).html().replace("label label-important", "label").replace("新邮件", "已读")); $("#divmaillist").hide();
$("#DivViewDT").show(); var obj = $.parseJSON(data); $("#ViewTitle").html("邮件主题:" + obj[0].TITLE);
$("#sendlable").html("发送人:" + obj[0].SENDUSERNAME);
$("#reserveduname").html("接收人:" + obj[0].RESERVEDNAME);
$("#sendtime").html("发送时间:" + obj[0].SENDTIME); $("#contentlable").html(decodeURIComponent(obj[0].CONTENT));
MSG(); });
//附件
$("#Tbodyfilelistview").html("");
$.post("userajax/Mail.aspx", { "type": "file", "id": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == null || data == "no" || data == "") { $("#Afileresult").html("无附件!"); $("#tablefilelist").hide(); return; }
$("#Afileresult").html("");
$("#tablefilelist").show();
var obj = $.parseJSON(data);
for (var i = 0; i < obj.length; i++) {
$("#Tbodyfilelistview").append("<tr><td><a target='_blank' href='Ajax/" + obj[i].FILEPATH + "'>" + obj[i].FILENAME + "</a></td><td class='center'>" + obj[i].FILESIZE + "k </td><td class='center'>" + obj[i].FILETYPE + "</td><td class='center'><span class='label label-success'> <i class='icon-download' onclick=downloadfile('" + obj[i].FILEPATH + "')></i> </span></td></tr>");
}
})
}
//转发
else if (type == "forw") {
$("#divmaillist").hide();
$("#WNewEmail").show(); $("#inputSendobj").val("");
ismyupload = 0; //控制不能删除别人附件
filename = []; filepath = []; filesize = []; //转发带附件的邮件
$.post("userajax/Mail.aspx", { "type": "file", "id": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == null || data == "no" || data == "") { $("#lablefile").html(""); return; }
$("#lablefile").html("");
var obj = $.parseJSON(data);
for (var i = 0; i < obj.length; i++) {
filename.push(obj[i].FILENAME);
filepath.push(obj[i].FILEPATH);
filesize.push(obj[i].FILESIZE);
}
LoadJSFile();
}) $.post("userajax/Mail.aspx", { "type": "view", "userid": userid, "idlist": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; } // if ($("#TRList" + id).html().toString().indexOf('新邮件') > -1)
// $("#TRList" + id).html($("#TRList" + id).html().replace("label label-important", "label").replace("新邮件", "已读")); var obj = $.parseJSON(data); $("#date01").val(obj[0].TITLE); $("#textarea2").val(decodeURIComponent(obj[0].CONTENT)); MSG();
})
}
//附件
else if (type == "filedelete" || type == "file") {
if (type == "filedelete") { alert("回收站中无法查看附件!"); return; }
$("#DivFiles").modal("show");
$("#FileListdata").html("");
$.post("userajax/Mail.aspx", { "type": "file", "id": id }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == null || data == "no" || data == "") { $("#fileinfoa").html("无数据!"); return; }
$("#fileinfoa").html("");
var obj = $.parseJSON(data);
for (var i = 0; i < obj.length; i++) {
$("#FileListdata").append("<tr><td><a target='_blank' href='Ajax/" + obj[i].FILEPATH + "'>" + obj[i].FILENAME + "</a></td><td class='center'>" + obj[i].FILESIZE + "k </td><td class='center'>" + obj[i].FILETYPE + "</td><td class='center'><span class='label label-success'> <i class='icon-download' onclick=downloadfile('" + obj[i].FILEPATH + "')></i> </span></td></tr>");
}
})
}
} //下载
function downloadfile(fpath) {
$.post("Ajax/Floor.aspx", { "type": "existsfile", "filep": fpath }, function (data) {
if (data == "noyes") {
alert("文件不存在!");
return;
}
else
window.open("Ajax/" + fpath);
//location.href = "Ajax/" + fpath;
});
} //消息提示框
function MSG() {
$("#divsysmsg").show();
setInterval("$('#divsysmsg').hide();", 2000);
}
//获取名称
var scname="scname";
function GetOrgName(name) { if(scname==name){return;}
scname=name; if (name == "'" || name == "," || name == "!" || name == '"') { $("#acount").html("非法字符!"); return; } //过滤字符
$("#divchecklist").html("");
$("#imgprogress").show();
$("#acount").html(""); $.ajax({
url: "userajax/Mail.aspx",
data: { "type": "getorgname", "searchval": name },
type: "POST",
beforsend: function () { },
success: function (a) {
setInterval("$('#imgprogress').hide();", 1500);
if (a == "-999") { alert("登录失效.请重新登录!"); return false; }
if (a == "no") { $("#acount").html("0条结果"); return false; } //无数据
var obj = $.parseJSON(a);
$("#acount").html(obj.length + "条结果"); //get counts number
for (var i = 0; i < obj.length; i++) { if (exists(obj[i].USERID) == true)
$("#divchecklist").append("<p><input checked='checked' type='checkbox' myname='" + obj[i].MYUSERNAME + "' name='checkboxA' id='" + obj[i].USERID + "' />" + obj[i].MYUSERNAME + "</p>");
else
$("#divchecklist").append("<p><input type='checkbox' myname='" + obj[i].MYUSERNAME + "' name='checkboxA' id='" + obj[i].USERID + "' />" + obj[i].MYUSERNAME + "</p>");
}
}
})
} //判断是否选中该数据
function exists(id) {
for (var i = 0; i < ckidlist.length; i++) {
if (ckidlist[i] == id)
return true;
}
return false;
} //发
function GetSendBox() {
$("#thlable009").html("收件人");
gettype = 1;
$("#DivViewDT").hide();
$("#divmaillist").show(); if (pagesizeindex == "")
$("#datalist").html(""); $("#WNewEmail").hide();
$("#divshow").show();
$("#hlistname").html("<i class='icon-user'></i>发件箱"); $.post("userajax/Mail.aspx", { "type": "getmysenddata", "userid": userid, "searchtype": "1", "pagesizeindex": pagesizeindex }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == null || data == "no" || data == "") { $("#datainfoa").html("无数据!"); $("#btnmore").hide(); return; }
$("#datainfoa").html(""); var objresult = $.parseJSON(data); if (objresult == null) {
$("#btnmore").hide();
return;
} pagesizeindex = objresult[objresult.length - 1].sorttime; if (objresult.length < persize)
$("#btnmore").hide();
else
$("#btnmore").show(); for (var i = 0; i < objresult.length; i++) {
$("#datalist").append("<tr id='TRList" + objresult[i].sorttime + "'><td>" + objresult[i].RESERVEDNAME + "</td><td class='center'>" + objresult[i].SENDTIME + "</td><td class='center'>" + objresult[i].TITLE + "</td><td class='center'><span class='label label-important'>" + "已发送" + "</span></td><td>" + (objresult[i].ISATTACHFILE == '1' ? "<span class='icon32 icon-color icon-link' title='.icon32 .icon-color .icon-link ' onclick=maildo('file','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')></span>" : " ") + "</td><td class='center'><table border='0'><tr border='0'><td><a class='btn btn-success' onclick=maildo('view','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-zoom-in icon-white'></i> 查看</a></td><td><a class='btn btn-info' onclick=maildo('forw','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-edit icon-white'></i> 转发</a></td><td><a class='btn btn-danger' onclick=maildo('deleteoutbox','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-trash icon-white'></i> 删除</a></td></tr></table></td></tr>");
}
})
} //收
function GetResBox() {
$("#thlable009").html("发件人");
gettype = 0;
$("#DivViewDT").hide();
$("#divmaillist").show(); if (pagesizeindex == "")
$("#datalist").html(""); $("#WNewEmail").hide();
$("#divshow").show();
$("#hlistname").html("<i class='icon-user'></i>收件箱"); $.post("userajax/Mail.aspx", { "type": "getmysenddata", "userid": userid, "searchtype": "0", "pagesizeindex": pagesizeindex }, function (data) {
if (data == "-999") { alert("登录失效.请重新登录!"); return false; }
if (data == null || data == "no" || data == "") { $("#datainfoa").html("无数据!"); $("#btnmore").hide(); return; }
$("#datainfoa").html("");
var objresult = $.parseJSON(data); if (objresult == null) {
$("#btnmore").hide();
return;
} pagesizeindex = objresult[objresult.length - 1].sorttime; if (objresult.length < persize)
$("#btnmore").hide();
else
$("#btnmore").show(); for (var i = 0; i < objresult.length; i++) {
$("#datalist").append("<tr id='TRList" + objresult[i].sorttime + "'><td>" + objresult[i].SENDUSERNAME + "</td><td class='center'>" + objresult[i].SENDTIME + "</td><td class='center'>" + objresult[i].TITLE + "</td><td class='center'>" + (objresult[i].STATUE == "0" || objresult[i].STATUE == 0 ? "<span class='label label-important'>" : "<span class='label'>") + "" + (objresult[i].STATUE == "0" || objresult[i].STATUE == 0 ? "新邮件" : "已读") + "</span></td><td>" + (objresult[i].ISATTACHFILE == '1' ? "<span class='icon32 icon-color icon-link' title='.icon32 .icon-color .icon-link ' onclick=maildo('file','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')></span>" : " ") + "</td><td class='center'><table border='0'><tr border='0'><td><a class='btn btn-success' onclick=maildo('view','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-zoom-in icon-white'></i> 查看</a></td><td><a class='btn btn-info' onclick=maildo('forw','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-edit icon-white'></i> 转发</a></td><td><a class='btn btn-danger' onclick=maildo('deleteinbox','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-trash icon-white'></i> 删除</a></td></tr></table></td></tr>");
}
})
} //回
function GetRebBox() {
$("#thlable009").html("收件人");
gettype = 2;
$("#DivViewDT").hide();
$("#divmaillist").show(); if (pagesizeindex == "")
$("#datalist").html(""); $("#WNewEmail").hide();
$("#divshow").show();
$("#hlistname").html("<i class='icon-user'></i>回收站"); $.post("userajax/Mail.aspx", { "type": "getmysenddata", "userid": userid, "searchtype": "2", "pagesizeindex": pagesizeindex }, function (data) { if (data == "-999") { alert("登录失效.请重新登录!"); return false; } if (data == null || data == "no" || data == "") { $("#datainfoa").html("无数据!"); $("#btnmore").hide(); return; } $("#datainfoa").html("");
var objresult = $.parseJSON(data); if (objresult == null) {
$("#btnmore").hide();
return;
} pagesizeindex = objresult[objresult.length - 1].sorttime; if (objresult.length < persize)
$("#btnmore").hide();
else
$("#btnmore").show(); for (var i = 0; i < objresult.length; i++) {
$("#datalist").append("<tr id='TRList" + objresult[i].sorttime + "'><td>" + objresult[i].RESERVEDNAME + "</td><td class='center'>" + objresult[i].SENDTIME + "</td><td class='center'>" + objresult[i].TITLE + "</td><td class='center'><span class='label'>已进回收站</span></td><td>" + (objresult[i].ISATTACHFILE == '1' ? "<span class='icon32 icon-color icon-link' title='.icon32 .icon-color .icon-link ' onclick=maildo('filedelete','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')></span>" : " ") + "</td><td class='center'><table border='0'><tr border='0'><td><a class='btn btn-success' onclick=maildo('backview','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-zoom-in icon-white'></i> 还原</a></td><td><a class='btn btn-danger' onclick=maildo('deleteon','" + objresult[i].ID + "," + objresult[i].FID + "','" + objresult[i].sorttime + "')><i class='icon-trash icon-white'></i> 彻底删除</a></td></tr></table></td></tr>");
}
})
}

底层实现

(分条数获取数据)

object obj = Request.Form.Get("type");

        if (obj == null || obj.ToString() == "") { Response.Write("error"); Response.End(); }

        //收件箱 发件箱 回收站
if (obj.ToString() == "getmysenddata")
Response.Write(getmysenddata(Common.GetUserCode(), int.Parse(Request.Form.Get("searchtype")), Request.Form.Get("pagesizeindex")));
//收件箱删除
else if (obj.ToString() == "deleteinbox")
Response.Write(deletevirtual(Common.GetUserCode(), Request.Form.Get("idlist")).ToString());
//发件箱删除
else if (obj.ToString() == "deleteoutbox")
Response.Write(deletevirtual(Common.GetUserCode(), Request.Form.Get("idlist"), ).ToString());
//还原
else if (obj.ToString() == "backview")
Response.Write(UpdateToBackBox(Request.Form.Get("idlist")).ToString());
//彻底删除
else if (obj.ToString() == "deleteon")
Response.Write(deleteon(Request.Form.Get("idlist")).ToString());
//查看
else if (obj.ToString() == "view")
Response.Write(UpdateNumStatue(Request.Form.Get("idlist")));
//发送新邮件
else if (obj.ToString() == "addmsg")
Response.Write(AddMsg() + "");
//查看附件
else if (obj.ToString() == "file")
Response.Write(GetOneMailFiles(Request.Form.Get("id")));
//删除自己上传的附件
else if (obj.ToString() == "deletefile")
Response.Write(DeleteFileByMyself(Request.Form.Get("pathlist")).ToString());
//删除自己上传的附件
else if (obj.ToString() == "deletefileone")
Response.Write(DeleteFileByMyself(Request.Form.Get("pathlist"), ).ToString());
//获取机构名称
else if (obj.ToString() == "getorgname")
Response.Write(GetOrganizationName());
//查询用户消息
else if (obj.ToString() == "getusernews")
Response.Write(GetNewsByNotRead(Common.GetUserCode()));

最后

需要源码的进入:http://10086bank.com/   点击邮件进入底部下载即可。

人一辈子不会因为你做了什么而后悔,只会因为你没做什么而后悔。

2014年,不平凡的一年。

END

Jquery+Ajax+asp.net+sqlserver-编写的通用邮件管理(源码)的更多相关文章

  1. Jquery+Ajax+asp.net+sqlserver-编写的通用邮件管理(有源码)

    开始 邮件管理通常用在各个内部系统中,为了方便快捷的使用现有的代码开发一个邮件管理系统而诞生的. 准备条件 这是我的设计表结构,大家一看就懂了 --邮件接收表CREATE TABLE [dbo].[T ...

  2. Net 通用权限管理系统源码 带数据库设计文档,部署说明文档

    Net 通用权限管理系统源码 带数据库设计文档,部署说明文档 包括数据库设计文档部署安装文档源码数据库文件 下载地址:http://www.mallhd.com/archives/1389

  3. ASP.NET程序读取二代身份证(附源码)

    原文:ASP.NET程序读取二代身份证(附源码) 一般来说winform应用程序解决这个问题起来时很容易的,web应用程序就麻烦一点了. 这里我说说我的解决思路: 一.你必要有联机型居民身份证阅读器一 ...

  4. Asp.net MVC - 使用PRG模式(附源码)

    阅读目录: 一. 传统的Asp.net页面问题 二.Asp.net MVC中也存在同样的问题 三.使用PRG模式 四.PRG模式在MVC上的实现 一. 传统的Asp.net页面问题 一个传统的Asp. ...

  5. asp+jquery+ajax,asp后台程序执行不正常

    项目中前台页面通过jquery .ajax功能将关键数据传递到后台并写入数据库,调试中发现后台程序一直没有正常执行,后反复排查 发现asp程序中不能包含#include file语句

  6. jQuery ajax的前台代码编写

    jQuery ajax的前台代码: <script type="text/javascript" src="/include/jquery/jquery-1.1.3 ...

  7. jquery自定义插件结合baiduTemplate.js实现异步刷新(附源码)

    上一篇记录了BaiduTemplate模板引擎使用示例附源码,在此基础上对使用方法进行了封装 自定义插件jajaxrefresh.js 代码如下: //闭包限定命名空间 (function ($) { ...

  8. 使用MiniProfiler给Asp.net MVC和Entity Framework号脉(附源码)

    在学习python开发框架pylons/pyramid的过程中,里面有个非常棒的页面性能监控功能,这样在开发过程中,你能清楚的知道当前页面的性能以及其它参数. 这里介绍一下如何给Asp.net MVC ...

  9. 使用ajax方法实现form表单的提交(附源码)

    写在前面的话 在使用form表单的时候,一旦点击提交触发submit事件,一般会使得页面跳转,页面间的跳转等行为的控制权往往在后端,后端会控制页面的跳转及数据传递,但是在某些时候不希望页面跳转,或者说 ...

随机推荐

  1. jquery中使用each遍历。

    一直知道each这个方法,但是就是不太明白到底怎么用,今天两个地方都使用了each.真的太高兴了,太有成就感了. 东钿微信平台订单列表页 全部订单之前是按照产调,评估,借款的顺序依次排下来,华总说要按 ...

  2. Python3中requests库学习01(常见请求示例)

    1.请求携带参数的方式1.带数据的post data=字典对象2.带header的post headers=字典对象3.带json的post json=json对象4.带参数的post params= ...

  3. 两个div并列居中显示——当display:inline-block;时,两个div无法对齐即一高一矮

    解决办法: 给div添加样式vertical-align: top;

  4. js操作文档对象的节点

    好吧,为了能让大家不至于睡着,我们先回顾先前面的东东吧~ 1.首先我们写了javaScriput的是一门弱类型的解释性的脚本语言:弱类型:我们的变量不用申明其具体的数据类型,在使用的时候浏览器根据其存 ...

  5. 洛谷 P2895 [USACO08FEB]流星雨Meteor Shower

    题目描述 Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will ...

  6. 【TensorFlow入门完全指南】神经网络篇·自动编码机

    自动编码机(Autoencoder)属于非监督学习,不需要对训练样本进行标记.自动编码机(Autoencoder)由三层网络组成,其中输入层神经元数量与输出层神经元数量相等,中间层神经元数量少于输入层 ...

  7. 卓越管理的秘密(Behind Closed Doors)

    或许提到本书甚至本书的作者Johanna Rothman我们会感到些许陌生,那么提起她的另一本获得素有软件界奥斯卡之称的Jolt生产效率大奖的名著<项目管理修炼之道>,会不会惊讶的发现,原 ...

  8. tpcc-mysql运行结果解读

    前言 首先我们需要知道tpcc-mysql是干什么的.TPC-C是专门针对联机交易处理系统(OLTP系统)的规范,一般情况下我们也把这类系统称为业务处理系统.tpcc-mysql是percona基于T ...

  9. 用dfs求解八皇后问题

    相信大家都已经很熟悉八皇后问题了,就是指:在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行.同一列或同一斜线上,问有多少种摆法.主要思路:按行进行深度优先搜索,在该 ...

  10. python 产生随机数

    Python中的random模块用于生成随机数.下面介绍一下random模块中最常用的几个函数. random.random random.random()用于生成一个0到1的随机符点数: 0 < ...