Esempio n. 1
0
        private void btn_ClientReady_Click(object sender, EventArgs e)
        {
            Client desiredClient;
            if (chkBox_newClient.Checked)
            {
                // if new client box is checked add client whilst removing whiteSpace
                desiredClient = new Client(
                    txtBox_firstName.Text.Trim().ToUpperFirstLetter(),
                    txtBox_lastName.Text.Trim().ToUpperFirstLetter());

                if (txtBox_firstName.Text == "" || txtBox_lastName.Text == "")
                {
                    MessageBox.Show("Cannot create a new client when first name or last name is blank");
                    return;
                }

                // clear text boxes
                txtBox_firstName.Text = string.Empty;
                txtBox_lastName.Text = string.Empty;

            }
            else
            {
                // else use client in combobox
                desiredClient = (Client)cmbBox_existingClients.SelectedValue;

            }

            // need to tell main gui we have a client ready to load
            if (ClientReady != null)
            {
                ClientReady(desiredClient,null);
            }
        }
 public ClientData(Client client)
 {
     FirstName = client.FirstName;
     Lastname = client.LastName;
     Notes = client.GetNotes();
     WorkDone = client.AllWorkDone;
 }
Esempio n. 3
0
        /// <summary>
        /// Set the client for this form
        /// </summary>
        /// <param name="client">client to work on</param>
        public void SetClient(Client client)
        {
            Client = client;
            Enabled = true;
            StartTime = DateTime.Now;
            lbl_clientName.Text = Client.FullName;

            // start timer as soon as client loads
            digitalDisplay1.Start();
        }
Esempio n. 4
0
        public void LoadHoldData(HoldData holdData)
        {
            ResetControlData();

            TimeSpan zero = new TimeSpan(0, 0, 0);
            if (GetElapsedTime() != zero)
            {
                // if there is a client loaded with the timer started already
                // We need to decide if we want to throw it away.  Probably will
                // pop up verifying that user wants to throw current away with old one

                // let's just make sure both the hold area and the select Client area are disabled unless the client area is empty
                throw new Exception("Need to have a clear client actions before we load data");
            }
            else
            {
                Client = holdData.Client;
                lbl_clientName.Text = Client.FullName;
                cmbBox_typeOfWorkDone.SelectedItem = holdData.WorkType;
                txtBox_notes.Text = holdData.Notes;
                StartTime = holdData.StartTime;
                digitalDisplay1.SetElapasedTime(holdData.ElapsedTime);
                this.Enabled = true;
                this.Invalidate();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Resets control back to virgin state
        /// </summary>
        public void ResetControlData()
        {
            ((MainGui)((Control)((Control)this.Parent).Parent).Parent).DisableViewClient();
            Enabled = false;
            EnableClientSelection();
            Client = null;
            digitalDisplay1.Stop();
            digitalDisplay1.Reset();
            cmbBox_typeOfWorkDone.SelectedIndex = 0;

            lbl_clientName.Text = string.Empty;
            txtBox_notes.Text = string.Empty;
        }
Esempio n. 6
0
 /// <summary>
 /// Adds a Client to master list
 /// </summary>
 /// <param name="cl">Client to add</param>
 public void AddClient(Client cl)
 {
     ClientList.Add(cl);
 }
Esempio n. 7
0
        /// <summary>
        /// load clients from xml file
        /// </summary>
        private void LoadClients()
        {
            ClientList = new List<Client>();
            FileInfo fi = new FileInfo("ClientTrackerData.xml");
            try
            {
                using (TextReader tr = new StreamReader(fi.Name))
                {
                    string xml = tr.ReadToEnd();

                    XmlDocument xDoc = new XmlDocument();
                    xDoc.LoadXml(xml);
                    var cl = (ClientTrackerData)Serialization.Serializer.Deserialize(xDoc, typeof(ClientTrackerData));
                    foreach (ClientData d in cl.ClData)
                    {
                        Client c = new Client(d);
                        AddClient(c);
                    }
                }
            }
            catch (FileNotFoundException)
            {
                MessageBox.Show("Unable to find Client Tracker Data file\r\nIf this is the first " +
                    "time you have ran this a new file will be created\r\nIf this is not your first time" +
                    " running Client Tracker, restore a backup");
                return;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Set client from getClient Control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void getClient1_ClientReady(object sender, EventArgs e)
        {
            //elementHost1.Enabled = true;

            Client c = (Client)sender;
            if (c == null)
            {
                MessageBox.Show("Please select a client");
                // let user select another client
                EnableClientSelection();
                return;
            }

            // if full name of client matches another full name, and a new client was supposed to be created
            if (GetClientList().Any(x => x.FullName.ToLower() == c.FullName.ToLower()) && getClient1.NewClientChecked)
            {
                // if client is already in list & we checked new client,
                Client duplicate = new Client(c.FirstName + "X",c.LastName);

                // warning message for duplicate name entry
                string warnMsg = c.FullName + " is already listed as a client\r\nIf you proceed, "
                    + duplicate.FullName + " will be used instead";

                var dr = MessageBox.Show(warnMsg, "Client Already In List", MessageBoxButtons.OKCancel);
                if (dr == DialogResult.OK)
                {
                    // if user wants to add another client with same name(X appended to first name)
                    c = duplicate;
                    AddClient(c);
                }
                else
                {
                    // let user select another client
                    EnableClientSelection();
                    return;
                }
            }
            else if (getClient1.NewClientChecked)
            {
                // else if new client checked add them to the list
                ClientList.Add(c);
            }

            // set client in client view
            ((wpfForms.ViewClient)(elementHost1.Child)).SetClient(c);

            // set client that we want to work on
            clientActions1.SetClient(c);

            DisableClientSelection();
            getClient1.RebindCmbBoxDataSrc();
        }
Esempio n. 9
0
 /// <summary>
 /// Removes a client from the master list
 /// </summary>
 /// <param name="cl">Client to remove</param>
 public void RemoveClient(Client cl)
 {
     ClientList.Remove(cl);
 }