Пример #1
0
        private ListViewItem CreateItemListWorkshops(MyWorkshop mw)
        {
            ListViewItem lvi = new ListViewItem(mw.Name);

            lvi.SubItems.Add(mw.Chief.FullName);
            lvi.SubItems.Add(mw.NumberOfWorkers.ToString());
            lvi.SubItems.Add(mw[0].Name + "...");
            return(lvi);
        }
Пример #2
0
        private void AddItemListWorkshopsForFile(MyWorkshop mw)
        {
            ListViewItem lvi = new ListViewItem(mw.Name);

            lvi.SubItems.Add(mw.Chief.FullName);
            lvi.SubItems.Add(mw.NumberOfWorkers.ToString());
            lvi.SubItems.Add(mw[0].Name + "...");
            listWorkshops.Items.Add(lvi);
        }
Пример #3
0
 private void listWorkshops_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
 {
     if (listWorkshops.FocusedItem != null)
     {
         if (workshops.ContainsKey(listWorkshops.FocusedItem.Text))
         {
             currentWorkshop = workshops[listWorkshops.FocusedItem.Text];
         }
     }
 }
Пример #4
0
        private void AddItemListWorkshops(MyWorkshop mw)
        {
            ListViewItem lvi = new ListViewItem(mw.Name);

            lvi.SubItems.Add(mw.Chief.FullName);
            lvi.SubItems.Add(mw.NumberOfWorkers.ToString());
            lvi.SubItems.Add(mw[0].Name + "...");
            listWorkshops.Items.Add(lvi);
            listWorkshops.Items[listWorkshops.Items.IndexOf(lvi)].Focused  = true;
            listWorkshops.Items[listWorkshops.Items.IndexOf(lvi)].Selected = true;
        }
Пример #5
0
        public void Paste()
        {
            Form1 frm = (Form1)this.MdiParent;

            currentWorkshop = frm.BufferedWorkshop;
            if (!workshops.ContainsKey(currentWorkshop.Name))
            {
                workshops.Add(currentWorkshop.Name, currentWorkshop);
                AddItemListWorkshops(currentWorkshop);
            }
            frm.BufferedWorkshop = null;
        }
Пример #6
0
 private void OuterAdd(MyWorkshop[] works)
 {
     for (int i = 0; i < works.Length; i++)
     {
         if (!workshops.ContainsKey(works[i].Name))
         {
             workshops.Add(works[i].Name, works[i]);
             AddItemListWorkshopsForFile(works[i]);
             currentWorkshop = works[i];
         }
     }
     listWorkshops.Items[listWorkshops.Items.Count - 1].Focused  = true;
     listWorkshops.Items[listWorkshops.Items.Count - 1].Selected = true;
 }
Пример #7
0
        //private void listWorkshops_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    currentWorkshop = workshops[listWorkshops.FocusedItem.Text];
        //}

        private void EditWorkshop()
        {
            if (listWorkshops.FocusedItem != null)
            {
                int index = listWorkshops.Items.IndexOf(listWorkshops.FocusedItem);
                workshops.Remove(currentWorkshop.Name);
                EditItemForm eif = new EditItemForm(currentWorkshop);
                eif.ShowDialog();
                currentWorkshop = eif.EditedWorkshop;
                workshops.Add(currentWorkshop.Name, currentWorkshop);
                ListViewItem lvi2 = CreateItemListWorkshops(currentWorkshop);
                listWorkshops.Items[index] = lvi2;
            }
            else
            {
                MessageBox.Show("Выберите элемент из списка");
            }
        }
Пример #8
0
        private void Add()
        {
            AddItemForm aif = new AddItemForm();

            aif.ShowDialog();
            if (aif.AddedWorkshop.Name != "Отмена")
            {
                if (aif.AddedWorkshop.Name != "" && aif.AddedWorkshop.ListOfTheProductRange.Count > 0)
                {
                    currentWorkshop = aif.AddedWorkshop;
                    workshops.Add(currentWorkshop.Name, currentWorkshop);
                    AddItemListWorkshops(currentWorkshop);
                }
                else
                {
                    MessageBox.Show("Введены неверные данные");
                    return;
                }
            }
            else
            {
                return;
            }
        }
Пример #9
0
 public EditItemForm(MyWorkshop editedWorkshop)
 {
     InitializeComponent();
     mw = editedWorkshop;
 }