예제 #1
0
        private void cmdNew_Click(object sender, EventArgs e)
        {
            ManageClients frmClients    = new ManageClients(true);
            List <Client> lstclients    = frmClients.ReturnClientSelection();
            ClientGroup   selectedGroup = (ClientGroup)dgvGroups.SelectedRows[0].Tag;

            selectedGroup = TravelAgenceMasterClass.TravelAgencyContext.ClientGroups.Where(cg => cg.ClientGroupID == selectedGroup.ClientGroupID).SingleOrDefault();

            dgvClients.Rows.Clear();
            int i;

            if (lstclients.Count > 0)
            {
                for (i = 0; i < lstclients.Count; i++)
                {
                    Client clientToAdd = lstclients.ElementAt(i);
                    if (!selectedGroup.Clients.Contains(clientToAdd))
                    {
                        Client c = TravelAgenceMasterClass.TravelAgencyContext.Clients.Where(client => client.ClientID == clientToAdd.ClientID).SingleOrDefault();
                        selectedGroup.Clients.Add(c);
                    }
                }
            }
            TravelAgenceMasterClass.TravelAgencyContext.SaveChanges();
            LoadClientsForSelectedGtoup();
        }
예제 #2
0
        private void cmdSearchClients_Click(object sender, EventArgs e)
        {
            ManageClients frmClients = new ManageClients(false);

            frmClients.ShowDialog();
            Client client = frmClients.getSelectedClient();

            if (client != null)
            {
                txtClientName.Text = client.FullName;
                txtClientName.Tag  = client;
            }
        }
예제 #3
0
        private void btnClients_Click(object sender, EventArgs e)
        {
            foreach (Form f in Application.OpenForms)
            {
                if (f.GetType() == typeof(ManageClients))
                {
                    f.WindowState = System.Windows.Forms.FormWindowState.Maximized;
                    return;
                }
            }
            ManageClients m = new ManageClients(true);

            m.MdiParent   = this;
            m.WindowState = FormWindowState.Maximized;
            m.Show();
        }
예제 #4
0
 public EditClient(ManageClients frmManageClients, Client c)
 {
     InitializeComponent();
     this.cl = c;
     this.frmManageClients = frmManageClients;
     txtAddress.Text       = c.Address;
     txtFirstName.Text     = c.FirstName;
     txtLastName.Text      = c.LastName;
     txtMiddleName.Text    = c.MiddleName;
     txtEmail.Text         = c.Email;
     txtTitle.Text         = c.Title;
     txtCellPhone1.Text    = c.CellPhone1;
     txtCellPhone2.Text    = c.CellPhone2;
     txtHomePhone.Text     = c.HomePhone;
     txtOfficePhone.Text   = c.OfficePhone;
     txtVerfiyEmail.Text   = c.Email;
     if (!(string.IsNullOrEmpty(c.ProfilePictureName)))
     {
         clientPhotoPicBox.ImageLocation = TravelAgenceMasterClass.CurrentBranch.FilesPath + "\\" + c.DateCreated.Value.Year + "\\" + c.ClientID.ToString() + "\\" + c.ProfilePictureName;
     }
     if (Directory.Exists(TravelAgenceMasterClass.CurrentBranch.FilesPath + "\\" + c.DateCreated.Value.Year + "\\" + c.ClientID.ToString()))
     {
         String[] files = Directory.GetFiles(TravelAgenceMasterClass.CurrentBranch.FilesPath + "\\" + c.DateCreated.Value.Year + "\\" + c.ClientID.ToString());
         foreach (string file in files)
         {
             if (!file.Equals(clientPhotoPicBox.ImageLocation))
             {
                 DataGridViewRow         row      = new DataGridViewRow();
                 DataGridViewTextBoxCell FileName = new DataGridViewTextBoxCell();
                 FileName.Value = file.Split(new char[] { '\\' }).Last();
                 FileName.Tag   = file;
                 row.Cells.Add(FileName);
                 DataGridViewImageCell image = new DataGridViewImageCell();
                 image.Value = TravelAgency.Properties.Resources.remove16;
                 row.Cells.Add(image);
                 dgvAttachments.Rows.Add(row);
                 dgvAttachments.Height += row.Height;
             }
         }
     }
 }