Example #1
0
        public static void PrintClientInfo(int ProfileId)
        {
            switch(ProfileProvider.GetCategory(ProfileId))
            {
                #region Client
                case 1:
            Client client = new Client(ProfileId);
            try
            {
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            catch (IOException)
            {
                string Proc = GetFileProcessName("Report_" + ProfileId.ToString() + ".pdf");
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            FileStream FS = new FileStream(System.Windows.Forms.Application.UserAppDataPath+@"\Report_"+ProfileId.ToString()+".pdf",FileMode.CreateNew);
            var Doc = new iTextSharp.text.Document(PageSize.A4,20,20,20,20);
            PdfWriter.GetInstance(Doc, FS);
            Doc.Open();
            PdfPTable table = new PdfPTable(5);
            table.WidthPercentage = 100;
            AddHeader(table, "Profile Card", 20, new BaseColor(Color.DimGray),new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Category:");
            AddValueCell(table, "Client");
            AddPriviewCell(table, "Name:");
            AddValueCell(table, client.Name);
            AddPriviewCell(table, "Date of Birth:");
            AddValueCell(table, client.DateOfBirdh.ToShortDateString());
            AddPriviewCell(table, "Member:");
            AddValueCell(table, client.Member,true);
            AddPriviewCell(table, "PARIS Number:");
            AddValueCell(table, client.ParisNumber);
            AddHeader(table, "Address", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Address:");
            AddValueCell(table, client.Adress.Addres);
            AddPriviewCell(table, "City:");
            AddValueCell(table, client.Adress.City);
            AddPriviewCell(table, "Province:");
            AddValueCell(table, client.Adress.Province);
            AddPriviewCell(table, "Country:");
            AddValueCell(table, client.Adress.Country);
            AddPriviewCell(table, "Postal Code:");
            AddValueCell(table, client.Adress.PostalCode);
            AddPriviewCell(table, "Phone:");
            AddValueCell(table, client.Adress.Phone);
            AddPriviewCell(table, "Email:");
            AddValueCell(table, client.Adress.Email);
            AddHeader(table, "Emergency", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Emergency CN:");
            AddValueCell(table, client.EmergencyContact.Name);
            AddPriviewCell(table, "Emergency CP:");
            AddValueCell(table, client.EmergencyContact.Phone);
            AddPriviewCell(table, "Emergency Relation:");
            AddValueCell(table, client.EmergencyContact.Relation);
            if (client.DopEmergencyContact != null)
            {
                AddPriviewCell(table, "Emergency CN:");
                AddValueCell(table, client.DopEmergencyContact.Name);
                AddPriviewCell(table, "Emergency CP:");
                AddValueCell(table, client.DopEmergencyContact.Phone);
                AddPriviewCell(table, "Emergency Relation:");
                AddValueCell(table, client.DopEmergencyContact.Relation);
            }
            AddHeader(table, "Medical", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Doctor Name:");
            AddValueCell(table, client.DoctorName);
            AddPriviewCell(table, "Doctor Phone:");
            AddValueCell(table, client.DoctorPhone);
            AddPriviewCell(table, "Pharmacist Name:");
            AddValueCell(table, client.PharmacistName);
            AddPriviewCell(table, "Pharmacist Phone:");
            AddValueCell(table, client.PharmacistPhone);
            AddAttendanceCell(table, client.Attendance);
            AddTransportationCell(table, client.Transportation);
            Doc.Add(table);
            Doc.Close();
            Process.Start(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf");
            break;
                #endregion
                #region Employee
                case 2:
            Employee employee = new Employee(ProfileId);
            try
            {
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            catch (IOException)
            {
                string Proc = GetFileProcessName("Report_" + ProfileId.ToString() + ".pdf");
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            FS = new FileStream(System.Windows.Forms.Application.UserAppDataPath+@"\Report_"+ProfileId.ToString()+".pdf",FileMode.CreateNew);
            Doc = new iTextSharp.text.Document(PageSize.A4);
            PdfWriter.GetInstance(Doc, FS);
            Doc.Open();
            table = new PdfPTable(5);
            table.WidthPercentage = 100;
            AddHeader(table, "Profile Card", 20, new BaseColor(Color.DimGray),new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Category:");
            AddValueCell(table, "Employee");
            AddPriviewCell(table, "Name:");
            AddValueCell(table, employee.Name);
            AddPriviewCell(table, "Date of Birth:");
            AddValueCell(table, employee.DateOfBirdh.ToShortDateString());
            AddPriviewCell(table, "Hire Date:");
            AddValueCell(table, employee.HireDate.ToShortDateString());
            AddPriviewCell(table, "Position:");
            AddValueCell(table, employee.Position);
            AddPriviewCell(table, "Position Type:");
            AddValueCell(table, employee.PositionType);
            AddPriviewCell(table, "SIN:");
            AddValueCell(table, employee.SIN);
            AddHeader(table, "Address", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Address:");
            AddValueCell(table, employee.Adress.Addres);
            AddPriviewCell(table, "City:");
            AddValueCell(table, employee.Adress.City);
            AddPriviewCell(table, "Province:");
            AddValueCell(table, employee.Adress.Province);
            AddPriviewCell(table, "Country:");
            AddValueCell(table, employee.Adress.Country);
            AddPriviewCell(table, "Postal Code:");
            AddValueCell(table, employee.Adress.PostalCode);
            AddPriviewCell(table, "Phone:");
            AddValueCell(table, employee.Adress.Phone);
            AddPriviewCell(table, "Email:");
            AddValueCell(table, employee.Adress.Email);
            AddPriviewCell(table, "Cell:");
            AddValueCell(table, employee.Adress.Cell);
            AddHeader(table, "Emergency", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Emergency CN:");
            AddValueCell(table, employee.EmergencyContact.Name);
            AddPriviewCell(table, "Emergency CP:");
            AddValueCell(table, employee.EmergencyContact.Phone);
            AddPriviewCell(table, "Emergency Relation:");
            AddValueCell(table, employee.EmergencyContact.Relation);
            AddAttendanceCell(table, employee.Attendance);
            Doc.Add(table);
            Doc.Close();
            Process.Start(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf");
            break;
            #endregion
                #region Volunteer
                case 3:
                    Profile vol = new Profile(ProfileId);
            try
            {
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            catch (IOException)
            {
                string Proc = GetFileProcessName("Report_" + ProfileId.ToString() + ".pdf");
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            FS = new FileStream(System.Windows.Forms.Application.UserAppDataPath+@"\Report_"+ProfileId.ToString()+".pdf",FileMode.CreateNew);
            Doc = new iTextSharp.text.Document(PageSize.A4);
            PdfWriter.GetInstance(Doc, FS);
            Doc.Open();
            table = new PdfPTable(5);
            table.WidthPercentage = 100;
            AddHeader(table, "Profile Card", 20, new BaseColor(Color.DimGray),new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Category:");
            AddValueCell(table, "Volunteer");
            AddPriviewCell(table, "Name:");
            AddValueCell(table, vol.Name);
            AddPriviewCell(table, "Date of Birth:");
            AddValueCell(table, vol.DateOfBirdh.ToShortDateString());
            AddHeader(table, "Address", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Address:");
            AddValueCell(table, vol.Adress.Addres);
            AddPriviewCell(table, "City:");
            AddValueCell(table, vol.Adress.City);
            AddPriviewCell(table, "Province:");
            AddValueCell(table, vol.Adress.Province);
            AddPriviewCell(table, "Country:");
            AddValueCell(table, vol.Adress.Country);
            AddPriviewCell(table, "Postal Code:");
            AddValueCell(table, vol.Adress.PostalCode);
            AddPriviewCell(table, "Phone:");
            AddValueCell(table, vol.Adress.Phone);
            AddPriviewCell(table, "Email:");
            AddValueCell(table, vol.Adress.Email);
            AddPriviewCell(table, "Cell:");
            AddValueCell(table, vol.Adress.Cell);
            AddHeader(table, "Emergency", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Emergency CN:");
            AddValueCell(table, vol.EmergencyContact.Name);
            AddPriviewCell(table, "Emergency CP:");
            AddValueCell(table, vol.EmergencyContact.Phone);
            AddPriviewCell(table, "Emergency Relation:");
            AddValueCell(table, vol.EmergencyContact.Relation);
            AddAttendanceCell(table, vol.Attendance);
            Doc.Add(table);
            Doc.Close();
            Process.Start(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf");
            break;
                #endregion
                #region Board Member
                case 4:
            Profile board = new Profile(ProfileId);
            try
            {
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            catch (IOException)
            {
                string Proc = GetFileProcessName("Report_" + ProfileId.ToString() + ".pdf");
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            FS = new FileStream(System.Windows.Forms.Application.UserAppDataPath+@"\Report_"+ProfileId.ToString()+".pdf",FileMode.CreateNew);
            Doc = new iTextSharp.text.Document(PageSize.A4);
            PdfWriter.GetInstance(Doc, FS);
            Doc.Open();
            table = new PdfPTable(5);
            table.WidthPercentage = 100;
            AddHeader(table, "Profile Card", 20, new BaseColor(Color.DimGray),new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Category:");
            AddValueCell(table, "Board Member");
            AddPriviewCell(table, "Name:");
            AddValueCell(table, board.Name);
            AddPriviewCell(table, "Date of Birth:");
            AddValueCell(table, board.DateOfBirdh.ToShortDateString());
            AddPriviewCell(table, "Occupation:");
            AddValueCell(table, board.Occupation);
            AddHeader(table, "Address", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Address:");
            AddValueCell(table, board.Adress.Addres);
            AddPriviewCell(table, "City:");
            AddValueCell(table, board.Adress.City);
            AddPriviewCell(table, "Province:");
            AddValueCell(table, board.Adress.Province);
            AddPriviewCell(table, "Country:");
            AddValueCell(table, board.Adress.Country);
            AddPriviewCell(table, "Postal Code:");
            AddValueCell(table, board.Adress.PostalCode);
            AddPriviewCell(table, "Phone:");
            AddValueCell(table, board.Adress.Phone);
            AddPriviewCell(table, "Email:");
            AddValueCell(table, board.Adress.Email);
            AddPriviewCell(table, "Cell:");
            AddValueCell(table, board.Adress.Cell);
            Doc.Add(table);
            Doc.Close();
            Process.Start(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf");
            break;
                #endregion
                #region Other
                case 5:
                    board = new Profile(ProfileId);
            try
            {
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            catch (IOException)
            {
                string Proc = GetFileProcessName("Report_" + ProfileId.ToString() + ".pdf");
                if (File.Exists(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf")) { File.Delete(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf"); }
            }
            FS = new FileStream(System.Windows.Forms.Application.UserAppDataPath+@"\Report_"+ProfileId.ToString()+".pdf",FileMode.CreateNew);
            Doc = new iTextSharp.text.Document(PageSize.A4);
            PdfWriter.GetInstance(Doc, FS);
            Doc.Open();
            table = new PdfPTable(5);
            table.WidthPercentage = 100;
            AddHeader(table, "Profile Card", 20, new BaseColor(Color.DimGray),new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Category:");
            AddValueCell(table, "Other");
            AddPriviewCell(table, "Name:");
            AddValueCell(table, board.Name);
            AddPriviewCell(table, "Date of Birth:");
            AddValueCell(table, board.DateOfBirdh.ToShortDateString());
            AddHeader(table, "Address", 16, new BaseColor(Color.DimGray), new BaseColor(Color.WhiteSmoke));
            AddPriviewCell(table, "Address:");
            AddValueCell(table, board.Adress.Addres);
            AddPriviewCell(table, "City:");
            AddValueCell(table, board.Adress.City);
            AddPriviewCell(table, "Province:");
            AddValueCell(table, board.Adress.Province);
            AddPriviewCell(table, "Country:");
            AddValueCell(table, board.Adress.Country);
            AddPriviewCell(table, "Postal Code:");
            AddValueCell(table, board.Adress.PostalCode);
            AddPriviewCell(table, "Phone:");
            AddValueCell(table, board.Adress.Phone);
            AddPriviewCell(table, "Email:");
            AddValueCell(table, board.Adress.Email);
            AddPriviewCell(table, "Cell:");
            AddValueCell(table, board.Adress.Cell);
            Doc.Add(table);
            Doc.Close();
            Process.Start(System.Windows.Forms.Application.UserAppDataPath + @"\Report_" + ProfileId.ToString() + ".pdf");
            break;
                #endregion

            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (comboBoxCategory.SelectedValue.ToString())
            {
                #region Client
                case "1":
                    Client _Client = new Client();
                    _Client.Name = textBox_ClientName.Text;
                    _Client.DateOfBirdh = textBox_ClientBirth.Value;
                    _Client.Member = checkBox_ClientMebmber.Checked;
                    _Client.ParisNumber = textBox_ClientParis.Text;
                    _Client.DoctorName = textBox_ClientDocName.Text;
                    _Client.DoctorPhone = textBox_ClientDocPhone.Text;
                    _Client.PharmacistName = textBox_PharmName.Text;
                    _Client.PharmacistPhone = textBox_ClientPharmPhone.Text;
                    _Client.Own = radioButton4.Checked;
                    _Client.Create();
                    Address address = new Address();
                    address.Addres = textBox_ClientAddress.Text;
                    address.City = textBox_ClientCity.Text;
                    address.Province = textBox_ClientProvince.Text;
                    address.Country = textBox_ClientCountry.Text;
                    address.PostalCode = textBox_ClientPostal.Text;
                    address.Phone = textBox_ClientPhone.Text;
                    address.Email = textBox_ClientEmail.Text;
                    address.AddAdressTo(_Client);
                    address.Dispose();
                    Attendance attendance = new Attendance();
                    attendance.Monday = attendance_mon.Checked;
                    attendance.Tuesday = attendance_tue.Checked;
                    attendance.Wednesday = attendance_wed.Checked;
                    attendance.Thursday = attendance_thu.Checked;
                    attendance.Friday = attendance_fri.Checked;
                    attendance.AddAttendanceTo(_Client);
                    Transportation trans = new Transportation();
                    trans.Monday = trans_mon.Checked;
                    if (_Client.Own) { trans.Category = "Own"; } else { trans.Category = "HandyDART"; }
                    trans.Tuesday = trans_tue.Checked;
                    trans.Wednesday = trans_wed.Checked;
                    trans.Thursday = trans_thu.Checked;
                    trans.Friday = trans_fri.Checked;
                    trans.HandyDARTNumber = textBox_ClientHD.Text;
                    trans.Address = address.Addres;
                    trans.Phone = address.Phone;
                    trans.AddTransportationTo(_Client);
                    EmergencyContact Contact = new EmergencyContact();
                    Contact.Name = textBox_ClientEmerName.Text;
                    Contact.Phone = textBox_ClientEmerPhone.Text;
                    Contact.Relation = textBox_ClientRelation.Text;
                    Contact.AddEmergencyContactTo(_Client);
                    Contact.Dispose();
                    if (toolStripTextBox_EmName.Visible)
                    {
                        EmergencyContact DopCont = new EmergencyContact();
                        DopCont.Name = toolStripTextBox_EmName.Text;
                        DopCont.Phone = toolStripTextBox_EmPhone.Text;
                        DopCont.Relation = toolStripTextBox1.Text;
                        DopCont.AddEmergencyContactTo(_Client);
                        DopCont.Dispose();
                    }
                    profilesTableAdapter.Fill(tDayDataSet.Profiles);
                    ReLoad(sender, tDayDataSet.Profiles.Rows.Count-1);
                    this.Close();
                    break;
                #endregion
                #region Employee
                case "2":
                    Employee employee = new Employee();
                    employee.Name = textBox_EmpName.Text;
                    employee.DateOfBirdh = textBox_EmpBirth.Value;
                    employee.HireDate = textBox_EmpHireDate.Value;
                    employee.SIN = textBox_EmpSin.Text;
                    employee.Position = textBox_EmpPosition.Text;
                    employee.PositionType = GetPositionType();
                    employee.Create();
                    Address address_emp = new Address();
                    address_emp.Addres = textBox_EmpAddress.Text;
                    address_emp.City = textBox_EmpCity.Text;
                    address_emp.Province = textBox_EmpProv.Text;
                    address_emp.Country = textBox_EmpCounrty.Text;
                    address_emp.PostalCode = textBox_EmpPostal.Text;
                    address_emp.Phone = textBox_EmpPhone.Text;
                    address_emp.Email = textBox_EmpEmail.Text;
                    address_emp.Cell = textBox_EmpCell.Text;
                    address_emp.AddAdressTo(employee);
                    address_emp.Dispose();
                    EmergencyContact ContactEmp = new EmergencyContact();
                    ContactEmp.Name = textBox_EpEmerName.Text;
                    ContactEmp.Phone = textBox_EmpEmerPhone.Text;
                    ContactEmp.Relation = textBox_EmpRelation.Text;
                    ContactEmp.AddEmergencyContactTo(employee);
                    ContactEmp.Dispose();
                    Attendance attendance_emp = new Attendance();
                    attendance_emp.Monday = attendance_em_mon.Checked;
                    attendance_emp.Tuesday = attendance_tue.Checked;
                    attendance_emp.Wednesday = attendance_em_wed.Checked;
                    attendance_emp.Thursday = attendance_em_thu.Checked;
                    attendance_emp.Friday = attendance_em_fri.Checked;
                    attendance_emp.AddAttendanceTo(employee);
                    attendance_emp.Dispose();
                    profilesTableAdapter.Fill(tDayDataSet.Profiles);
                    ReLoad(sender, tDayDataSet.Profiles.Rows.Count - 1);
                    this.Close();
                    break;
                #endregion
                #region Volonteer
                case "3":
                    Profile volonteer = new Profile();
                    volonteer.Name = textBox_VolName.Text;
                    volonteer.DateOfBirdh = textBox_VolBirth.Value;
                    volonteer.Create(Enums.Category.Volunteer);
                    Address adress_vol = new Address();
                    adress_vol.Addres = textBox_VolAdress.Text;
                    adress_vol.City = textBox_VolCity.Text;
                    adress_vol.Province = textBox_VolProvince.Text;
                    adress_vol.Country = textBox_VolCountry.Text;
                    adress_vol.PostalCode = textBox_VolPostal.Text;
                    adress_vol.Phone = textBox_VolPhone.Text;
                    adress_vol.Email = textBox_ValEmail.Text;
                    adress_vol.Cell = textBox_VolCell.Text;
                    adress_vol.AddAdressTo(volonteer);
                    adress_vol.Dispose();
                    EmergencyContact ContactVol = new EmergencyContact();
                    ContactVol.Name = textBox_VolEmeName.Text;
                    ContactVol.Phone = textBox_VolEmePhone.Text;
                    ContactVol.Relation = textBox_VolRelation.Text;
                    ContactVol.AddEmergencyContactTo(volonteer);
                    ContactVol.Dispose();
                    Attendance attendance_vol = new Attendance();
                    attendance_vol.Monday = attendance_vol_mon.Checked;
                    attendance_vol.Tuesday = attendance_vol_tue.Checked;
                    attendance_vol.Wednesday = attendance_vol_wed.Checked;
                    attendance_vol.Thursday = attendance_vol_thu.Checked;
                    attendance_vol.Friday = attendance_vol_fri.Checked;
                    attendance_vol.AddAttendanceTo(volonteer);
                    attendance_vol.Dispose();
                    profilesTableAdapter.Fill(tDayDataSet.Profiles);
                    ReLoad(sender, tDayDataSet.Profiles.Rows.Count - 1);
                    this.Close();
                    break;
                #endregion
                #region BoardMember
                case "4":
                    Profile board = new Profile();
                    board.Name = textBox_BorName.Text;
                    board.Occupation = textBox_BorOccupation.Text;
                    board.DateOfBirdh = textBox_BorBirth.Value;
                    board.Create(Enums.Category.BoardMember);
                    Address adress_bor = new Address();
                    adress_bor.Addres = textBox_BorAdress.Text;
                    adress_bor.City = textBox_BorCity.Text;
                    adress_bor.Province = textBox_BorProvince.Text;
                    adress_bor.Country = textBox_BorCountry.Text;
                    adress_bor.PostalCode = textBox_BorPostal.Text;
                    adress_bor.Phone = textBox_BorPhone.Text;
                    adress_bor.Email = textBox_BoeEmail.Text;
                    adress_bor.Cell = textBox_BorCell.Text;
                    adress_bor.AddAdressTo(board);
                    adress_bor.Dispose();
                    profilesTableAdapter.Fill(tDayDataSet.Profiles);
                    ReLoad(sender, tDayDataSet.Profiles.Rows.Count - 1);
                    this.Close();
                    break;
                #endregion
                #region Other
                case "5":
                    Profile other = new Profile();
                    other.Name = textBox_BorName.Text;
                    other.Occupation = textBox_BorOccupation.Text;
                    other.DateOfBirdh = textBox_BorBirth.Value;
                    other.Create(Enums.Category.Other);
                    Address adress_other = new Address();
                    adress_other.Addres = textBox_BorAdress.Text;
                    adress_other.City = textBox_BorCity.Text;
                    adress_other.Province = textBox_BorProvince.Text;
                    adress_other.Country = textBox_BorCountry.Text;
                    adress_other.PostalCode = textBox_BorPostal.Text;
                    adress_other.Phone = textBox_BorPhone.Text;
                    adress_other.Email = textBox_BoeEmail.Text;
                    adress_other.Cell = textBox_BorCell.Text;
                    adress_other.AddAdressTo(other);
                    adress_other.Dispose();
                    profilesTableAdapter.Fill(tDayDataSet.Profiles);
                    ReLoad(sender, tDayDataSet.Profiles.Rows.Count - 1);
                    this.Close();
                    break;
                #endregion

            }
        }
Example #3
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            button8.Enabled = true;
             if (e.RowIndex < dataGridView1.Rows.Count && e.RowIndex>=0)
            {
                dataGridView1.Rows[e.RowIndex].Selected = true;

                switch (dataGridView1.Rows[e.RowIndex].Cells["categoryDataGridViewTextBoxColumn"].Value.ToString())
                {
                    #region Client
                    case "1":
                        tabControl2.SelectedTab = ClientTab;
                        Client client = new Client(Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                        textBox_ClientName.Text = client.Name;
                        textBox_ClientBirth.Text = client.DateOfBirdh.ToShortDateString();
                        textBox_ClientParis.Text = client.ParisNumber;
                        textBox_ClientAdress.Text = client.Adress.Addres;
                        textBox_ClientCity.Text = client.Adress.City;
                        textBox_ClientProvince.Text = client.Adress.Province;
                        textBox_ClientCountry.Text = client.Adress.Country;
                        textBox_ClientPostal.Text = client.Adress.PostalCode;
                        textBox_ClientPhone.Text = client.Adress.Phone;
                        textBox_ClientEmail.Text = client.Adress.Email;
                        radioButton4.Checked = client.Own;
                        radioButton5.Checked = !client.Own;
                        if (!client.Own)
                        {
                            label5.Visible = true;
                            textBox_ClientHD.Visible = true;
                        }
                        else
                        {
                            label5.Visible = false;
                            textBox_ClientHD.Visible = false;
                        }
                        textBox_ClientEmerName.Text = client.EmergencyContact.Name;
                        textBox_ClientEmPhone.Text = client.EmergencyContact.Phone;
                        textBox_ClientRelation.Text = client.EmergencyContact.Relation;
                        textBox_ClientHD.Text = client.Transportation.HandyDARTNumber;
                        textBox_ClientDocName.Text = client.DoctorName;
                        textBoxClientDocPhone.Text = client.DoctorPhone;
                        textBox_ClientPharmName.Text = client.PharmacistName;
                        textBox_ClientPharmPhone.Text = client.PharmacistPhone;
                        ClientMember.Checked = client.Member;
                        if (client.DopEmergencyContact != null)
                        {
                            toolStripLabel5.Visible = true;
                            toolStripLabel6.Visible = true;
                            toolStripLabel7.Visible = true;
                            toolStripTextBox_EmName.Visible = true;
                            toolStripTextBox_EmPhone.Visible = true;
                            toolStripTextBox54.Visible = true;
                            toolStripButton23.Visible = false;
                            toolStripTextBox_EmName.Text = client.DopEmergencyContact.Name;
                            toolStripTextBox_EmPhone.Text = client.DopEmergencyContact.Phone;
                            toolStripTextBox54.Text = client.DopEmergencyContact.Relation;
                        }
                        else
                        {
                            toolStripButton23.Visible = true;
                            toolStripLabel5.Visible = false;
                            toolStripLabel6.Visible = false;
                            toolStripLabel7.Visible = false;
                            toolStripTextBox_EmName.Visible = false;
                            toolStripTextBox54.Visible = false;
                            toolStripTextBox_EmPhone.Visible = false;
                        }
                        checkBox2.Checked = client.Attendance.Monday;
                        checkBox3.Checked = client.Attendance.Tuesday;
                        checkBox4.Checked = client.Attendance.Wednesday;
                        checkBox5.Checked = client.Attendance.Thursday;
                        checkBox6.Checked = client.Attendance.Friday;

                        checkBox11.Checked = client.Transportation.Monday;
                        checkBox10.Checked = client.Transportation.Tuesday;
                        checkBox9.Checked = client.Transportation.Wednesday;
                        checkBox8.Checked = client.Transportation.Thursday;
                        checkBox7.Checked = client.Transportation.Friday;
                        break;
                    #endregion
                    #region Employee
                    case "2":
                        tabControl2.SelectedTab = EmployeeTab;
                        Employee employee = new Employee(Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                        textBox_EmpName.Text = employee.Name;
                        textBox_EmpBirth.Text = employee.DateOfBirdh.ToShortDateString();
                        textBox_EmpHire.Text = employee.HireDate.ToShortDateString();
                        textBox_EmpPosition.Text = employee.Position;
                        textBox_EmpSin.Text = employee.SIN;
                        switch (employee.PositionType)
                        {
                            case "Causal":
                                radioButton1.Checked = true;
                                break;
                            case "Part time":
                                radioButton2.Checked = true;
                                break;
                            case "Full time":
                                radioButton3.Checked = true;
                                break;
                        }
                        textBox_EmpAdress.Text = employee.Adress.Addres;
                        textBox_EmpCity.Text = employee.Adress.City;
                        textBox_EmpProvince.Text = employee.Adress.Province;
                        textBox_EmpCountry.Text = employee.Adress.Country;
                        textBox_EmpPostal.Text = employee.Adress.PostalCode;
                        textBox_EmpPhone.Text = employee.Adress.Phone;
                        textBox_EmpEmail.Text = employee.Adress.Email;
                        textBox_EmpCell.Text = employee.Adress.Cell;
                        textBox_EmpEmerCN.Text = employee.EmergencyContact.Name;
                        textBox_EmerCP.Text = employee.EmergencyContact.Phone;
                        textBox_EmpRelation.Text = employee.EmergencyContact.Relation;
                        checkBox16.Checked = employee.Attendance.Monday;
                        checkBox15.Checked = employee.Attendance.Tuesday;
                        checkBox14.Checked = employee.Attendance.Wednesday;
                        checkBox13.Checked = employee.Attendance.Thursday;
                        checkBox12.Checked = employee.Attendance.Friday;
                        break;
                    #endregion
                    #region Volonteer
                    case "3":
                        tabControl2.SelectedTab = VolunteerTab;
                        Profile volonteer = new Profile(Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                        textBox_VolName.Text = volonteer.Name;
                        textBox_VolBirth.Text = volonteer.DateOfBirdh.ToShortDateString();
                        textBox_VolAdress.Text = volonteer.Adress.Addres;
                        textBox_VolCity.Text = volonteer.Adress.City;
                        textBox_VolProvince.Text = volonteer.Adress.Province;
                        textBox_VolCountry.Text = volonteer.Adress.Country;
                        textBox_VolPostal.Text = volonteer.Adress.PostalCode;
                        textBox_VolPhone.Text = volonteer.Adress.Phone;
                        textBox_VolEmail.Text = volonteer.Adress.Email;
                        textBox_VolCell.Text = volonteer.Adress.Cell;
                        textBox_VolEmerCN.Text = volonteer.EmergencyContact.Name;
                        textBox_VolEmerCP.Text = volonteer.EmergencyContact.Phone;
                        textBox_VolEmerRelation.Text = volonteer.EmergencyContact.Relation;
                        checkBox21.Checked = volonteer.Attendance.Monday;
                        checkBox20.Checked = volonteer.Attendance.Tuesday;
                        checkBox19.Checked = volonteer.Attendance.Wednesday;
                        checkBox18.Checked = volonteer.Attendance.Thursday;
                        checkBox17.Checked = volonteer.Attendance.Friday;
                        break;
                    #endregion
                    #region BoardMember
                    case "4":
                        tabControl2.SelectedTab = Board_MemberTab;
                        textBox_BoardOccupation.Visible = true;
                        label48.Visible = true;
                        Profile board = new Profile(Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                        textBox_BoardName.Text = board.Name;
                        textBox_BoardOccupation.Text = board.Occupation;
                        textBox_BoardBirth.Visible = true;
                        textBox_BoardBirth.Text = board.DateOfBirdh.ToShortDateString();
                        textBox_BoardAdress.Text = board.Adress.Addres;
                        textBox_BoardCity.Text = board.Adress.City;
                        textBox_BoardProvince.Text = board.Adress.Province;
                        textBox_BoardCountry.Text = board.Adress.Country;
                        textBox_BoardCell.Text = board.Adress.Cell;
                        textBox_BoardPostal.Text = board.Adress.PostalCode;
                        textBox_BoardPhone.Text = board.Adress.Phone;
                        textBox_BoardEmail.Text = board.Adress.Email;
                        break;
                    #endregion
                    #region Other
                    case "5":
                        tabControl2.SelectedTab = Board_MemberTab;
                        textBox_BoardOccupation.Visible = false;

                        label48.Visible = false;
                        board = new Profile(Int32.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                        textBox_BoardName.Text = board.Name;
                        textBox_BoardOccupation.Text = board.Occupation;
                        textBox_BoardBirth.Visible = false;
                        textBox_BoardAdress.Text = board.Adress.Addres;
                        textBox_BoardCity.Text = board.Adress.City;
                        textBox_BoardProvince.Text = board.Adress.Province;
                        textBox_BoardCountry.Text = board.Adress.Country;
                        textBox_BoardCell.Text = board.Adress.Cell;
                        textBox_BoardPostal.Text = board.Adress.PostalCode;
                        textBox_BoardPhone.Text = board.Adress.Phone;
                        textBox_BoardEmail.Text = board.Adress.Email;
                        break;
                    #endregion
                }
            }
        }
Example #4
0
 public DayItem( int ProfileUID)
 {
     servicesTableAdapter.Fill(tDayDataSet.Services);
     profilesTableAdapter.Fill(tDayDataSet.Profiles);
     if (ProfileProvider.GetCategory(ProfileUID) == 1)
     {
         LunchRow = tDayDataSet.Services.FindByServiceId(1); //Не расширяемая ссылка на Сервис
     }
     else
     {
         LunchRow = tDayDataSet.Services.FindByServiceId(4);
     }
     RTRow = tDayDataSet.Services.FindByServiceId(2);
     PrRow = tDayDataSet.Services.FindByServiceId(3);
     WeekDay = (int) DateTime.Now.DayOfWeek;
     DataRow Prof = tDayDataSet.Profiles.FindByProfileId(ProfileUID);
     ProfileId = ProfileUID;
     switch ((int)Prof["Category"])
     {
         case (int)Enums.Category.Client:
             Client client = new Client(ProfileUID);
             Attendance = true;
             Lunch = true;
             //Индийский код на на всякий случай, авось расширять буду и Lunch из какой нить задницы всплывет
             if (Lunch)
             {
                 LunchPrice = Decimal.Parse(LunchRow["ServiceFee"].ToString());
             }
             if (client.Transportation.GetDay(WeekDay))
             {
                 RoundTripPrice = Decimal.Parse(RTRow["ServiceFee"].ToString());
             }
             else
             {
                 RoundTripPrice = Decimal.Zero;
             }
             ProgramPrice = Decimal.Parse(PrRow["ServiceFee"].ToString());
             TakeOutPrice = Decimal.Zero;
             MiscellaneousPrice = Decimal.Zero;
             VanPrice = Decimal.Zero;
             BookOfTickets = Decimal.Zero;
             Total = LunchPrice + TakeOutPrice + MiscellaneousPrice + VanPrice + RoundTripPrice + BookOfTickets+ProgramPrice;
             break;
         case (int)Enums.Category.Employee:
             Employee employee = new Employee(ProfileUID);
             Attendance = true;
             Lunch = true;
             //Индийский код на на всякий случай, авось расширять буду и Lunch из какой нить задницы всплывет
             if (Lunch)
             {
                 LunchPrice = Decimal.Parse(LunchRow["ServiceFee"].ToString());
             }
             ProgramPrice = Decimal.Zero;
             TakeOutPrice = Decimal.Zero;
             MiscellaneousPrice = Decimal.Zero;
             VanPrice = Decimal.Zero;
             BookOfTickets = Decimal.Zero;
             Total = LunchPrice + TakeOutPrice + MiscellaneousPrice + VanPrice + RoundTripPrice + BookOfTickets + ProgramPrice;
             break;
         case (int)Enums.Category.Volunteer:
             Attendance = true;
             Lunch = true;
             //Индийский код на на всякий случай, авось расширять буду и Lunch из какой нить задницы всплывет
             if (Lunch)
             {
                 LunchPrice = Decimal.Parse(LunchRow["ServiceFee"].ToString());
             }
             ProgramPrice = Decimal.Zero;
             TakeOutPrice = Decimal.Zero;
             MiscellaneousPrice = Decimal.Zero;
             VanPrice = Decimal.Zero;
             BookOfTickets = Decimal.Zero;
             Total = LunchPrice + TakeOutPrice + MiscellaneousPrice + VanPrice + RoundTripPrice + BookOfTickets + ProgramPrice;
             break;
         case (int)Enums.Category.BoardMember:
             Attendance = true;
             Lunch = true;
             //Индийский код на на всякий случай, авось расширять буду и Lunch из какой нить задницы всплывет
             if (Lunch)
             {
                 LunchPrice = Decimal.Parse(LunchRow["ServiceFee"].ToString());
             }
             ProgramPrice = Decimal.Zero;
             TakeOutPrice = Decimal.Zero;
             MiscellaneousPrice = Decimal.Zero;
             VanPrice = Decimal.Zero;
             BookOfTickets = Decimal.Zero;
             Total = LunchPrice + TakeOutPrice + MiscellaneousPrice + VanPrice + RoundTripPrice + BookOfTickets + ProgramPrice;
             break;
         case (int)Enums.Category.Other:
             Attendance = true;
             Lunch = true;
             //Индийский код на на всякий случай, авось расширять буду и Lunch из какой нить задницы всплывет
             if (Lunch)
             {
                 LunchPrice = Decimal.Parse(LunchRow["ServiceFee"].ToString());
             }
             ProgramPrice = Decimal.Zero;
             TakeOutPrice = Decimal.Zero;
             MiscellaneousPrice = Decimal.Zero;
             VanPrice = Decimal.Zero;
             BookOfTickets = Decimal.Zero;
             Total = LunchPrice + TakeOutPrice + MiscellaneousPrice + VanPrice + RoundTripPrice + BookOfTickets + ProgramPrice;
             break;
     }
 }
Example #5
0
        private void button8_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                int RowIndex = dataGridView1.SelectedCells[0].RowIndex;
                switch (dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells["categoryDataGridViewTextBoxColumn"].Value.ToString())
                {
                    #region Client
                    case "1":
                        tabControl2.SelectedTab = ClientTab;
                        Client client = new Client(Int32.Parse(dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString()));
                        client.Name = textBox_ClientName.Text;
                        client.DateOfBirdh = DateTime.Parse(textBox_ClientBirth.Value.ToShortDateString());
                        client.ParisNumber = textBox_ClientParis.Text;
                        client.Adress.Addres = textBox_ClientAdress.Text;
                        client.Adress.City = textBox_ClientCity.Text;
                        client.Adress.Province = textBox_ClientProvince.Text;
                        client.Adress.Country = textBox_ClientCountry.Text;
                        client.Adress.PostalCode = textBox_ClientPostal.Text;
                        client.Adress.Phone = textBox_ClientPhone.Text;
                        client.Adress.Email = textBox_ClientEmail.Text;
                        client.EmergencyContact.Name = textBox_ClientEmerName.Text;
                        client.EmergencyContact.Phone = textBox_ClientEmPhone.Text;
                        client.EmergencyContact.Relation = textBox_ClientRelation.Text;
                        client.Transportation.HandyDARTNumber = textBox_ClientHD.Text;
                        client.DoctorName = textBox_ClientDocName.Text;
                        client.DoctorPhone = textBoxClientDocPhone.Text;
                        client.Own = radioButton4.Checked;
                        client.PharmacistName = textBox_ClientPharmName.Text;
                        client.PharmacistPhone = textBox_ClientPharmPhone.Text;
                        client.Member = ClientMember.Checked;
                        if (toolStripTextBox_EmName.Visible && client.DopEmergencyContact == null)
                        {
                            client.DopEmergencyContact = new EmergencyContact();
                            client.DopEmergencyContact.Name = toolStripTextBox_EmName.Text;
                            client.DopEmergencyContact.Phone = toolStripTextBox_EmPhone.Text;
                            client.DopEmergencyContact.Relation = toolStripTextBox54.Text;
                            client.DopEmergencyContact.AddEmergencyContactTo(client);
                        }
                        else if (toolStripTextBox_EmName.Visible)
                        {
                            client.DopEmergencyContact.Name = toolStripTextBox_EmName.Text;
                            client.DopEmergencyContact.Phone = toolStripTextBox_EmPhone.Text;
                            client.DopEmergencyContact.Relation = toolStripTextBox54.Text;
                        }

                        client.Attendance.Monday = checkBox2.Checked;
                        client.Attendance.Tuesday = checkBox3.Checked;
                        client.Attendance.Wednesday = checkBox4.Checked;
                        client.Attendance.Thursday = checkBox5.Checked;
                        client.Attendance.Friday = checkBox6.Checked;
                        client.Transportation.Monday = checkBox11.Checked;
                        client.Transportation.Tuesday = checkBox10.Checked;
                        client.Transportation.Wednesday = checkBox9.Checked;
                        client.Transportation.Thursday = checkBox8.Checked;
                        client.Transportation.Friday = checkBox7.Checked;
                        client.Transportation.Address = client.Adress.Addres;
                        client.Transportation.Phone = client.Adress.Phone;
                        if (client.Own) { client.Transportation.Category = "Own"; } else { client.Transportation.Category = "HandyDART"; }
                        client.Update();
                        profilesTableAdapter.Fill(tDayDataSet.Profiles);
                        dataGridView1.Rows[RowIndex].Selected = true;
                        button8.Enabled = false;
                        break;
                    #endregion
                    case "2":
                        Employee employee = new Employee(Int32.Parse(dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString()));
                        employee.Name = textBox_EmpName.Text;
                        employee.DateOfBirdh = DateTime.Parse(textBox_EmpBirth.Value.ToShortDateString());
                        employee.HireDate = DateTime.Parse(textBox_EmpHire.Value.ToShortDateString());
                        employee.Position = textBox_EmpPosition.Text;
                        employee.SIN = textBox_EmpSin.Text;
                        if (radioButton1.Checked) { employee.PositionType = "Causal"; }
                        if (radioButton2.Checked) { employee.PositionType = "Part time"; }
                        if (radioButton3.Checked) { employee.PositionType = "Full time"; }

                        employee.Adress.Addres = textBox_EmpAdress.Text;
                        employee.Adress.City = textBox_EmpCity.Text;
                        employee.Adress.Province = textBox_EmpProvince.Text;
                        employee.Adress.Country = textBox_EmpCountry.Text;
                        employee.Adress.PostalCode = textBox_EmpPostal.Text;
                        employee.Adress.Phone = textBox_EmpPhone.Text;
                        employee.Adress.Email = textBox_EmpEmail.Text;
                        employee.Adress.Cell = textBox_EmpCell.Text;
                        employee.EmergencyContact.Name = textBox_EmpEmerCN.Text;
                        employee.EmergencyContact.Phone = textBox_EmerCP.Text;
                        employee.EmergencyContact.Relation = textBox_EmpRelation.Text;
                        employee.Attendance.Monday = checkBox16.Checked;
                        employee.Attendance.Tuesday = checkBox15.Checked;
                        employee.Attendance.Wednesday = checkBox14.Checked;
                        employee.Attendance.Thursday = checkBox13.Checked;
                        employee.Attendance.Friday = checkBox12.Checked;
                        employee.Update();
                        profilesTableAdapter.Fill(tDayDataSet.Profiles);
                        dataGridView1.Rows[RowIndex].Selected = true;
                        button8.Enabled = false;
                        break;
                    case "3":
                        tabControl2.SelectedTab = VolunteerTab;
                        Profile volonteer = new Profile(Int32.Parse(dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString()));
                        volonteer.Name = textBox_VolName.Text;
                        volonteer.DateOfBirdh = DateTime.Parse(textBox_VolBirth.Value.ToShortDateString());
                        volonteer.Adress.Addres = textBox_VolAdress.Text;
                        volonteer.Adress.City = textBox_VolCity.Text;
                        volonteer.Adress.Province = textBox_VolProvince.Text;
                        volonteer.Adress.Country = textBox_VolCountry.Text;
                        volonteer.Adress.PostalCode = textBox_VolPostal.Text;
                        volonteer.Adress.Phone = textBox_VolPhone.Text;
                        volonteer.Adress.Email = textBox_VolEmail.Text;
                        volonteer.Adress.Cell = textBox_VolCell.Text;
                        volonteer.EmergencyContact.Name = textBox_VolEmerCN.Text;
                        volonteer.EmergencyContact.Phone = textBox_VolEmerCP.Text;
                        volonteer.EmergencyContact.Relation = textBox_VolEmerRelation.Text;
                        volonteer.Attendance.Monday = checkBox21.Checked;
                        volonteer.Attendance.Tuesday = checkBox20.Checked;
                        volonteer.Attendance.Wednesday = checkBox19.Checked;
                        volonteer.Attendance.Thursday = checkBox18.Checked;
                        volonteer.Attendance.Friday = checkBox17.Checked;
                        volonteer.Update();
                        profilesTableAdapter.Fill(tDayDataSet.Profiles);
                        dataGridView1.Rows[RowIndex].Selected = true;
                        button8.Enabled = false;
                        break;
                    case "4":

                        textBox_BoardOccupation.Visible = true;
                        label48.Visible = true;
                        Profile board = new Profile(Int32.Parse(dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString()));
                        board.Name = textBox_BoardName.Text;
                        board.Occupation = textBox_BoardOccupation.Text;
                        board.DateOfBirdh = DateTime.Parse(textBox_BoardBirth.Value.ToShortDateString());
                        board.Adress.Addres = textBox_BoardAdress.Text;
                        board.Adress.City = textBox_BoardCity.Text;
                        board.Adress.Province = textBox_BoardProvince.Text;
                        board.Adress.Country = textBox_BoardCountry.Text;
                        board.Adress.Cell = textBox_BoardCell.Text;
                        board.Adress.PostalCode = textBox_BoardPostal.Text;
                        board.Adress.Phone = textBox_BoardPhone.Text;
                        board.Adress.Email = textBox_BoardEmail.Text;
                        board.Update();
                        profilesTableAdapter.Fill(tDayDataSet.Profiles);
                        dataGridView1.Rows[RowIndex].Selected = true;
                        button8.Enabled = false;
                        break;
                    case "5":
                        textBox_BoardOccupation.Visible = false;
                        label48.Visible = false;
                        Profile other = new Profile(Int32.Parse(dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString()));
                        other.Name = textBox_BoardName.Text;
                        other.DateOfBirdh = DateTime.Parse(textBox_BoardBirth.Value.ToShortDateString());
                        other.Adress.Addres = textBox_BoardAdress.Text;
                        other.Adress.City = textBox_BoardCity.Text;
                        other.Adress.Province = textBox_BoardProvince.Text;
                        other.Adress.Country = textBox_BoardCountry.Text;
                        other.Adress.Cell = textBox_BoardCell.Text;
                        other.Adress.PostalCode = textBox_BoardPostal.Text;
                        other.Adress.Phone = textBox_BoardPhone.Text;
                        other.Adress.Email = textBox_BoardEmail.Text;
                        other.Update();
                        profilesTableAdapter.Fill(tDayDataSet.Profiles);
                        dataGridView1.Rows[RowIndex].Selected = true;
                        button8.Enabled = false;
                        break;
                }
            }
        }