Registration page, repair page

Source: Internet
Author: User

1. Design Ideas

1 "New database, primary foreign key to deal with these details, re-build the registration interface and repair interface

2 "match the characters with regular expressions and put them in the business logic class."

2, the code is as follows:

Registration page Code

Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.linq;using system.text;using system.windows.forms;using system.text.regularexpressions;namespace        ruanjian{struct MyInfo {public string username;        public string Name;        public string Xingbie;        public string Mima;        public string Mibao;        public string Daan;    public string Email;        } public partial class Zhuce:form {public static string sex;        Public Zhuce () {InitializeComponent ();            } private void Zhuce_click (object sender, EventArgs e) {string yonghu=textbox1.text;                         String Name=textbox2.text;                    if (radiobutton1.checked) {sex = Radiobutton1.text;  } if (radiobutton2.checked) {sex = Radiobutton2.text;                  } string Pw=textbox3.text;                       String Pw2=textbox4.text;            String mibao=combobox1.selecteditem.tostring ();            String Answer=textbox5.text;            String Mail=textbox6.text;                    Dd.yanzheng (Yonghu, name, sex, PW, pw2, Mibao, answer, mail);        } dbcon dd = new Dbcon ();            private void Zhuce_load (object sender, EventArgs e) {dd.db ();            ComboBox1.Items.Add ("Who is your favorite Girl");            COMBOBOX1.ITEMS.ADD ("What's your Favorite Color");            COMBOBOX1.ITEMS.ADD ("What is your mother's name");            COMBOBOX1.ITEMS.ADD ("What is your father's name");        ComboBox1.Items.Add ("Who is Your head teacher"); }            }}

Data manipulation class Code

Register insert public void Yanzheng (string yonghu,string xingming,string sex,string pw,string pw2,string question,string an            Swer,string mail) {myinfo mm = new MyInfo ();            Have to learn the regex, match the phone number string a = "[1-9]{11}";            ASP and C # are not the same ah, restrictions on Chinese really no language, matching user name string b = "^[\u4e00-\\u9fa5]{2,3}$";            The password can only be entered in letters. The number consists of a character string c = "\\w+\\.+\\d"; Match Mailbox String d = "^\\w+ ([-+.] \\w+) *@\\w+ ([-.] \\w+) *\\.\\w+ ([-.]            \\w+) *$ ";            Secret insurance answer just forget, user random string mima2 = PW2;                if (Regex.IsMatch (Yonghu, a) = = True) {mm.username = Yonghu; if (Regex.IsMatch (xingming, b) = = True) {mm.                                            Name = xingming;                                      Mm.xingbie = sex;                        if (Regex.IsMatch (PW, c) = = True) {Mm.mima = PW2; if (Mm.mima == Mima2) {if (Regex.IsMatch (mail, d) = = True)                            {mm.email = mail;                             } else {MessageBox.Show ("Your mailbox format is incorrect");                            }} else {                        MessageBox.Show ("Inconsistent password input");                        } Mm.mibao = question;                    Mm.daan = answer;                    } else {MessageBox.Show ("password format is incorrect");            }}}} else {MessageBox.Show ("Your user name input is not canonical"); } string Wuyu = "INSERT into User_info (username,name,sex,possword,question,answer,mail) VALUES ('" + Mm.usernam E + "', '" + mm. Name + "', '" + Mm.xingbie + "', '" + Mm.mima + "', '" + Mm.mibao + "', '" + Mm.daan + "', '" + Mm.email + "')";            Dbinsert (Wuyu);            Repair FF = new repair (); Ff.        Show (); }

repair page logic code

Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing;    Using system.linq;using system.text;using system.windows.forms;using system.data.sqlclient;namespace ruanjian{        Public partial class Repair:form {public repair () {InitializeComponent ();        } dbcon dd = new Dbcon ();            private void Repair_load (object sender, EventArgs e) {dd.db (); Label4.            Text = denglu.dengluming + "already logged in";            COMBOBOX1.ITEMS.ADD ("mobile phone");            COMBOBOX1.ITEMS.ADD ("Computer");            ComboBox1.Items.Add ("flat");        COMBOBOX1.ITEMS.ADD ("books"); The private void Baoxiu_click (object sender, EventArgs e) {string xx = Label4.            Text;            string neirong = richTextBox1.Text;            string Didian = TextBox1.Text;            String leixing = ComboBox1.SelectedItem.ToString ();                   Dd.xinxi (xx,neirong,didian,leixing);           }                }} 

repair business logic code

The repair information is inserted into public void Xinxi (String xx,string neirong, String didian,string leixing) {if (xx = = "") || Neirong = = "" | | Didian = = "" | |            leixing== "") {MessageBox.Show ("You cannot fill in the blanks, please re-enter");            } String Cishu = "SELECT count (*) from repair where username= '" + xx+ "'";            SqlCommand sql = new SqlCommand (cishu,conn);            SDA = new SqlDataAdapter (SQL);                        ds = new DataSet ();                try {String CCC = "SELECT COUNT (*) from repair where username= '" + xx + "'";                SqlCommand cnn = new SqlCommand (CCC, Conn);                SDA = New SqlDataAdapter (CNN);                ds = new DataSet (); Sda.                Fill (DS); DataTable dt = ds.                Tables[0];                SqlCommandBuilder SCB = new SqlCommandBuilder (SDA);                String Shijian = DateTime.Now.ToString (); if (convert.tostring (dt. rows[0][0]) = = null) {string Shuju = "INSERT INTO repair (Username,leixing,shijian,neiyong,didia                    N,cishu) VALUES (' "+ xx +" ', ' "+ leixing +" ', ' "+ Shijian +" ', + ' + Neirong + "', '" + Didian + "', '" + Cishu + "')";                                                      Dbinsert (Shuju); } else {int ci = convert.toint32 (dt.                                       ROWS[0][0]) + 1; String LIANG = Ci.                    ToString (); String Shuju = "INSERT into repair (Username,leixing,shijian,neiyong,didian,cishu) VALUES ('" + xx + "', '" + leixing + "', '                    "+ Shijian +" ', + ' "+ Neirong +" ', ' "+ Didian +" ', ' "+ LIANG +" ') ";                                        Dbinsert (Shuju);                MessageBox.Show ("OK");            }} catch (Exception e) {MessageBox.Show (e+ "commit error"); } conn.                            Close ();   } 

  3, the effect is as follows

4. Time-consuming analysis

PSP: Fifth time job

Personal Software

Process Stages

Timer (h)
Planning: Plan 6
. Estimate: The estimated time 5
Development: Development 5
. Analysis: Demand analysis 0.2
. Design Spec: Creating a design Document 0.2
. Coding Standard Code specification O.3
. Desing Specific design 1
. Coding Specific code 2.5
. Code Review Code review 0.4
. Text Test 0.4
Repotring Report 1
. Test Report Test report 0.2
. Size Measurement Computer workload 0.7
. Postmortem Summary afterwards 0.1

5. Team Summary

This design login form to realize, experience an afternoon, build the library waste 2 hours, the identity column and the main foreign key will not get, so re-learn one side, team cooperation can also, not too messy. Time is too long.

6, for the summary of the work

Good tired, build a library, learn regex match registration data, write business class, because the word error, oneself looked for a full one hours, breakpoint also useless. Management interface I'll refine it; I have a big question, how do I traverse all the controls on the page? I want to register the interface has lost focus on the use of Regex to judge the function, I hope the teacher can answer.

Registration page, repair page

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.