コード例 #1
0
        public bool ManufacturerCreate(BizManufacturer manufacturer)
        {
            var _result = true;

            if (!manufacturer.Id.HasValue)
            {
                manufacturer.Id = Guid.NewGuid();
            }

            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _newRow = GParams.Instance.ManufacturerTable.NewRow();

                    manufacturer.ConvertToDataRow(ref _newRow);

                    GParams.Instance.ManufacturerTable.Rows.Add(_newRow);
                    GParams.Instance.ManufacturerTable.SaveDataTable(GParams.Instance.ApplicationDataPath);
                }
                catch (Exception)
                {
                    _result = false;
                }
            }

            return(_result);
        }
コード例 #2
0
        public bool ManufacturerUpdate(BizManufacturer materialCategory)
        {
            if (!BasarCom.CheckComCounter())
            {
                throw new Exception("Maximale Anzahl der Aufrufe erreicht!");
            }

            return(GParams.Instance.MasterData.ManufacturerUpdate(materialCategory));
        }
コード例 #3
0
        public BizManufacturer ManufacturerGet(Guid id)
        {
            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _row = GParams.Instance.ManufacturerTable.FetchById(id);
                    if (_row != null)
                    {
                        return(BizManufacturer.ConvertFromDataRow(_row));
                    }
                }
                catch
                {
                    // ignored
                }
            }

            return(null);
        }
コード例 #4
0
        private void m_addCatBtn_Click(object sender, EventArgs e)
        {
            if (!this.m_addCatBtn.Enabled)
            {
                return;
            }

            try
            {
                var _newManuf = new BizManufacturer();
                _newManuf.Designation = this.m_catInputTb.Text;

                var _created     = false;
                var _createdSpec = false;

                GParams.Instance.BasarCom.ManufacturerCreate(_newManuf, out _created, out _createdSpec);

                if (_created && _createdSpec)
                {
                    this.ReloadList();

                    this.m_addCatBtn.Enabled = false;

                    this.m_catInputTb.ResetText();
                    this.m_catInputTb.Focus();
                }
                else
                {
                    MessageBox.Show("Hersteller konnte nicht erzeugt werden");
                }
            }
            catch (Exception _ex)
            {
                MessageBox.Show(_ex.Message);
            }
        }
コード例 #5
0
        public bool ManufacturerUpdate(BizManufacturer materialCategory)
        {
            var _result = true;

            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _row = GParams.Instance.ManufacturerTable.FetchById(materialCategory.Id);
                    if (_row != null)
                    {
                        materialCategory.ConvertToDataRow(ref _row);

                        GParams.Instance.ManufacturerTable.SaveDataTable(GParams.Instance.ApplicationDataPath);
                    }
                }
                catch
                {
                    _result = false;
                }
            }

            return(_result);
        }
コード例 #6
0
        public ManufacturerListViewItem(BizManufacturer manuf)
        {
            this.DataObj = manuf;

            this.Text = this.DataObj.Designation;
        }
コード例 #7
0
        private void OnNewMatlDescItembtn(object sender, EventArgs e)
        {
            string _labelText = null;

            if (sender == this.m_newMatlCatBtn)
            {
                _labelText = "Bitte neue \"Kategorie\" eingeben";
            }
            else if (sender == this.m_newMatlManufBtn)
            {
                _labelText = "Bitte neuen \"Hersteller\" eingeben";
            }
            else
            {
                return;
            }

            var _value = string.Empty;

            if (InputTextForm.RequestInput(this, _labelText, ref _value))
            {
                if (sender == this.m_newMatlCatBtn)
                {
                    var _newCate = GParams.Instance.GetMaterialCategoryByName(_value);
                    if (_newCate == null)
                    {
                        _newCate             = new BizMaterialCategory();
                        _newCate.Designation = _value;

                        var _created     = false;
                        var _createdSpec = false;

                        GParams.Instance.BasarCom.MaterialCategoryCreate(_newCate, out _created, out _createdSpec);

                        if (_created && _createdSpec)
                        {
                            this.ReloadCategoryComboBox();
                        }
                        else
                        {
                            MessageBox.Show("Kategorie konnte nicht erzeugt werden");
                            _newCate = null;
                        }
                    }
                    if (_newCate != null)
                    {
                        this.m_posCatCb.Text = _newCate.Designation;
                    }
                }
                else if (sender == this.m_newMatlManufBtn)
                {
                    var _newManuf = GParams.Instance.GetManufacturerByName(_value);
                    if (_newManuf == null)
                    {
                        _newManuf             = new BizManufacturer();
                        _newManuf.Designation = _value;

                        var _created     = false;
                        var _createdSpec = false;

                        GParams.Instance.BasarCom.ManufacturerCreate(_newManuf, out _created, out _createdSpec);

                        if (_created && _createdSpec)
                        {
                            this.ReloadManufComboBox();
                        }
                        else
                        {
                            MessageBox.Show("Hersteller konnte nicht erzeugt werden");
                            _newManuf = null;
                        }
                    }
                    if (_newManuf != null)
                    {
                        this.m_herstellerCb.Text = _newManuf.Designation;
                    }
                }
            }
        }