Exemplo n.º 1
0
 public FormNewConnection(int level)                                                          //initialization
 {
     appToAccept1 = new BusinessApplicationForm(null, null, null, null, null, null, null, null, null, null, 0,
                                                null, false, false, null, null, null, null, 0);
     appToProgress = new BusinessApplicationForm(null, null, null, null, null, null, null, null, null, null, 0,
                                                 null, false, false, null, null, null, null, 0);
     InitializeComponent();
     comboTitle.SelectedIndex               = 0;
     comboBoxApplicantType.SelectedIndex    = 0;
     comboBoxPreviousCategory.SelectedIndex = 0;
     comboCategory.SelectedIndex            = 0;
     if (level == 1)
     {
         tabControlNewConnection.TabPages.Remove(tabPageWaiting);
         tabControlNewConnection.TabPages.Remove(tabPagePeogress);
         //tabControlNewConnection.ItemSize.= 767;
     }
     if (level == 2)
     {
         buttonRejectA.Visible = buttonRejectG.Visible = buttonCertifyA.Visible = buttonCertifyG.Visible =
             label19.Visible   = label20.Visible = buttonNextProgress.Visible = false;
     }
     if (level == 3)
     {
         buttonRejectA.Visible = buttonRejectG.Visible = buttonEditWaiting.Visible = buttonWaitingSubmit.Visible
                                                                                         = buttonProgressEdit.Visible = buttonProgressSubmit.Visible = buttonNextProgress.Visible = false;
     }
     if (level == 4)
     {
         tabControlNewConnection.TabPages.Remove(tabPageApplication);
     }
 }
Exemplo n.º 2
0
        //submit button tab1 click
        private void buttonSubmitApplication_Click(object sender, EventArgs e)
        {
            bool containsLetter = false;                      //phone no validating
            string phoneNumber = textBoxContact.Text.Trim();
            if (phoneNumber.Length < 10)
                containsLetter = true;
            else
            {
                for (int i = 0; i < phoneNumber.Length; i++)
                {
                    if (!char.IsNumber(phoneNumber[i]))
                    {
                        containsLetter = true;
                    }
                }
            }
            if (containsLetter)
            {
                MessageBox.Show("Please enter all the data before submission and make sure contact no and NIC no is valid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bool nicwrong = false;                              //nic validating
            string nic = textBoxNIC.Text;
            if (nic.Length < 10)
                nicwrong = true;
            else
            {
                for (int i = 0; i < 9; i++)
                {
                    if (!char.IsNumber(nic[i]))
                    {
                        nicwrong = true;
                    }
                }
                if (nic[9] != 'V' && nic[9] != 'v')
                    nicwrong = true;
            }
            if (nicwrong)
            {
                MessageBox.Show("Please enter all the data before submission and make sure NIC no is in correct format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (valid())                                        //validating of required fields filled
            {
                ApplicationRow approw;
                int refno;
                if (dbmap.hasEntry("reference"))
                {
                    refno = int.Parse(dbmap.get("no", "reference"));//get a reference no  from database 'mapno'
                    int upref = refno + 1;
                    dbmap.update("no", "reference", upref.ToString());
                }
                else
                {
                    dbmap.insert(new MapnoRow("reference",10001));
                    refno = 10000;
                }

                if (comboCategory.SelectedIndex == 0)           //add data to database 'applicaton' if domestoc category
                {
                    ApplicationForm app = new ApplicationForm(comboTitle.SelectedItem.ToString(), textBoxName.Text, textBoxNIC.Text,
                        comboCategory.SelectedItem.ToString(), textBoxAddressConnection.Text, textBoxGramaNiladhari.Text, textBoxDivisionalSec.Text,
                        textBoxDistrict.Text, textBoxAddressMail.Text, textBoxEmail.Text, int.Parse(textBoxContact.Text),
                        comboBoxApplicantType.SelectedItem.ToString(), checkBoxDocsSubmitted.Checked, checkBoxPreviousConnection.Checked, textBoxPreviousAccountNo.Text,
                        comboBoxPreviousCategory.SelectedItem.ToString(), refno);//reference 0*************dn
                    approw = new ApplicationRow(app.title, app.name, app.nic, app.category, app.address,
                        app.gramaDivision, app.divisionalSecretariat, app.district, app.mail, app.email, app.contact,
                        app.applicantType, app.submittedDocs, app.preaccountNo, app.preCategory, app.refno, null, null, 0, 0);

                    dbapp.insert(approw);
                }
                else                                    //add data to database 'applicaton' if business category
                {
                    BusinessApplicationForm app1 = new BusinessApplicationForm(comboTitle.SelectedItem.ToString(), textBoxName.Text, textBoxNIC.Text,
                        comboCategory.SelectedItem.ToString(), textBoxAddressConnection.Text, textBoxGramaNiladhari.Text, textBoxDivisionalSec.Text,
                        textBoxDistrict.Text, textBoxAddressMail.Text, textBoxEmail.Text, int.Parse(textBoxContact.Text),
                        comboBoxApplicantType.SelectedItem.ToString(), checkBoxDocsSubmitted.Checked, checkBoxPreviousConnection.Checked, textBoxPreviousAccountNo.Text,
                        comboBoxPreviousCategory.SelectedItem.ToString(), textBox1Company.Text, textBoxPost.Text, refno);//reference 0****dn
                    approw = new ApplicationRow(app1.title, app1.name, app1.nic, app1.category, app1.address,
                        app1.gramaDivision, app1.divisionalSecretariat, app1.district, app1.mail, app1.email, app1.contact,
                        app1.applicantType, app1.submittedDocs, app1.preaccountNo, app1.preCategory, app1.refno,
                        app1.company, app1.post, 0, 0);
                    dbapp.insert(approw);
                }

                //show the reference no via message box
                MessageBox.Show("Your Connection Reference No is: " + refno, "Reference Number", MessageBoxButtons.OK);
                button2Click();                 //clear all fields
            }
            else   //show an error message if not completed the application
                MessageBox.Show("Please enter all the required data before submission", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Exemplo n.º 3
0
        int listboxindex = 0; //object used to handle form details

        #endregion Fields

        #region Constructors

        //initialization
        public FormNewConnection(int level)
        {
            appToAccept1 = new BusinessApplicationForm(null, null, null, null, null, null, null, null, null, null, 0,
                null, false, false, null, null, null, null, 0);
            appToProgress = new BusinessApplicationForm(null, null, null, null, null, null, null, null, null, null, 0,
                null, false, false, null, null, null, null, 0);
            InitializeComponent();
            comboTitle.SelectedIndex = 0;
            comboBoxApplicantType.SelectedIndex = 0;
            comboBoxPreviousCategory.SelectedIndex = 0;
            comboCategory.SelectedIndex = 0;
            if (level == 1)
            {
                tabControlNewConnection.TabPages.Remove(tabPageWaiting);
                tabControlNewConnection.TabPages.Remove(tabPagePeogress);
                //tabControlNewConnection.ItemSize.= 767;
            }
            if (level == 2)
            {
                buttonRejectA.Visible = buttonRejectG.Visible = buttonCertifyA.Visible=buttonCertifyG.Visible=
                    label19.Visible=label20.Visible=buttonNextProgress.Visible= false;
            }
            if (level == 3)
            {
                buttonRejectA.Visible = buttonRejectG.Visible = buttonEditWaiting.Visible = buttonWaitingSubmit.Visible
                    = buttonProgressEdit.Visible = buttonProgressSubmit.Visible = buttonNextProgress.Visible = false;
            }
            if(level==4)
            {
                tabControlNewConnection.TabPages.Remove(tabPageApplication);
            }
        }
Exemplo n.º 4
0
        private void buttonSubmitApplication_Click(object sender, EventArgs e) //submit button tab1 click
        {
            bool   containsLetter = false;                                     //phone no validating
            string phoneNumber    = textBoxContact.Text.Trim();

            if (phoneNumber.Length < 10)
            {
                containsLetter = true;
            }
            else
            {
                for (int i = 0; i < phoneNumber.Length; i++)
                {
                    if (!char.IsNumber(phoneNumber[i]))
                    {
                        containsLetter = true;
                    }
                }
            }
            if (containsLetter)
            {
                MessageBox.Show("Please enter all the data before submission and make sure contact no and NIC no is valid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            bool   nicwrong = false;                            //nic validating
            string nic      = textBoxNIC.Text;

            if (nic.Length < 10)
            {
                nicwrong = true;
            }
            else
            {
                for (int i = 0; i < 9; i++)
                {
                    if (!char.IsNumber(nic[i]))
                    {
                        nicwrong = true;
                    }
                }
                if (nic[9] != 'V' && nic[9] != 'v')
                {
                    nicwrong = true;
                }
            }
            if (nicwrong)
            {
                MessageBox.Show("Please enter all the data before submission and make sure NIC no is in correct format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (valid())                                        //validating of required fields filled
            {
                ApplicationRow approw;
                int            refno;
                if (dbmap.hasEntry("reference"))
                {
                    refno = int.Parse(dbmap.get("no", "reference"));//get a reference no  from database 'mapno'
                    int upref = refno + 1;
                    dbmap.update("no", "reference", upref.ToString());
                }
                else
                {
                    dbmap.insert(new MapnoRow("reference", 10001));
                    refno = 10000;
                }

                if (comboCategory.SelectedIndex == 0)           //add data to database 'applicaton' if domestoc category
                {
                    ApplicationForm app = new ApplicationForm(comboTitle.SelectedItem.ToString(), textBoxName.Text, textBoxNIC.Text,
                                                              comboCategory.SelectedItem.ToString(), textBoxAddressConnection.Text, textBoxGramaNiladhari.Text, textBoxDivisionalSec.Text,
                                                              textBoxDistrict.Text, textBoxAddressMail.Text, textBoxEmail.Text, int.Parse(textBoxContact.Text),
                                                              comboBoxApplicantType.SelectedItem.ToString(), checkBoxDocsSubmitted.Checked, checkBoxPreviousConnection.Checked, textBoxPreviousAccountNo.Text,
                                                              comboBoxPreviousCategory.SelectedItem.ToString(), refno);//reference 0*************dn
                    approw = new ApplicationRow(app.title, app.name, app.nic, app.category, app.address,
                                                app.gramaDivision, app.divisionalSecretariat, app.district, app.mail, app.email, app.contact,
                                                app.applicantType, app.submittedDocs, app.preaccountNo, app.preCategory, app.refno, null, null, 0, 0);

                    dbapp.insert(approw);
                }
                else                                    //add data to database 'applicaton' if business category
                {
                    BusinessApplicationForm app1 = new BusinessApplicationForm(comboTitle.SelectedItem.ToString(), textBoxName.Text, textBoxNIC.Text,
                                                                               comboCategory.SelectedItem.ToString(), textBoxAddressConnection.Text, textBoxGramaNiladhari.Text, textBoxDivisionalSec.Text,
                                                                               textBoxDistrict.Text, textBoxAddressMail.Text, textBoxEmail.Text, int.Parse(textBoxContact.Text),
                                                                               comboBoxApplicantType.SelectedItem.ToString(), checkBoxDocsSubmitted.Checked, checkBoxPreviousConnection.Checked, textBoxPreviousAccountNo.Text,
                                                                               comboBoxPreviousCategory.SelectedItem.ToString(), textBox1Company.Text, textBoxPost.Text, refno);//reference 0****dn
                    approw = new ApplicationRow(app1.title, app1.name, app1.nic, app1.category, app1.address,
                                                app1.gramaDivision, app1.divisionalSecretariat, app1.district, app1.mail, app1.email, app1.contact,
                                                app1.applicantType, app1.submittedDocs, app1.preaccountNo, app1.preCategory, app1.refno,
                                                app1.company, app1.post, 0, 0);
                    dbapp.insert(approw);
                }

                //show the reference no via message box
                MessageBox.Show("Your Connection Reference No is: " + refno, "Reference Number", MessageBoxButtons.OK);
                button2Click(); //clear all fields
            }
            else                //show an error message if not completed the application
            {
                MessageBox.Show("Please enter all the required data before submission", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }