Пример #1
0
        private void EditToo()
        {
            if (lvToo.Items == null || lvToo.Items.Count == 0)
            {
                return;
            }
            string txtId;
            string txt;

            if (lvToo.SelectedItems == null || lvToo.SelectedItems.Count == 0)
            {
                lvSpec.Items[0].Selected = true;
                txtId = lvToo.Items[0].Text;
                txt   = lvToo.Items[0].SubItems[1].Text;
            }
            else
            {
                txtId = lvToo.SelectedItems[0].Text;
                txt   = lvToo.SelectedItems[0].SubItems[1].Text;
            }

            for (var i = 0; i < lvToo.Items.Count; i++)
            {
                if (lvToo.Items[i].Text == txtId)
                {
                    var obj  = new TypeOfOwnership(Convert.ToInt32(txtId), txt);
                    var data = DirectoryItemEditorForm.EditToo(obj);
                    DataManager.TooEdit(data);
                    lvToo.SelectedItems[0].SubItems[1].Text = data.Name;
                    break;
                }
            }
        }
Пример #2
0
        private void butSpecAdd_Click(object sender, EventArgs e)
        {
            var data = DirectoryItemEditorForm.AddSpec();

            if (data != null)
            {
                DataManager.Specializations.Add(data);
                lvSpec.Items.Add(new ListViewItem(new string[] { data.Id.ToString(), data.Name }));
            }
        }
Пример #3
0
        private void butTooAdd_Click(object sender, EventArgs e)
        {
            var data = DirectoryItemEditorForm.AddToo();

            if (data != null)
            {
                DataManager.TypeOfOwnerships.Add(data);
                lvToo.Items.Add(new ListViewItem(new string[] { data.Id.ToString(), data.Name }));
            }
        }
Пример #4
0
        public static Specialization AddSpec()
        {
            var win = new DirectoryItemEditorForm();
            var id  = DataManager.SpecGetNewId();

            win.lbId.Text = id.ToString();
            if (win.ShowDialog() == DialogResult.OK)
            {
                var obj = new Specialization(Convert.ToInt32(win.lbId.Text), win.tbName.Text);
                return(obj);
            }
            return(null);
        }
Пример #5
0
        public static TypeOfOwnership AddToo()
        {
            var win = new DirectoryItemEditorForm();
            var id  = DataManager.TooGetNewId();

            win.lbId.Text = id.ToString();
            if (win.ShowDialog() == DialogResult.OK)
            {
                var obj = new TypeOfOwnership(Convert.ToInt32(win.lbId.Text), win.tbName.Text);
                return(obj);
            }
            return(null);
        }
Пример #6
0
        public static TypeOfOwnership EditToo(TypeOfOwnership data)
        {
            var win = new DirectoryItemEditorForm
            {
                lbId   = { Text = data.Id.ToString() },
                tbName = { Text = data.Name }
            };

            if (win.ShowDialog() == DialogResult.OK)
            {
                var obj = new TypeOfOwnership(Convert.ToInt32(win.lbId.Text), win.tbName.Text);
                return(obj);
            }
            return(data);
        }
Пример #7
0
        public static Specialization EditSpec(Specialization data)
        {
            var win = new DirectoryItemEditorForm
            {
                lbId   = { Text = data.Id.ToString() },
                tbName = { Text = data.Name }
            };

            if (win.ShowDialog() == DialogResult.OK)
            {
                var obj = new Specialization(Convert.ToInt32(win.lbId.Text), win.tbName.Text);
                return(obj);
            }

            return(data);
        }