Ejemplo n.º 1
0
        public Record(Saleman SM)
        {
            InitializeComponent();
            LabelName.Text     = SM.getFname().ToUpper();
            labelLastName.Text = SM.getLname().ToUpper();
            num.Text           = SM.getStNum().ToString();
            street.Text        = SM.getStreet();
            area.Text          = SM.getSurb();
            code.Text          = SM.getCode().ToString();
            State.Text         = SM.getState();
            phone.Text         = "0" + SM.getPhone().ToString();
            mail.Text          = SM.getMail();
            sales.Text         = SM.getSales().ToString();

            this.Text = "SalesMan " + SM.getFname().ToUpper() + " " + SM.getLname().ToUpper() + " Details";
        }
Ejemplo n.º 2
0
        //adds a new salesman to the system by filling in a form
        private void button1_Click(object sender, EventArgs e)
        {
            Saleman rec = null;

            if (rec == null)
            {
                rec = new Saleman();
                if (rec.ShowDialog() == DialogResult.OK)
                {
                    if (rec.getFname().Length != 0 && rec.getLname().Length != 0)
                    {
                        salesman[count + 1] = new Saleman(rec.getFname(), rec.getLname(), rec.getStNum(), rec.getStreet(), rec.getSurb(), rec.getCode(), rec.getState(), rec.getPhone(), rec.getMail(), rec.getSales());
                        count++;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string selIterm = (string)listBox.SelectedItem;

            for (int i = 0; i < max; i++)
            {
                if (salesman[i] != null)
                {
                    if (selIterm == salesman[i].getFname() + " " + salesman[i].getLname())
                    {
                        Saleman edit = null;
                        if (edit == null)
                        {
                            edit = new Saleman(salesman[i].getFname(), salesman[i].getLname(), salesman[i].getStNum(), salesman[i].getStreet(), salesman[i].getSurb(), salesman[i].getCode(), salesman[i].getState(), salesman[i].getPhone(), salesman[i].getMail(), salesman[i].getSales());
                            edit.editSalesman("Edit Salesman");
                            edit.disableStateInput();
                            if (edit.ShowDialog() == DialogResult.OK)
                            {
                                salesman[i].setSalesman(edit.getFname(), edit.getLname(), edit.getStNum(), edit.getStreet(), edit.getSurb(), edit.getCode(), edit.getState(), edit.getPhone(), edit.getMail(), edit.getSales());
                                tsLabel.Text = "Team Total Sales $" + calTeamSales().ToString();
                            }
                        }
                    }
                }
            }
        }
        private void edit_Click(object sender, EventArgs e)
        {
            Object name;

            while (checkedListBox.CheckedItems.Count > 0)
            {
                name = checkedListBox.CheckedItems[0];
                char[]   sep   = new char[] { ' ' };         // separator character
                string[] parts = name.ToString().Split(sep); // remove spaces

                for (int i = 0; i < total; i++)
                {
                    if (salesmen[i] != null)
                    {
                        if (salesmen[i].getFname().Equals(parts[0]) && salesmen[i].getLname().Equals(parts[1]))
                        {
                            Saleman edit = null;
                            if (edit == null)
                            {
                                edit = new Saleman(salesmen[i].getFname(), salesmen[i].getLname(), salesmen[i].getStNum(), salesmen[i].getStreet(), salesmen[i].getSurb(), salesmen[i].getCode(), salesmen[i].getState(), salesmen[i].getPhone(), salesmen[i].getMail(), salesmen[i].getSales());
                                edit.editSalesman("Edit Salesman");
                                if (edit.ShowDialog() == DialogResult.OK)
                                {
                                    salesmen[i].setSalesman(edit.getFname(), edit.getLname(), edit.getStNum(), edit.getStreet(), edit.getSurb(), edit.getCode(), edit.getState(), edit.getPhone(), edit.getMail(), edit.getSales());
                                }
                            }
                        }
                    }
                }
                checkedListBox.Items.Remove(name);
            }
            ListSalesman_Click(new Object(), EventArgs.Empty);
        }
Ejemplo n.º 5
0
        private void addSalesman_Click(object sender, EventArgs e)
        {
            Saleman newSaleman = new Saleman();

            newSaleman.setArea(location);
            newSaleman.disableStateInput();
            newSaleman.editSalesman("Add Salesman");
            if (newSaleman.ShowDialog() == DialogResult.OK)
            {
                if (newSaleman.getFname().Length != 0 && newSaleman.getLname().Length != 0)
                {
                    salesman[itr] = new Saleman(newSaleman.getFname(), newSaleman.getLname(), newSaleman.getStNum(), newSaleman.getStreet(), newSaleman.getSurb(), newSaleman.getCode(), newSaleman.getState(), newSaleman.getPhone(), newSaleman.getMail(), newSaleman.getSales());
                    itr++;
                    tsLabel.Text = "Team Total Sales $" + calTeamSales().ToString();
                }
            }
        }