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>&nbsp;<a class='btn btn-info' onclick=domains('edit','" + obj[i].ID + "')><i class='icon-edit icon-white'></i>分配</a>&nbsp;<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);
        }
View Code

底層: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);
        }
    }
}
View Code

 

 

 

相關下載:

視頻+平台框架源碼+生成的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

 

喜歡的請給我“推薦” 謝謝


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM