Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!(drpCmpny.SelectedIndex < 0))
            {
                if (!q.checkPrefix(txtPrefix.Text))
                {
                    object[] tempobj  = q.getallrequest();
                    int      i        = 0;
                    string   username = "";
                    string   email    = "";
                    foreach (object[] temp in tempobj)
                    {
                        if (i == drpCmpny.SelectedIndex)
                        {
                            username = temp[4].ToString();
                            email    = temp[2].ToString();
                        }
                        i++;
                    }
                    string password = generatePassword();
                    try
                    {
                        string Body = "Welcome on behalf of Conglomerate.\r\nYour Username  :"******"_" + username + "\r\nPassword:  "******"\r\nPlease login with these credentials and setup your project to start manipulating forms";

                        string Subject = "Conglomerate: Your Login Credentials";

                        g.sendMail(email, Body, Subject);


                        q.addComapny(txtPrefix.Text.Trim(), drpCmpny.Text.Trim());
                        q.createCompany(txtPrefix.Text.Trim());
                        q.addFirstUser(txtPrefix.Text.Trim(), txtPrefix.Text.Trim() + "_" + username, g.GetSHA1HashData(password), email);
                        q.insertProj(txtPrefix.Text.Trim());
                        q.createLog(txtPrefix.Text.Trim());
                        MessageBox.Show("Company has been added");
                        q.deleterequest(drpCmpny.Text);

                        this.Hide();
                        DBA admin = new DBA();
                        this.Close();
                        admin.ShowDialog();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("The following exception Occured while sending email. The Company has not been added to the database" + ex.ToString());
                    }
                }
                else
                {
                    MessageBox.Show("This prefix already exists. Try Another Prefix");
                }
            }
            else
            {
                MessageBox.Show("No company has been selected");
            }
        }
Example #2
0
        public void loadDBA()
        {
            DBA dba = new DBA();

            dba.ShowDialog();
        }