Пример #1
0
        public bool PositionUpdate(BizPosition supplierPosition)
        {
            var _result = true;

            lock (GParams.Instance.ComLockObj)
            {
                try
                {
                    var _row = GParams.Instance.PositionsTable.FetchByNo(supplierPosition.PositionNo);
                    if (_row != null)
                    {
                        supplierPosition.ConvertToDataRow(ref _row);

                        supplierPosition.LastChange = DateTime.Now;

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

            return(_result);
        }
Пример #2
0
        public bool PositionCreate(BizPosition supplierPosition)
        {
            var _result = true;

            //Check for Min
            if (!supplierPosition.CheckForMin())
            {
                throw new Exception("min Informations not Filled");
            }

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

                    supplierPosition.LastChange = DateTime.Now;

                    supplierPosition.ConvertToDataRow(ref _newRow);

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

            return(_result);
        }