예제 #1
0
 private void create_Click(object sender, EventArgs e)
 {
     if (validateNewUser())
     {
         if (!loginDb.hasEntry(newUsername.Text))
         {
             Row loginRow = new LoginRow(newUsername.Text, newPassword.Text, (short)newAuthLevel.SelectedIndex);
             loginDb.insert(loginRow);
             MessageBox.Show("User created successfully!", "User Creation Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             panelSelectCategory.Enabled = true;
             buttonLogout.Enabled        = true;
             groupBox1.Visible           = false;
             resetCreateFields();
         }
         else
         {
             MessageBox.Show("Username already exists. Please use a different username", "User Creation Faild", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
예제 #2
0
파일: Login.cs 프로젝트: pubudu538/WBMSP
 private void create_Click(object sender, EventArgs e)
 {
     if (validateNewUser())
     {
         if (!loginDb.hasEntry(newUsername.Text))
         {
             Row loginRow = new LoginRow(newUsername.Text, newPassword.Text, (short)newAuthLevel.SelectedIndex);
             loginDb.insert(loginRow);
             MessageBox.Show("User created successfully!", "User Creation Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
             panelSelectCategory.Enabled = true;
             buttonLogout.Enabled = true;
             groupBox1.Visible = false;
             resetCreateFields();
         }
         else
             MessageBox.Show("Username already exists. Please use a different username", "User Creation Faild", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
 //next button action
 private void buttonNextProgress_Click(object sender, EventArgs e)
 {
     if (listboxindex < 6)                               //if not to finalize
     {
         if (MessageBox.Show("Are you sure that you need to advance the progress?",
             "Please confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (listboxindex == 1)                      //to enter estimate
             {
                 string value = "";
                 if (InputBox("Estimate Summary", "Please enter the summary of estimate:", ref value) == DialogResult.OK)
                 {
                     appToProgress.estimateSummary = value;
                     if (value == "")
                         MessageBox.Show("Please enter the summary of estimate. Otherwise considered as not progressed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     else
                     {
                         string summary = value;
                         dbprog.updateMany(new string[]{"estimateSummary", "progress"},listViewInProgress.SelectedItems[0].Text,new string[] {summary,"Estimated"});
                         listboxindex++;
                         draw();
                     }
                 }
             }
             else
             {
                 listboxindex++;
                 draw();
             }
         }
     }
     //create an account and add to 'account' database, create bill database for each user
     else if (listboxindex == 6)
     {
         if (MessageBox.Show("Are you sure that you need to advance the progress? This will create an account",
              "Please confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             int accountno;
             if (dbmap.hasEntry("account"))
             {
                 accountno = int.Parse(dbmap.get("no", "account"));
                 dbmap.update("no", "account", (accountno + 1).ToString());
             }
             else
             {
                 accountno = 1000000;
                 dbmap.insert(new MapnoRow("account",1000001));
             }
             String[] row = dbprog.getRow(listViewInProgress.SelectedItems[0].Text);
             dbprog.delete(listViewInProgress.SelectedItems[0].Text);
             AccountRow accrow = new AccountRow(accountno, row[0], textBoxInProgressName.Text, row[2], row[3], row[4],
                 row[5], row[6], row[7],textBoxInProgressAddress.Text, row[9], int.Parse(textBoxInProgressContact.Text), row[11], row[16], row[17],
                 int.Parse(listViewInProgress.SelectedItems[0].Text));
             dbacc.insert(accrow);
             dbbill.createBillingTable(accountno);
             string password=createRandomPassword(10);
             LoginRow logrow=new LoginRow(accountno.ToString(),password,1);
             dblogin.insert(logrow);
             MailRow mrow=new MailRow(accountno,textBoxInProgressName.Text,textBoxInProgressAddress.Text,
                 "Your username for the user account: "+accountno+", password: "******"Assigned Account No (Username) is: " + accountno+"\nLogin Password is: "+password, "Account Number and Login Password", MessageBoxButtons.OK);
             clrprog();
         }
         else
         {
             dbprog.update("progress", listViewInProgress.SelectedItems[0].Text, "Connection Established");
         }
     }
 }