麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

Spring.Net+NHibernate+asp.netmvc+easyui

2019-11-14 15:51:03
字體:
來源:轉載
供稿:網友

畢業4個月的入手項目..前段時間在公司一直做的維護..為了弄明白自己也就跟著寫了一個,目前也正在學習;不對的或者是有更好的還請各位賜教。

在學習的過程中主要參考::http://www.companysz.com/GoodHelper/

先做出一些總結:

Sping.Net 主要就是依賴注入  我自己的理解“依賴注入”就是寫配置文件 管理類; 為了達到解耦合的效果

依賴注入一般有這幾種:

依賴注入模式有:接口,屬性構造函數。 我只用了 一個屬性注入。

SPRing.Net 還支持集合類型的注入

1.IList和IDictionarg

  使用<list>元素作為ILIst的標簽,value為集合中元素的值。也可以注入對象,甚至關聯其它對象,使用 <ref/>元素表示關聯的對象,object 屬性為所關聯對象的id或name。集合可以為空,用<null/>元素來標記。

  在<list>元素中設置 element-type 屬性表示泛型T的類型,例如 element-type="int"  ,代表int型。

  使用IDictionarg:是 key和value為屬性元素,鍵值隊。 

 

 測試項目:

Spring.Net    注入:

BLL:

DAL:

NHibernate:做映射:

前端的代碼

  <script type="text/javascript">        $(function () {            var ds_mune = $("#ds_mune");            var openwin = $("#openwin");            var from_valitor = $("#from_valitor");            var opensearch = $("#opensearch");            var opter = ""; //定義修改或者刪除            /*======================================彈出窗=================================================*/            openwin.window({                title: '添加商品',                width: 400,                height: 230,                shadow: true,                resizable: false, //定義是否能夠改變窗口大小                iconCls: 'icon-add'            });            opensearch.window({                title: '查詢商品',                width: 300,                height: 170,                shadow: true,                resizable: false,                iconCls: 'icon-search'            });            openwin.window('close');//頁面加載時關閉功能彈窗            opensearch.window('close');//            /*====================================修改列表=============================================*/            function getshop() {                var coid = $("#coid").val();                var shopname = $("#shopname").val();                var shopprice = $("#shopprice").val();                var shopadder = $("#shopadder").val();                $.Ajax({                    url: 'ShopTestShopprop/updatashop',                    dataTpye: 'Json',                    type: 'post',                    data: { coid: coid, shopname: shopname, shopprice: shopprice, shopadder: shopadder },                    success: function (rep) {                        if (!rep.IsError) {                            openwin.window('close');                            ds_mune.datagrid('reload');                        }                        $.messager.show({                            title: '消息提示',                            msg: '修改成功。',                            timeout: 3000,                            showType: 'show',                            style: {                                right: '',                                top: document.body.scrollTop + document.documentElement.scrollTop,                                bottom: ''                            }                        });                        openwin.window('close');                        ds_mune.datagrid('reload');                    }, error: function () {                        if (rep.IsError) {                            openwin.window('close');                            ds_mune.datagrid('reload');                        }                        $.messager.show({                            title: '消息提示',                            msg: '修改失敗。',                            timeout: 3000,                            showType: 'show',                            style: {                                right: '',                                top: document.body.scrollTop + document.documentElement.scrollTop,                                bottom: ''                            }                        });                    }                });            }            /*====================================表格=============================================*/            ds_mune.datagrid({                fitColumns: true, //自動收縮                autoRowHeight: true,                rownumbers: true,                iconCls: 'edit_add',                title: '測試客戶管理',                iconCls: 'icon-sum',                striped: true, //是否顯示斑馬線效果                fit: true,                singleSelect: true, //如果為true則只選擇一行                pageList: [10, 20, 30, 50],                pageSize: 10,                pageNumber: 1,                border: false,                pagination: true, //是否在工具欄上方定義工具                // url: '<%=Url.RouteUrl(new { controller="ShopTestShopprop",action="GetSearchTestShop",area="Shop"}) %>',                url: 'Shop/ShopTestShopprop/GetSearchTestShop',                queryParams: {                    coid: $("#coid").val(),                    shopname: $("#shopname").val(),                    shopprice: $("#shopprice").val(),                    shopadder: $("#shopadder").val(),                    shoptime: $("#shoptime").val()                },                columns: [                [               { field: 'SHOPID', checkbox: true, width: 100, title: '商品編碼' },               { field: 'SHOPNAME', width: 30, title: '商品名稱' },               { field: 'SHOPPRICE', width: 60, title: '商品價格' },               { field: 'SHOPADDER', width: 30, title: '產地' },               { field: 'SHOPTIME', width: 100, title: '時間' }               ]               ],                toolbar: [{                    iconCls: 'icon-add',                    text: '添 加',                    handler: function () {                        openwin.window("open");                        $("#sub_add").on("click", function () {                            add();                        });                    }                }, '-', {                    //iconCls: 'icon-edit',                    iconCls: 'icon-edit',                    text: '修 改',                    handler: function () {                        var deleteparam = ds_mune.datagrid('getSelected');                        if (deleteparam == null || deleteparam == undefined || deleteparam <= 0) {                            $.messager.alert('提', '請選擇要修改的數據', 'info'); return;                        }                        /*====*/                        if (deleteparam) {                            $("#coid").val(deleteparam.CO_ID);                            $("#shopname").val(deleteparam.SHOPNAME);                            $("#shopprice").val(deleteparam.SHOPPRICE);                            $("#shopadder").val(deleteparam.SHOPADDER);                        }                        openwin.window("open");                        openwin.dialog({                            title: '修改商品',                            text: '修改',                            width: '400',                            height: '200'                        });                        $("#sub_add").on("click", function () {                            getshop();                        });                    }                }, '-', {                    iconCls: 'icon-remove',                    text: '刪 除',                    handler: function () {                        deleteshop();                    }                }, '_', {                    iconCls: 'icon-search',                    text: '查 詢 ',                    handler: function () {                        opensearch.window("open");                        $("#btn_Search").on("click", function () {                            searchshop();                        });                    }                }]            });            /*==============添加=============*/            function add() {                var IsChack = ds_mune.IsValid;                var coid = $("#coid").val();                var shopname = $("#shopname").val();                var shopprice = $("#shopprice").val();                var shopadder = $("#shopadder").val();                //var shoptime = $("#shoptime").val();                //                $.post('<%=Url.RouteUrl(new { controller="ShopTestShopprop",action="Addshop",area="Shop"}) %>', { coid: coid, shopname: shopname, shopprice: shopprice, shopadder: shopadder }, function (res) {                //                    alert(res);                //                })                $.ajax({                    url: "ShopTestShopprop/Addshop",                    type: 'post',                    // dataType: 'json',                    data: { coid: coid, shopname: shopname, shopprice: shopprice, shopadder: shopadder },                    success: function (rep) {                        alert(rep + "11111");                        if (!rep.IsError) {                            openwin.window('close');                            ds_mune.datagrid('reload');                        }                        $.messager.show({                            title: '消息提示',                            msg: '添加成功。',                            timeout: 3000,                            showType: 'show',                            style: {                                right: '',                                top: document.body.scrollTop + document.documentElement.scrollTop,                                bottom: ''                            }                        });                        openwin.window('close');                        ds_mune.datagrid('reload');                    },                    error: function () {                        if (rep.IsValid) {                            openwin.window('close');                            ds_mune.datagrid('reload');                        }                        $.messager.show({                            title: '消息提示',                            msg: '添加失敗。',                            timeout: 3000,                            showType: 'show',                            style: {                                right: '',                                top: document.body.scrollTop + document.documentElement.scrollTop,                                bottom: ''                            }                        });                    }                });            } //ADD 結束            /*================修改=====================*/            function updatashop() {                var deleteparam = ds_mune.datagrid('getSelected');                if (deleteparam == null || deleteparam == undefined || deleteparam <= 0) {                    $.messager.alert('提', '請選擇要修改的數據', 'info'); return;                }                /*====*/                if (deleteparam) {                    $("#coid").val(deleteparam.CO_ID);                    $("#shopname").val(deleteparam.SHOPNAME);                    $("#shopprice").val(deleteparam.SHOPPRICE);                    $("#shopadder").val(deleteparam.SHOPADDER);                }                /*====*/                //alert(JSON.stringify(deleteparam));                //console.log(Json.stringify(datarow));                //                if (deleteparam == null) {                //                    $.messager.show({                //                        title: '信息提示',                //                        msg: '請選擇要編輯的行',                //                        showType: 'show',                //                        style:                //                    {                //                        right: '',                //                        top: document.body.scrollTop + document.documentElement.sceollTop,                //                        bottom: ''                //                    }                //                    });                //                    return;                //                }                //                var coid = deleteparam.CO_ID;                //                var shopname = deleteparam.SHOPNAME;                //                var shopprice = deleteparam.SHOPPRICE;                //                var shopadder = deleteparam.SHOPADDER;                //                var shoptime = deleteparam.SHOPTIME;                //                $("#coid").val()     = coid;                //                $("#shopname").val() =shopname;                //                $("#shopprice").val()=shopprice;                //                $("#shopadder").val()=shopadder;                //                alertrs();                openwin.window("open");                //from_valitor.form("reset");                // getshop();            } //updata 結束            /*=============刪除==========*/            function deleteshop() {                var deleteparam = ds_mune.datagrid('getSelected');                var delshop;                if (deleteparam == null || deleteparam == undefined || deleteparam <= 0) {                    $.messager.alert('提示', '請選擇一條要刪除的數據!', 'info'); return;                }                else {                    //                    delete deleteparam.TESTSHOPPROP                    //                    var effectRow = new Object();                    //                    effectRow["deleteparam"] = JSON.stringify(deleteparam);                    delshop = JSON.stringify(deleteparam);                    //delshop = JSON.stringify(rows);                    $.messager.confirm("確認", "確認刪除?", function (r) {                        if (r) {                            $.messager.progress({ text: '數據刪除中,請稍候...' }); // 顯示進度                            //                            $.post('<%=Url.RouteUrl(new { controller="ShopTestShopprop",action="Delete",area="Shop"}) %>', { deleteparam: deleteparam, effectRow: effectRow }, function (rep) {                            //                                alert("?????")                            //                            });                            $.ajax({                                url: 'ShopTestShopprop/Delete',                                dataType: 'Json',                                type: 'post',                                data: { delshop: delshop },                                success: function (res) {                                    $.messager.progress('close'); // 顯示進度                                    $.messager.show({                                        showType: 'fade', showSpeed: 200, timeout: 1700,                                        title: '提示信息',                                        style: {                                            title: '提示',                                            msg: '刪除成功',                                            right: '',                                            top: document.body.scrollTop + document.documentElement.scrollTop,                                            bottom: ''                                        }                                    });                                    ds_mune.datagrid('reload');                                    if (!res.IsError) {                                        ds_mune.datagrid('reload');                                    }                                }                            });                        }                    });                }            } //DELETE    END.....            //查詢            function searchshop() {                var shopname = $("#S_SHOPNAME").val();                ds_mune.datagrid({ url: '<%=Url.RouteUrl(new { controller="ShopTestShopprop",action="GetSearchTestShop",area="Shop"}) %>', queryParams: { shopname: shopname} });                opensearch.window("close");                //                    $.ajax({                //                    url: 'ShopTestShopprop/GetSearchTestShop',                //                    dataType: 'json',                //                    type: 'post',                //                    data: { shopname: shopname },                //                    success: function () {                //                        opensearch.window('close');                //                        ds_mune.datagrid('reload');                //                    },                //                    Error: function () {                //                        ds_mune.datagrid('reload');                //                    }                //                });            } // search  end.....        });    </script></head><body>    <div class="easyui-layout" data-options="fit:true">            <div data-options="region:'center',border:false" class="eui-list-content">            <table id="ds_mune">            </table>        </div>    </div>    <!--彈出層-->    <div id="openwin">        <div class="from-tb-panel">            <table class="from-tb">                <form id="from_valitor" action="">                <table id="fro_tb">                    <tr class="title">                        <td>                        商品編碼:                        </td>                        <td>                            <input id="coid"  class="txt-main MainControl"  type="text" name="coid" style="width:200px;" />                        </td>                    </tr>                    <tr class="title">                        <td>                        商品名稱:                        </td>                        <td>                            <input id="shopname"  class="txt-main MainControl"                              placeholder="商品名" data-rule="商品名稱:required;required;length[1~]"                              data-tip="商品名稱不能為空"  type="text" name="shopname" style="width:200px;" />                        </td>                    </tr>                    <tr class="title">                        <td>                        商品價格:                        </td>                        <td>                            <input id="shopprice"  class="txt-main MainControl"                              placeholder="商品價格" data-rule="菜單名:required;required;length[1~]"                              data-tip="商品價格不能為空" type="text" name="shopprice" style="width:200px;" />                        </td>                    </tr>                    <tr class="title">                        <td>                        產地:                        </td>                        <td>                            <input id="shopadder"  class="txt-main MainControl"                              placeholder="產地" data-rule="產地:required;required;length[1~]"                              data-tip="產地不能為空" type="text" name="shopadder" style="width:200px;" />                        </td>                    </tr>                    <tr class="title">                        <td>                        時間:                        </td>                        <td>                            <input id="shoptime"  class="txt-main MainControl"  type="text" name="shoptime" style="width:200px;" />                        </td>                    </tr>                    <tr>                        <td class="submit-btn">                            <a href="javascrpit:void(0)" class="lbtn-main lbtn-nofloat" id="sub_add">保存</a>                        </td>                    </tr>                </table>                </form>            </table>        </div>    </div>    <!--彈出查詢-->    <div id="opensearch">        <form id="form_search" action="" >        <div id="form_plane">            <table id="form_tb">                <tr class="title">                        <td>                        商品名稱:                        </td>                        <td>                            <input id="S_SHOPNAME"  class="txt-main MainControl"                              placeholder="商品名" data-rule="商品名稱:required;required;length[1~]"                              type="text" name="shopname" style="width:200px;" />                        </td>                    </tr>                <tr>                    <td class="submit-btn" >                            <a href="Javascript:void(0);" class="lbtn-main lbtn-nofloat" id="btn_Search">查詢</a>                        </td>                </tr>            </table>        </div>        </form>            </div></body></html>

控制器(增刪改):

[LoginAllowView]        public ActionResult Index()        {                        return View();        }        [LoginAllowView]        public string GetSearchTestShop()         {            string json = "[]";            string shopname = Request.Params["shopname"];            int pageSize =Convert.ToInt32( Request.Params["pageSize"]);            int pageNumber = Convert.ToInt32(Request.Params["pageNumber"]);            this.GeneralSetPaging(TestShoppropBLL,pageSize,pageNumber,"desc",null,null);            IList<WUEB.Model.Entities.TESTSHOPPROP> met = this.TestShoppropBLL.Getshopall(shopname);            if (met == null || met.Count == 0)                return json;            json =Common.ToGridJson.EasyUiGridJson(met, null, null);            return json;        }                [HttpPost]        [LoginAllowView]       // [PermissionAttribute(PerAttributeTargets.SAVE)]        public String Addshop()         {            string json = "[]";            IList<TESTSHOPPROP> tpp = new List<TESTSHOPPROP>();            int coid = Convert.ToInt32( Request.Params["coid"]);            string shopname = Request.Params["shopname"];            decimal shopprice =Convert.ToDecimal( Request.Params["shopprice"]);            string shopadder = Request.Params["shopadder"];            TESTSHOPPROP testshopprop = new TESTSHOPPROP();            testshopprop.CO_ID = coid;            testshopprop.SHOPNAME = shopname;            testshopprop.SHOPPRICE = shopprice;            testshopprop.SHOPADDER = shopadder;            //testshopprop.SHOPTIME = DateTime.Now;            tpp.Add(testshopprop);             this.TestShoppropBLL.save(tpp);            return json;        }        [HttpPost]        [LoginAllowView]        public ActionResult Delete()         {            IList<TESTSHOPPROP> testshopprop = new List<TESTSHOPPROP>();            String delshop = Request.Params["delshop"];            if (String.IsNullOrEmpty(delshop)) return this.JsonFormatError("參數錯誤");            try            {                TESTSHOPPROP testshop = JSONSerializer.Deserialize<TESTSHOPPROP>(delshop);                this.TestShoppropBLL.delete(testshop);            }            catch (Exception)            {                                throw;            }                       return this.JsonFormat("", false, SysOperate.Delete);        }        [LoginAllowView]        public ActionResult updatashop()         {            //IList<TESTSHOPPROP> tpp = new List<TESTSHOPPROP>();            int coid = Convert.ToInt32(Request.Params["coid"]);            string shopname = Request.Params["shopname"];            decimal shopprice = Convert.ToDecimal(Request.Params["shopprice"]);            string shopadder = Request.Params["shopadder"];            TESTSHOPPROP testshopprop = new TESTSHOPPROP();            testshopprop.CO_ID = coid;            testshopprop.SHOPNAME = shopname;            testshopprop.SHOPPRICE = shopprice;            testshopprop.SHOPADDER = shopadder;            //testshopprop.SHOPTIME = DateTime.Now;            //tpp.Add(testshopprop);            this.TestShoppropBLL.update(testshopprop);            return this.JsonFormat("", false, SysOperate.Update);        }

  

效果:

新手有點丑忘諒解。。。。。。。。。。。。 

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产精品久久久久久久av三级 | 宅男噜噜噜66国产免费观看 | 一二区成人影院电影网 | 国产大片中文字幕在线观看 | 中文字幕爱爱视频 | 请播放一级毛片 | 性生活视频一级 | 美女视频在线观看黄 | 国产99久久精品一区二区 | 国产羞羞网站 | 黄色片免费看网站 | 午夜视频你懂的 | 免费黄色在线电影 | 又黄又爽又色无遮挡免费 | 免费看性xxx高清视频自由 | 毛片在哪看 | 毛片视频大全 | 爽爽淫人综合网网站 | 奶子吧naiziba.cc免费午夜片在线观看 | 亚洲精品一区二区三区免 | 久久成人免费观看 | 成人在线视频精品 | 成人国产精品齐天大性 | 欧美久久久一区二区三区 | 欧美毛片免费观看 | 成人免费一区二区三区视频网站 | 国产精品自拍99 | 7777奇米成人四色影视 | 青青草免费观看完整版高清 | 成人免费福利视频 | 少妇的肉体的满足毛片 | 亚洲国产精品久久久久婷婷老年 | 综合网天天射 | 亚洲一区二区三区视频 | 成人精品久久 | 欧美日韩成人一区二区 | 国产高清一区 | 亚洲国产精品久久久久婷婷老年 | 91精品国产日韩91久久久久久360 | 中文在线日韩 | 密室逃脱第一季免费观看完整在线 |