Example #1
0
        //rejection of gramaniladari certificate
        private void buttonRejectG_Click(object sender, EventArgs e)
        {
            //delete from 'application' database and add to 'mail' database
            string value = "";
            if (InputBox("Reasoning", "Reason for rejecting GramaNiladari Certificate:", ref value) == DialogResult.OK)
            {
                string reasonG = value;
                if (value == "")
                    MessageBox.Show("Please enter a reason for rejection. Otherwise considered as not rejected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                else
                {
                    appToAccept1.confirmG = 2;

                    string msg = "Your GramaNiladari Certificate has been rejected because of the reason: " + value;
                    MailRow mrow = new MailRow(int.Parse(listViewApplicants.SelectedItems[0].Text), textBoxWaitingName.Text, textBoxWaitingAddress.Text, msg);
                    dbmail.insert(mrow);
                    dbapp1.delete(listViewApplicants.SelectedItems[0].Text);
                    clr();

                }
            }
        }
Example #2
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");
         }
     }
 }