"Gzframework Framework Development Log" 03 Login function Realization

Source: Internet
Author: User

First, reset the working directory as (connected to the previous section)
git checkout -f chapter-01

II. Structure of database tables

Directory: $ source Directory &/Materials/GZFRAMEWORK_SYSTEM.PDM

Database modeling tools: PowerDesigner

PowerDesigner 16.5 "Extended properties not supported" issue with SQL Server 2012 build Database

The database previews are as follows:

Third, functional design

Using the code generator to generate the model structure for table Dt_myuser

The build interface is as follows (note the Red Circle place):

Click Generate mode structure and attach to project Gzframework.model

The code generator is described in:

"Gzframework Framework Development Log" Preface software and plug-in list

The landing box is designed as follows:

Click Login to jump to frmmain form

One of the main code dal:

public class Dallogin {///<Summary>Verify user name password///</Summary>///<param name="User"></param>///<param name="PWD"></param>///<param name="Dr"></param>///<returns></returns>public bool Verifypwd (string User, String Pwd, out DataRow dr) {const String sql = ' Select TOP 1 * FROM            Dbo.dt_myuser WHERE [email protected] and [password][email protected] ";            Dbcommandbase cmd = dbcommandbuilderfactory.buildcommandtext (SQL); Cmd.            AddParam ("@Accound", SqlDbType.VarChar, User); Cmd.            AddParam ("@Pwd", SqlDbType.VarChar, PWD); DataTable dt = cmd.            GetTable (Global.systemdatabase, "Dt_myuser");            Dr = null; if (dt. Rows.Count > 0) {dr = dt.                Rows[0];            return true;        } return false; }    }
DAL Layer Verification login Code

Iv. Methods of C # WinForm program exit

1.this. Close ();   only close the current window, if it is not the main form, it cannot exit the program, and if there is a managed thread (not the main thread), it will not be able to exit cleanly;

2.application.exit ();  Forces all messages to abort, exits all forms, but does not cleanly exit if there are managed threads (not the main thread);

3.application.exitthread (); Forces abort all messages on the calling thread, as well as the problem that other threads are not able to exit correctly;

4.system.environment.exit (0);   This is the most thorough exit method, no matter what thread is forced to quit, the program ends very clean.

About GZFramework.WinLibrary.SplashScreenServer.CloseForm ();

Show Long wait forms:

You can add long waits in the Frmmain load event to simulate the display of this form

Private void frmmain_load (object  sender, EventArgs e) {    thread.sleep ();    GZFramework.WinLibrary.SplashScreenServer.CloseForm ();}

Full code Copy working directory for this section

git checkout -f chapter-03

Gzframework Development Framework AC Group: 288706356

"Gzframework Framework Development Log" 03 Login function Realization

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.