private void NewPerson_User_Signature_Office_Activated(object sender, EventArgs e) { this.Cursor = System.Windows.Forms.Cursors.WaitCursor; person_userComboBox.Items.Clear(); Person_User person_user = new Person_User(); User user = new User(); Person person = new Person(); person_user.findAll(); foreach (Person_User person_userList in person_user.persons_users) { user.iduser = person_userList.iduser; user.findByIdUser(); person_user.user = user; person.idperson = person_userList.idperson; person.findByIdperson(); person_user.person = person; person_userComboBox.Items.Add(person_user.user.username + " - " + person_user.person.personname); } signatureComboBox.Items.Clear(); Signature signature = new Signature(); signature.findAll(); foreach (Signature signatureList in signature.signatures) { signatureComboBox.Items.Add(signatureList.signaturename); } officeComboBox.Items.Clear(); Office office = new Office(); office.findAll(); foreach (Office officeList in office.offices) { officeComboBox.Items.Add(officeList.officedescription); } this.Cursor = System.Windows.Forms.Cursors.Default; }
private void button4_Click(object sender, EventArgs e) { if (verificationTextBox()) { foreach (object itemChecked in personCheckedListBox.CheckedItems) { Person person = new Person(); Person_User person_user = new Person_User(); User user = new User(); Person_User_Computer person_user_computer = new Person_User_Computer(); person.personname = itemChecked.ToString(); person.findByPersonname(); Console.WriteLine("IDperson: " + person.idperson); Console.WriteLine("personname: " + person.personname); Console.WriteLine("personemail: " + person.personemail); person_user.idperson = person.idperson; person_user.findByIdPerson(); Console.WriteLine("IDperson_user: "******"IDperson: " + person_user.idperson); Console.WriteLine("IDuser: "******"IDperson_user: "******"IDcomputer: " + person_user_computer.idcomputer); Console.WriteLine("computername: " + person_user_computer.computername); user.iduser = person_user.iduser; user.findByIdUser(); Console.WriteLine("IDuser: "******"username: "******"useremail: " + user.useremail); Console.WriteLine("IDDepartmant: " + user.iddepartment); destinationUserPath = @"\\"+person_user_computer.computername+@"\c$\Users\"+user.username+@"\AppData\Roaming\Microsoft\Signatures\"; Console.WriteLine(destinationUserPath); sourcePath = System.IO.Path.Combine(textBox2.Text); sourcePathsParts = sourcePath.Split('\\'); destinationBackupPath = System.IO.Path.Combine(textBox1.Text); destinationBackupPath = destinationBackupPath + @"\" + person.personname + @"\" + sourcePathsParts.Last(); Console.WriteLine(destinationBackupPath); if (!System.IO.Directory.Exists(destinationBackupPath)) { System.IO.Directory.CreateDirectory(destinationBackupPath); } /*if (Directory.Exists(textBox2.Text)) { filesSignatures = Directory.GetFiles(textBox2.Text); foreach (string file in filesSignatures) { fileName = Path.GetFileName(file); destinationFileBackupPath = Path.Combine(destinationBackupPath, fileName); File.Copy(file, destinationFileBackupPath, true); destinationFileUserPath = Path.Combine(destinationUserPath, fileName); File.Copy(file, destinationFileUserPath, true); } } else { MessageBox.Show("O caminho " + textBox2.Text + " não existe.", "Erro"); }*/ } } else { MessageBox.Show("Tem que selecionar algo!!"); } }
public void findAll() { db = new Database(); person_user_computerQuery = new MySqlCommand(); person_user_computerQuery.Connection = db.Connection(); person_user_computerQuery.CommandText = "SELECT * FROM person_user_computer"; person_user_computerResult = person_user_computerQuery.ExecuteReader(); while (person_user_computerResult.Read()) { if (!person_user_computerResult.IsDBNull(0)) { idperson_user = person_user_computerResult.GetInt32(0); } if (!person_user_computerResult.IsDBNull(1)) { person = new Person(); person.idperson = person_user_computerResult.GetInt32(1); person.findByIdperson(); } if (!person_user_computerResult.IsDBNull(2)) { user = new User(); user.iduser = person_user_computerResult.GetInt32(2); user.findByIdUser(); } //if (!person_user_computerResult.IsDBNull(3)) //{ // person_userstart = person_user_computerResult.GetDateTime(3); //} //else //{ // person_userstart = null; //} //if (!person_user_computerResult.IsDBNull(4)) //{ // person_userfinish = person_user_computerResult.GetDateTime(4); //} //else //{ // person_userfinish = null; //} persons_users_computers.Add(new Person_User_Computer { idperson_user = this.idperson_user, person = this.person, user = this.user }); } db.Close(); }