Esempio n. 1
0
 public SelectBaseForm(IBaseRepo repo)
 {
     InitializeComponent();
     _repo = repo;
     _item = new BaseBl();
     Bind();
 }
Esempio n. 2
0
        private void simpleButtonAddBase_Click(object sender, EventArgs e)
        {
            var form = new EditBaseForm(_repo);

            if (form.ShowDialog() == DialogResult.OK)
            {
                _item = form._item;
                Bind();
                form.Dispose();
            }
        }
Esempio n. 3
0
        public EditBaseForm(IBaseRepo repo, BaseBl item = null)
        {
            InitializeComponent();
            _repo = repo;
            _item = item;

            if (item != null)
            {
                Text = "Редактирование базы";
            }
            else
            {
                Text  = "Новая база";
                _item = new BaseBl();
            }

            textEditName.DataBindings.Add("EditValue", _item, nameof(_item.Name), true, DataSourceUpdateMode.OnPropertyChanged);
            textEditComment.DataBindings.Add("EditValue", _item, nameof(_item.Comment), true, DataSourceUpdateMode.OnPropertyChanged);
        }
Esempio n. 4
0
        private void simpleButtonSave_Click(object sender, EventArgs e)
        {
            ProcessTabKey(true);

            if (Validation() == false)
            {
                return;
            }

            if (_item.Id == 0)
            {
                _item = _repo.Add(_item);
            }
            else
            {
                _repo.Update(_item);
            }

            DialogResult = DialogResult.OK;
        }
Esempio n. 5
0
 private void CreateBaseLabel(BaseBl item)
 {
     layoutControl1.BeginUpdate();
     try
     {
         // Create a layout item that will display a new base
         SimpleLabelItem simpleLabel = new SimpleLabelItem();
         simpleLabel.Parent = layoutControlGroup1;
         simpleLabel.Name   = "simpleLabelBase" + item.Id;
         simpleLabel.Text   = $"{item.Name} ({item.Comment})";
         simpleLabel.Tag    = item;
         //simpleLabel.OptionsToolTip.ToolTip = $"{item.Name} ({item.Comment})";
         //simpleLabel.OptionsToolTip.ImmediateToolTip = true;
         simpleLabel.DoubleClick += new System.EventHandler(this.lable_DoubleClick);
         simpleLabel.Move(layoutControlItemButtonBase, InsertType.Top);
     }
     finally
     {
         // Unlock and update the layout control.
         layoutControl1.EndUpdate();
     }
 }
Esempio n. 6
0
        public BaseBl Update(BaseBl item)
        {
            var dto = _service.Update(item?.ToDto());

            return(dto != null ? new BaseBl(dto) : null);
        }
Esempio n. 7
0
        public BaseBl Add(BaseBl item)
        {
            var dto = _service.Add(item?.ToDto());

            return(dto != null ? new BaseBl(dto) : null);
        }