예제 #1
0
        public Guid?SupplierCreate(BizSupplierer supplier)
        {
            if (!supplier.SupplierId.HasValue)
            {
                supplier.SupplierId = Guid.NewGuid();
            }

            supplier.SupplierNo = GParams.Instance.SupplierTable.GetNextSupplierNo();

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

                    supplier.ConvertToDataRow(ref _newRow);

                    GParams.Instance.SupplierTable.Rows.Add(_newRow);
                    GParams.Instance.SupplierTable.SaveDataTable(GParams.Instance.ApplicationDataPath);
                }
                catch (Exception)
                {
                    supplier.SupplierId = null;
                }
            }

            return(supplier.SupplierId);
        }
예제 #2
0
        public BizSupplierer[] SupplierGetAll()
        {
            var _resultList = new List <BizSupplierer>();

            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _rows = GParams.Instance.SupplierTable.Select(string.Empty, "SupplierNo ASC");
                    if (_rows.Length > 0)
                    {
                        foreach (var _row in _rows)
                        {
                            _resultList.Add(BizSupplierer.ConvertFromDataRow(_row));
                        }
                    }
                }
                catch
                {
                    // ignored
                }
            }

            return(_resultList.Count > 0 ? _resultList.ToArray() : null);
        }
예제 #3
0
        public bool SetSupplierToReturned(Guid?supplierId, DateTime?dateTime)
        {
            var _result = true;

            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _row = GParams.Instance.SupplierTable.FetchById(supplierId);
                    if (_row != null)
                    {
                        var _supplierObj = BizSupplierer.ConvertFromDataRow(_row);

                        if (dateTime.HasValue)
                        {
                            _supplierObj.ReturnedToSupplier = dateTime.Value;
                        }
                        else
                        {
                            _supplierObj.ReturnedToSupplier = null;
                        }

                        this.SupplierUpdate(_supplierObj);
                    }
                }
                catch
                {
                    _result = false;
                }
            }

            return(_result);
        }
예제 #4
0
        public static DialogResult HandleImport(IWin32Window owner, string fileName, BizSupplierer supplier)
        {
            if (System.IO.File.Exists(fileName))
            {
                var _fileInfo = new System.IO.FileInfo(fileName);
                var _frm      = new ImportPositionForm();

                if (string.Compare(_fileInfo.Extension, ".csv", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (_frm.ReadPositonCsv(fileName))
                    {
                        _frm.m_fileName = fileName;
                        _frm.m_supplier = supplier;

                        return(_frm.ShowDialog(owner));
                    }
                }
                else if (string.Compare(_fileInfo.Extension, ".xml", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    if (_frm.ReadPositionXml(fileName))
                    {
                        _frm.m_fileName = fileName;
                        _frm.m_supplier = supplier;

                        return(_frm.ShowDialog(owner));
                    }
                }
            }
            return(DialogResult.None);
        }
예제 #5
0
 private void SupplierToSceen(BizSupplierer supplier)
 {
     this.m_supplierNoTb.Text = supplier.SupplierNo.ToString();
     this.m_suplTitelTb.Text  = supplier.Salutation;
     this.m_suplNameTb.Text   = string.Format("{0}, {1}", supplier.LastName, supplier.FirstName);
     this.m_suplAdressTb.Text = string.Format("{0}\r\n{1} {2}", supplier.Adress, supplier.ZipCode, supplier.Town);
 }
        private void AddListViewLine(BizSupplierer supplier, BizPosition position)
        {
            var _lvItem = new ListViewItem(position.PositionNo.ToString());

            _lvItem.SubItems.Add(position.Material);
            _lvItem.SubItems.Add(position.Category);
            _lvItem.SubItems.Add(position.Manufacturer);
            _lvItem.SubItems.Add(position.PriceMax.ToString() + " €");
            _lvItem.SubItems.Add(position.PriceMin.ToString() + " €");
            _lvItem.SubItems.Add(position.SoldFor.ToString() + " €");
            _lvItem.SubItems.Add(position.ReturnedToSupplierAt.ToString());

            if (position.SoldFor.HasValue)
            {
                _lvItem.Group = this.m_soldItemsGroup;
            }
            else
            {
                _lvItem.Group = this.m_notSoldItemsGroup;
            }

            if (position.SoldFor.HasValue)
            {
                this.m_soldProceSum += position.SoldFor.Value;
            }

            this.m_screenLv.Items.Add(_lvItem);
        }
예제 #7
0
        public SupplierLvItem(BizSupplierer supl)
        {
            this.DataObj = supl;

            this.Text = supl.SupplierNo.ToString();
            this.SubItems.Add(supl.Salutation);
            this.SubItems.Add(supl.LastName + ", " + supl.FirstName);
            this.SubItems.Add(supl.Adress);
            this.SubItems.Add(supl.ZipCode);
            this.SubItems.Add(supl.Town);
        }
예제 #8
0
        public static BizSupplierer SearchSupl(IWin32Window owner)
        {
            var           _frm    = new SellerSearchForm();
            BizSupplierer _result = null;

            if (_frm.ShowDialog(owner) == DialogResult.OK)
            {
                _result = ((SupplierLvItem)_frm.m_takeBtn.Tag).DataObj;
            }

            return(_result);
        }
예제 #9
0
        public bool SupplierUpdate(BizSupplierer supplier)
        {
            if (!BasarCom.CheckComCounter())
            {
                throw new Exception("Maximale Anzahl der Aufrufe erreicht!");
            }

            var _result = GParams.Instance.Supplier.SupplierUpdate(supplier);

            BasarCom.ShowStati();
            return(_result);
        }
예제 #10
0
        public static DialogResult HandleReturn(IWin32Window owner, BizSupplierer supplier, BizPosition[] positions)
        {
            var _frm = new ReturnPositionsForm();

            _frm.m_supplier = supplier;

            if (_frm.ReLoadhRestScreen(positions) > 0)
            {
                _frm.ShowDialog(owner);
                return(DialogResult.OK);
            }
            return(DialogResult.Abort);
        }
예제 #11
0
        public BizSupplierer SupplierGet_ByID(Guid id)
        {
            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _row = GParams.Instance.SupplierTable.FetchById(id);

                    return(BizSupplierer.ConvertFromDataRow(_row));
                }
                catch
                {
                    // ignored
                }
            }

            return(null);
        }
예제 #12
0
        public BizSupplierer SupplierGet_No(int supplierNumber)
        {
            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _row = GParams.Instance.SupplierTable.FetchByNo(supplierNumber);

                    return(BizSupplierer.ConvertFromDataRow(_row));
                }
                catch
                {
                    // ignored
                }
            }

            return(null);
        }
예제 #13
0
        private void SetActualSupplier(BizSupplierer supplier)
        {
            this.Reset();

            if (supplier != null)
            {
                this.m_supplierInfoGb.Tag = supplier;

                this.m_supplierNoTb.Text = supplier.SupplierNo.ToString();
                this.m_suplTitelTb.Text  = supplier.Salutation;
                this.m_suplNameTb.Text   = string.Format("{0}, {1}", supplier.LastName, supplier.FirstName);
                this.m_suplAdressTb.Text = string.Format("{0}\r\n{1} {2}", supplier.Adress, supplier.ZipCode, supplier.Town);

                this.m_returnedTb.Text    = "Rückgabe am / um:   " + supplier.ReturnedToSupplier.ToString();
                this.m_returnedTb.Visible = supplier.ReturnedToSupplier.HasValue;
            }

            if (this.SupplierSet != null)
            {
                this.SupplierSet(this, new SupplierSetArgs(this.ActualSupplier));
            }
        }
예제 #14
0
        public bool SupplierUpdate(BizSupplierer supplier)
        {
            var _result = true;

            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _row = GParams.Instance.SupplierTable.FetchById(supplier.SupplierId);
                    if (_row != null)
                    {
                        supplier.ConvertToDataRow(ref _row);

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

            return(_result);
        }
예제 #15
0
        public static BizSupplierer EnterNewSupplier(IWin32Window owner)
        {
            var           _frm    = new NewSellerform();
            BizSupplierer _result = null;

            if (_frm.ShowDialog(owner) == DialogResult.OK)
            {
                _result = new BizSupplierer();

                _result.Salutation = _frm.m_sellerTitelCb.Text;
                _result.LastName   = _frm.m_sellerNameTb.Text;
                _result.FirstName  = _frm.m_sellerVNameTb.Text;

                _result.Adress  = _frm.m_sellerStreetTb.Text;
                _result.ZipCode = _frm.m_sellerZipTb.Text;
                _result.Town    = _frm.m_sellerTownTb.Text;

                _result.Phone01 = _frm.m_sellerPhoneTb.Text;

                _result.Memo = _frm.m_sellerDescRtb.Text;
            }

            return(_result);
        }
예제 #16
0
 public SupplierSetArgs(BizSupplierer supplier)
 {
     this.Supplier = supplier;
 }