Quick Development Platform: big wet teach me to write programs (4) the silk also has spring, quick development platform

Source: Internet
Author: User

[Turn] Quick Development Platform: big wet teach me to write programs (4) the silk also has spring, fast development platform

I. Silk also has spring

"Dear, are you? "

"Sister, does your computer feel slow again? Do not install 7-8 browsers or 3-4 anti-virus software when installing the software in the future. You may feel stuck When configuring the machine. In the future, don't look for movie movies everywhere. On the internet, you may be fooled by Trojans. You just want to see if you want seeds. "

"No, people's computers are good. Aren't you a software engineer? The company has a small project for me to find a supplier. I first thought of you. Well, you need to take over, see if you can. It will be used next week. If the cost is eight thousand, it is not a problem. "

Let's take a look at the demand first. Maybe someone may have thousands of pieces to let my entire ERP system come out... I see more small customers without a margin. Anyone who wants to make a website for 900 RMB has a website.

The content is quite small, that is, to add a background news publishing function to the background of their company's website. Which is tens of thousands of blocks? It's so cool, right?

"Sister, do you need to add a background news publishing function on the basis of the original website? "

"Uncle, aren't all requirements clearly written? Are you sure you want to contact me for another reason? This is a function, but the background management does not have permission management in the past, this time we will do it by the way"

"This is a news publishing function. By the way, permission management is implemented !! What's the difference between buying a wedding dress and giving a wife to the shopkeeper .. Let me think about it first... "

"Okay, wait for your letter and give me a reply before work. "

"Taoxiong, come and check out. The youngest daughter of the four sons of the three sons of my aunt's house, the third aunt's house, is going to marry a person. Here is a photo. You'll come and have a look, is there a suitable introduction? "

"Wipe, isn't this Mr. xiaoze? You fooled me. "

"When did you see Mr. xiaoze wear such a thick coat. "

"Yes, do you have any contact information? I am not just in love. I am not a fan of fat water. "

"I have a small list here. You can see the requirement. Do you have similar code for change? "

"No problem. I just integrated the general permission management system last week. You can use it. The Instruction Manual also has the standard ISO"

 

Ii. pipeline production

DaYong was really interested. He gave me a framework, assigned a specification, and produced a standard assembly line according to the process.

You don't have to worry about permissions, so you can get the database first.

1. Create a background table

Here, remember to add instructions to tables and fields so that annotations can be taken out when the code generator is used. Improve code readability

2. Code Generation

2.1 connect to the Code Generator

2.2 code generation

Generate background code hierarchically and copy it to the project folder

"Daxiong, code generation is complete. What should I do next? "

"Configure permissions. It is not written in the description! "

Let's take a look. It's unrealistic to expect him to help me with things.

3. Configuration Module

"Dayong, what is the purpose of the configuration module? "

"You don't understand the source code... Are you a programmer? "

Right. Check the source code.

// Accordion navigation menu var AccordionMenuJson = ""; function GetAccordionMenu () {var index = 0; var html = ""; getAjax ("Frame. ashx "," action = LoadFirstMenu ", function (data) {AccordionMenuJson = eval (" ("+ data +") "); $. each (AccordionMenuJson, function (I) {if (AccordionMenuJson [I]. parentId = '9f8ce93a-fc2d-4914-a59c-a6b49494108f ') {if (index = 0) {html + = "<li> <a style = \" border-top: 0px solid # ccc; \ ">  "+ AccordionMenuJson [I]. fullName + "</a> ";} else {html + = "<li> <a>  "+ AccordionMenuJson [I]. fullName + "</a>";} html + = GetSubmenu (AccordionMenuJson [I]. menuId); html + = "</li>"; index ++ ;}}) ;}) $ (". accordion "). append (html );}
Switch (active) {case "login": // login # region login try {string IPAddress = RequestHelper. getIPAddress (); objScan. IP = IPAddress; objScan. dataPath = context. server. mapPath ("/Themes/IPScaner/QQWry. dat "); string IPAddressName = objScan. IPLocation (); if (code. toLower ()! = Context. session ["dt_session_code"]. toString (). toLower () {Msg = "1"; // Incorrect verification code} else {// system management if (Account = ConfigHelper. getValue ("CurrentUserName") & Md5Helper. MD5 (Pwd, 32) = ConfigHelper. getValue ("CurrentPassword") {SessionUser user = new SessionUser (); user. userId = "System"; user. account = "System"; user. userName = "Super administrator"; user. gender = "male"; user. password = bpms_user.Password; user. co De = "System"; user. required mentid = "Super administrator"; user. departmentName = "Super administrator"; RequestSession. addSessionUser (user); Msg = "3"; // token for successful verification (bpms_user.Account, "Logon successful", IPAddress, IPAddressName);} else {# region verify bpms_ipblacklistibll.TheIpIsRange (IPAddress ); string outmsg; bpms_user = bpms_useribll.UserLogin (Account. trim (), Pwd. trim (), out outmsg); if (outmsg! = "-1") {if (outmsg = "succeed") {if (bpms_user.Enabled = 1) {if (Islogin (context, Account. trim () {string DepartmentName = ""; bpms_organization = bpms_organizationibll.GetEntity (bpms_user.DepartmentId); if (bpms_organization! = Null) {DepartmentName = bpms_organization.FullName;} SessionUser user = new SessionUser (); user. userId = bpms_user.UserId; user. account = bpms_user.Account; user. userName = bpms_user.RealName; user. gender = bpms_user.Gender; user. password = bpms_user.Password; user. code = bpms_user.Code; user. secretkey = bpms_user.Secretkey; user. required mentid = bpms_user.DepartmentId; user. departmentName = DepartmentName; user. roleId = bpms_user.RoleId; RequestSession. addSessionUser (user); Msg = "3"; // bpms_syslogibll.AddSysLoginLog (bpms_user.Account, "Logon successful", IPAddress, IPAddressName);} else {context. response. write ("6"); // The user has logged on and cannot log on to context again. response. end () ;}} else {Msg = "2"; // The account locks bpms_syslogibll.AddSysLoginLog (bpms_user.Account, "account locked", IPAddress, IPAddressName );}} else {Msg = "4"; // incorrect account or password bpms_syslogibll.AddSysLoginLog (bpms_user.Account, "Logon Failed", IPAddress, IPAddressName) ;}} else {Msg = DbErrorMsg. returnMsg; // The service cannot be connected} # endregion} catch (Exception ex) {Msg = ex. message;} context. response. write (Msg); context. response. end (); # endregion break; case "Outlogin": // safely exit UserId = RequestSession. getSessionUser (). userId; CacheHelper. removeAllCache ("Module" + UserId); CacheHelper. removeAllCache ("Button" + UserId); CacheHelper. removeAllCache ("Data" + UserId); context. session. abandon (); // cancel the current session context. session. clear (); // Clear the current browser so Session context. response. write ("1"); context. response. end (); break; case "LoadFirstMenu": UserId = RequestSession. getSessionUser (). userId; IList list = (IList) StorePermission. instance. getModulePermission (UserId); context. response. write (JsonHelper. dropToJson <BPMS_ModulePermission> (list, "JSON"); context. response. end (); break; case "SetSystemId": // module ID, access module UserId = RequestSession. getSessionUser (). userId; string SystemId = context. request ["SystemId"]; // module ID List <BPMS_ModulePermission> Modulelist = IListHelper. IListToList <BPMS_ModulePermission> (IList) StorePermission. instance. getModulePermission (UserId )). findAll (t => t. menuId = SystemId); foreach (BPMS_ModulePermission entity in Modulelist) {BPMS_SysLogDAL.Instance.AddVisitLog (UserId, RequestSession. getSessionUser (). userName, entity. fullName, "URL:" + entity. navigateUrl); break;} // write Session context. session ["SystemId"] = SystemId; context. response. write (SystemId); context. response. end (); break; case "LeaveModule": // exit module break; default: break ;}}

From the source code, we can see that the URL address, display icon, and other information of this menu module are recorded in module management. This menu item can be displayed at the front-end when you log on to the system.

Then, the original permission framework can manage the permissions of this module based on the module ID.

The source code is really nice.

Next, the public button is assigned.

After the assignment, click Save and refresh the page again.

The selected buttons are displayed in order. But pressing down does not seem to work...

"Why didn't I click the public button after I assigned it? "

"Have you implemented the method function corresponding to the button in the code? "

"Since I want to write functions one by one, it is too troublesome to allocate buttons here"

"Are you sure you want to judge each button in your own buttons for permission judgment? "

"Oh, I understand. The buttons here are actually similar to menu module permissions, but they are not designed to save much code. The permission system can control the operation permissions of each button according to the module and button ID for more detailed and convenient permission control. For example, add, delete, or modify a file. "

"Good, good, just a bit of it"

// Add function add () {var url = "/ExampleModule/News/NewsForm. aspx "; top. openDialog (url, 'newterra', 'news Information'-add', 800,500, 50, 50);} // edit function edit () {var key = GetPqGridRowValue ("# grid_paging", 0); if (IsEditdata (key) {var url = "/ExampleModule/News/NewsForm. aspx? Key = "+ key; top. openDialog (url, 'newsform', 'news-editor', 800,500, 50, 50) ;}// Delete function Delete () {var key = GetPqGridRowValue ("# grid_paging", 0); if (IsDelData (key) {var delparm = 'Action = Delete & key = '+ key; delConfig ('newslist. aspx ', delparm) ;}// refresh function windowload () {$ ("# grid_paging "). pqGrid ("refreshDataAndView"); GetRowIndex =-1 ;}

Here I wrote an operation function for each button. Both js and background code can be firmly controlled by the permission system. It is very easy to use and runs again.

OK.

It took less than 20 minutes to compress the table, and I used this framework for the first time. Pipeline production is good.

"Daxiong, it took me less than 20 minutes to complete the operation. Please have dinner tomorrow. "

"20 minutes? You are too slow... Let's take a look at this blog to understand the detailed structure of this framework, "Building a set of UI and paying equal attention to the background. net general permission management system". You can do this in 10 minutes"

Http://www.learun.cn powersoft Official Website

Http://learun.cn: 8090 Online demo

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.