ICG-智能代码生成器.(权限控制.融入平台).(表单引擎).(最低兼容IE8)
请下拉滚动条。。。
代码生成器、附带客户端代码
个人平台:www.10086bank.com
界面:
1--首先是server制作界面(BS结构)、直接上图:
2--点击提交生成一下文件: 各个代表什么一看就懂了、、、、、、
3--把上面的文件放到对于的位置、然后编译、然后就ok了、、、、
打开client中的IBD中的loginin.aspx页面 用admin登陆、(admin未管理员、test为普通用户、这些在平台都可以设置)
登陆进来是这样:其中邮件和分组管理还有用户管理以及app管理都是平台自带的、、、、看下图:
4--现在把刚才生成的app应用加入到平台里面并且分配权限、需要的参数很少、如下图:
点击保存即可到分配权限阶段
5--权限分配:
支持全选、反选
这里我只分配给test用户、分配好了然后用test登陆loginin.aspx页面
6--test登陆进来的:
没说的、、、点击人员管理即进入 :
再来一个:
好了介绍完了
代码实现:
这主要是平台下的控制代码、包括前端和底层以及数据库:
前端:Javascript
var userid = "feifei", tiptime = 2000, pagesize = 10, TESTTABID = -1; //当前主ID var SLarray = []; //clear data obj var endtime = ""; var nowappid=""; //common data begin var myidarray = []; //for-----code myidarray.push("appid"); myidarray.push("appname"); myidarray.push("appsrc"); myidarray.push("appcount"); myidarray.push("appicopath"); myidarray.push("userid"); $(function () { jQuery("#divadd").validationEngine(); //验证 //新增 $("#btnadd").click(function () { appmanagertableID = -1; $("#divadd").show(); }); //取消新增 $("#btncancel").click(function () { $("#divadd").hide(); $("#divlist").show(); }); //保存方法 $("#btnsave").click(function () { if (!jQuery("#divadd").validationEngine("validate")) { return false; } var temparray = []; for (var s = 0; s < myidarray.length; s++) { temparray.push($("input[myid='" + myidarray[s] + "']").val()); } $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), { "type": "add", "myidarray": temparray.toString(), "userid": userid, "appmanagertableID": appmanagertableID }, function (data) { endtime = ""; //时间默认值 appmanagertableID = -1; if (data.length == 36) { success("保存成功!"); for (var s = 0; s < myidarray.length; s++) $("input[myid='" + myidarray[s] + "']").val(""); temparray = null; } $("#divadd").hide(); $("#divlist").show(); getlist(); //获取前20条 }); }); //页面第一次加载进行渲染 function load() { var obj = $("select[name='SLData']"); $(obj).each(function () { $(this).chosen(); }); } //加载页面渲染 load(); getlist(); $("#btnmore").click(function () { getlist(); }); // 文件上传 ------------------------- 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; } $("#aicon").html(obj[0].filetruename); $("#txticonpath").val(obj[0].filepath); $("#imgicon").attr("src", "userajax/" + obj[0].filepath); } }); //全选 $("#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; } }); //确定【分配用户】 $("#lasure").click(function () { var ob = $("input[name='checkboxA']"); var ckuserid = ""; $(ob).each(function () { if ($(this).attr("checked") == "checked") { ckuserid = ckuserid + "," + $(this).attr("id"); } }); if (ckuserid.indexOf(",") == -1) { alerttip("请选择需要使用该应用的用户"); return false; } var para = { "type": "Allocation", "useridlist": ckuserid, "appid": nowappid, "usebegintime": $("#txtbegintime").val(), "useendtime": $("#txtendtime").val(), "trycount": $("#txttrycount").val(), "buymoney": $("#txtmoney").val() }; $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), para, function (data) { if (data == "999") { alerttip("登录失效!请重新登录"); return; } if (data == "1") { alerttip("分配成功"); return; } }); }); })//dom end //getone function getone(id) { appmanagertableID = id; $("#divadd").show(); $("#divlist").hide(); $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), { "type": "getone", "id": id }, function (data) { var obj = $.parseJSON(data); for (var s = 0; s < myidarray.length; s++) { $("input[myid='" + myidarray[s] + "']").val(obj[0][myidarray[s]]); } $("#imgicon").attr("src", "userajax/" + $("#txticonpath").val()); }); } //获取10行数据 function getlist() { //$("#tbodydatalist").html(""); $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), { "type": "getlist", "pagesize": pagesize, "endtime": endtime }, function (data) { if (data == "nodata") { alerttip("无数据、您可以新增数据!"); $("#btnmore").hide(); } var obj = $.parseJSON(data); if (obj.length < pagesize) { $("#btnmore").hide(); } if (endtime == "") $("#tbodydatalist").html(""); for (var i = 0; i < obj.length; i++) { $("#tbodydatalist").append("<tr id='tr" + obj[i].ID + "'><td class='center'>" + obj[i].appname.replace(" 0:00:00", "") + "</td><td class='center'>" + obj[i].appsrc.replace(" 0:00:00", "") + "</td><td class='center'>" + "<img style='width:32px; height:32px' id='imgicon' src='userajax/" + obj[i].appicopath.replace(" 0:00:00", "") + "' alt='桌面显示ICON图标' />" + "</td><td class='center'><a class='btn btn-success' onclick=domains('view','" + obj[i].ID + "')><i class='icon-zoom-in icon-white'></i>修改</a> <a class='btn btn-info' onclick=domains('edit','" + obj[i].ID + "')><i class='icon-edit icon-white'></i>分配</a> <a class='btn btn-danger' onclick=domains('delete','" + obj[i].ID + "')><i class='icon-trash icon-white'></i> 删除</a></td></tr>"); if (i == (obj.length - 1)) { endtime = obj[i].CreatTime; } } }) } //domain function domains(type, id) { if (type == "delete") { if (confirm("确定删除吗?") == false) return; $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), { "type": "delete", "id": id, "userid": userid }, function (data) { if (data == "0") { error("您没有权限删除此条数据"); return; } else if (data == "1") { $("#tr" + id).remove(); success("删除成功!"); } }); } //编辑 else if (type == "view") { SLarray = []; getone(id); } //分配 else if (type == "edit") { nowappid = id; $("#myModalA").modal("show"); GetUsingUserListData(id); } } function GetUsingUserListData(id) { $("#divchecklist").html(""); //先查询使用中的 $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), { "type": "GetUsingUserListData", "appid": id, "userid": userid }, function (data) { if (data == "999") { alerttip("登录失效!请重新登录"); return; } var obj = $.parseJSON(data); if (obj != null) { for (var i = 0; i < obj.length; i++) { $("#divchecklist").append("<p><input checked='checked' type='checkbox' myname='" + obj[i].username + "' name='checkboxA' id='" + obj[i].userid + "' />" + obj[i].username + "</p>"); } } }); //未使用的用户 $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), { "type": "GetUsingUserListData0", "appid": id, "userid": userid }, function (data) { if (data == "999") { alerttip("登录失效!请重新登录"); return; } var obj = $.parseJSON(data); if (obj != null) { for (var i = 0; i < obj.length; i++) { $("#divchecklist").append("<p><input type='checkbox' myname='" + obj[i].username + "' name='checkboxA' id='" + obj[i].userid + "' />" + obj[i].username + "</p>"); } obj = null; } }); //未使用的用户 $.post("userajax/appmanagertableOP.aspx?" + new Date().toTimeString(), { "type": "getappidinfo", "appid": id, "userid": userid }, function (data) { if (data == "999") { alerttip("登录失效!请重新登录"); return; } var obj = $.parseJSON(data); if (obj != null) { $("#txtbegintime").val(obj[0].usebegintime.replace(" 0:00:00", "")); $("#txtendtime").val(obj[0].useendtime.replace(" 0:00:00", "")); $("#txttrycount").val(obj[0].trycounts); $("#txtmoney").val(obj[0].appcount); obj = null; } }); } //判断是否为第二次点击 function SLexists(myenumid) { for (var i = 0; i < SLarray.length; i++) { if (SLarray[i] == myenumid) return true; } return false; } /////----------------------common JS------------------------------------- //错误 var timeoutlength = 3000; function error(name) { $.noty({ "text": name + "</br>" + new Date().toTimeString(), "layout": "topRight", "type": "error", "timeout": timeoutlength }); return; asyncbox.tips(name, 'error', tiptime); } //成功 function success(name) { $.noty({ "text": name + "</br>" + new Date().toTimeString(), "layout": "topRight", "type": "success", "timeout": timeoutlength }); return; asyncbox.tips(name, 'success', tiptime); } //消息 function alerttip(name) { $.noty({ "text": name + "</br>" + new Date().toTimeString(), "layout": "topRight", "type": "success", "timeout": timeoutlength }); //aler return; asyncbox.tips(name, 'alert', tiptime); } //等待 function waittips() { asyncbox.tips("请稍后...!", 'wait', tiptime * 3); }
底层:C#
using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; using DBS; namespace MyDAL { public class usertableOP { //实例化 DBHelper DB = new DBHelper(); //新增 public string AddDB(string ID, string userid, string userfileid, string username, string userpass, string usergroupid, string isallowlogin, string userleftmoney, string usercount, string userheadlinkname, string userlastlogintime, string guid, string usertype, string usernamenike) { string sql = string.Format("insert into usertable (ID,userid,userfileid,username,userpass,usergroupid,isallowlogin,userleftmoney,usercount,userheadlinkname,userlastlogintime,usertype,usernamenike) values(@ID,@userid,@userfileid,@username,@userpass,@usergroupid,@isallowlogin,@userleftmoney,@usercount,@userheadlinkname,@userlastlogintime,@usertype,@usernamenike)"); SqlParameter[] sqlpara = new SqlParameter[] { new SqlParameter("@ID",ID), new SqlParameter("@userid",userid), new SqlParameter("@userfileid",userfileid), new SqlParameter("@username",username), new SqlParameter("@userpass",userpass), new SqlParameter("@usergroupid",usergroupid), new SqlParameter("@isallowlogin",isallowlogin), new SqlParameter("@userleftmoney",userleftmoney), new SqlParameter("@usercount",usercount), new SqlParameter("@userheadlinkname",userheadlinkname), new SqlParameter("@userlastlogintime",DateTime.Now.ToString()), new SqlParameter("@usertype",usertype), new SqlParameter("@usernamenike",usernamenike) }; DB.ExecuteNonQuery(sql, sqlpara); return guid; } //修改 public string UpdateDB(string username, string userpass, string usergroupid, string isallowlogin, string userleftmoney, string usercount, string userheadlinkname, string guid, string usertype,string usernamenike) { string sql = string.Format("update usertable set username=@username,userpass=@userpass,usergroupid=@usergroupid,isallowlogin=@isallowlogin,userleftmoney=@userleftmoney,usercount=@usercount,userheadlinkname=@userheadlinkname,usertype=@usertype,usernamenike=@usernamenike where ID=@guid"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@username",username), new SqlParameter("@userpass",userpass), new SqlParameter("@usergroupid",usergroupid), new SqlParameter("@isallowlogin",isallowlogin), new SqlParameter("@userleftmoney",userleftmoney), new SqlParameter("@usercount",usercount), new SqlParameter("@userheadlinkname",userheadlinkname), new SqlParameter("@usertype",usertype), new SqlParameter("@usernamenike",usernamenike), new SqlParameter("@guid", guid) }; return DB.ExecuteNonQuery(sql, para).ToString(); } //删除 public string DeleteDB(string guid) { string sql = string.Format("delete from usertable where ID=@ID"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@ID", guid) }; return DB.ExecuteNonQuery(sql, para).ToString(); } //获取一条ID值为guid的数据 public DataTable GetOneDataByGuid(string guid) { string sql = string.Format("select usernamenike,usertype, ID, userid, userfileid, username, userpass, usergroupid, isallowlogin, userleftmoney, usercount, userheadlinkname, userlastlogintime, CreatTime from usertable where ID=@guid"); SqlParameter[] para = new SqlParameter[] { new SqlParameter("@guid", guid) }; return DB.GetDataTable(sql, para); } //获取用户定义数量的数据列表 public DataTable GetTopNumberData(int pagesize, string endtime) { string sql = string.Format("select top {0} userid,groupname,userfileid,username,userpass,usergroupid,isallowlogin,userleftmoney,usercount,userheadlinkname,userlastlogintime, usertable.ID as ID,usertable.CreatTime as CreatTime from usertable,grouptable where grouptable.groupid=usertable.usergroupid and usertable.CreatTime<'{1}' order by usertable.CreatTime DESC", pagesize, endtime); return DB.GetDataTable(sql, null); } /// <summary> /// 查询个人桌面上的app应用数据【ok】 /// </summary> /// <param name="userid">用户id</param> /// <returns></returns> public DataTable GetList(string userid) { string sql = string.Format("select ID,appname,appsrc,appicopath from appmanagertable,appmanageruser where appmanagertable.ID=appmanageruser.appid and appmanageruser.userid='{0}' and (usebegintime<getdate() and useendtime>getdate() or isbought=1 or trycounts>0) ", userid); return DB.GetDataTable(sql, null); } /// <summary> /// 获取用户个人信息 /// </summary> /// <param name="userid">用户id</param> /// <returns></returns> public DataTable GetUserInfo(string userid) { string sql = string.Format("select * from usertable where userid='{0}' ", userid); return DB.GetDataTable(sql, null); } /// <summary> /// 获取消息 /// </summary> /// <param name="userid"></param> /// <returns></returns> public DataTable GetNews(string userid, int isread) { string sql = string.Format("select ID,fromname,content from UserNews where touserid='{0}' and isread={1} ", userid, isread); if (isread != 1 && isread != 0) sql = string.Format("select ID,fromname,content from UserNews where touserid='{0}' "); return DB.GetDataTable(sql); } /// <summary> /// 查询是否存在 /// </summary> /// <param name="name"></param> /// <returns></returns> public string Getexists(string name) { string sql = string.Format("select count(0) from usertable where username='{0}'", name); return DB.ExecuteSingleString(sql); } } }
相关下载:
视频+平台框架源码+生成的demo: http://pan.baidu.com/s/1eQiVqeu
在线视频、不太清晰:http://v.youku.com/v_show/id_XNzU4ODQ2MTQ4.html (20M左右)
使用:
本人开发的ICG有2个端:server+client 都是BS结构的
ICG-server:就是设计界面、包括生产所有代码、
ICG-client:只需要把server产生的文件放到相对于的位置、然后根据在client端中的位置添加到APP管理中、最后就是分配权限(当前只支持“查看权限”)、后面将会考虑是否做数据修改权限。
本系统生成的代码适合用于类似OA和一个数据管理的系统、不是所有的想法都能通过它实现、www.10086bank.com 平台框架由部分是代码生成器生成的、后面只是做了些修改
最后下载:
需要其他源码请给我留言、请留下你的邮箱地址、我会尽快给你邮件、、、收到邮件请在下面回复一下、非常谢谢!20140820 QQ:502048227
喜欢的请给我“推荐” 谢谢