Esempio n. 1
0
        private void loginButon_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Reload();

            string pass = DataManagement.getPass(passwordLoginTxtbox.Text);

            if (DataManagement.tryConnection(usernameLoginTxtbox.Text, pass))
            {
                this.Visible = false;
                this.Hide();

                if (isAdmin)
                {
                    FormAdmin frm = new FormAdmin();
                    frm.Show();
                    isAdmin = false;
                }
                else
                {
                    Form2 frm = new Form2();
                    frm.Show();
                }
            }
            else
            {
                MessageBox.Show("Conexiunea nu se poate stabili!");
            }
        }
Esempio n. 2
0
        private void buttonAddInd_Click(object sender, EventArgs e)
        {
            if (textPassword.Text != textPassword2.Text)
            {
                MessageBox.Show("parolele nu coincid!");
                return;
            }

            string username = this.textUsername.Text;
            string password = DataManagement.getPass(this.textPassword.Text);

            if (radioIndivid.Checked)
            {
                var individ = new Individual
                {
                    FirstName = this.textFirstName.Text,
                    LastName  = this.textLastName.Text,
                    Email     = this.textEmail.Text,
                    Birthday  = new DateTime(
                        Int32.Parse(this.comboYear.Text),
                        Int32.Parse(this.comboMonth.Text),
                        Int32.Parse(this.comboDay.Text)
                        ),
                    CNP = this.textCNP.Text,
                };


                DataManagement.addIndividualCustomer(individ, username, password);
            }
            else
            {
                var individ = new Individual
                {
                    FirstName = this.textFirstName.Text,
                    LastName  = this.textLastName.Text,
                    Email     = this.textEmail.Text,
                    Birthday  = new DateTime(
                        Int32.Parse(this.comboYear.Text),
                        Int32.Parse(this.comboMonth.Text),
                        Int32.Parse(this.comboDay.Text)
                        ),
                    CNP = this.textCNP.Text,
                };

                var company = new Company
                {
                    CIF     = Int32.Parse(this.textCif.Text),
                    Name    = this.textCompany.Text,
                    Address = this.textAddress.Text
                };
                DataManagement.addCompany(individ, company, username, password);
            }
        }