public BOInventoryAdjustmentLine(Accountant accountant, InventoryAdjustment _ia, InventoryAdjustmentLine _line, BOContext context)
     : base(accountant, context)
 {
     mObjectID = BOType.BOInventoryAdjustmentLine;
     mInventoryAdjustmentEntity = _ia;
     mDataSource = _line;
     mDataSource.InventoryAdjustment = _ia;
     mDataProxy = mDataSource.Clone() as InventoryAdjustmentLine;
     mDataProxy.Evaluate();
 }
Пример #2
0
        protected override OpResult _Store(InventoryAdjustmentLine _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "InventoryAdjustmentLine object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            if (_obj.InventoryAdjustmentLineID == null)
            {
                _obj.InventoryAdjustmentLineID = DbMgr.GetLastInsertID();
            }
            _obj.FromDb = true;
            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
Пример #3
0
        internal void DeleteInventoryAdjustmentLine(InventoryAdjustmentLine line)
        {
            BOInventoryAdjustmentLine model = mAccountant.OpenInventoryAdjustmentLine(line);

            model.Delete();
        }
Пример #4
0
 internal void OpenInventoryAdjustmentLine(InventoryAdjustmentLine line)
 {
     mInventoryPresenter.ShowInventoryAdjustmentLine(mAccountant.OpenInventoryAdjustmentLine(line));
 }
Пример #5
0
 private DbUpdateStatement GetQuery_UpdateQuery(InventoryAdjustmentLine _obj)
 {
     return(DbMgr.CreateUpdateClause("InventoryAdjustmentLines", GetFields(_obj), "InventoryAdjustmentLineID", _obj.InventoryAdjustmentLineID));
 }
Пример #6
0
        private DbInsertStatement GetQuery_InsertQuery(InventoryAdjustmentLine _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            return(DbMgr.CreateInsertClause("InventoryAdjustmentLines", fields));
        }
        private Dictionary <string, DbFieldEntry> GetQueryMap_StoreItemInventoryAdjustmentLines(InventoryAdjustment _sale, InventoryAdjustmentLine _line)
        {
            Dictionary <string, DbFieldEntry> query_map = new Dictionary <string, DbFieldEntry>();

            bool multi_currency_support = _sale.RepositoryMgr.CurrencyMgr.SupportMultiCurrency;

            query_map.Add("JournalNumber", DbMgr.CreateStringFieldEntry(_sale.InventoryJournalNumber));
            query_map.Add("AdjustmentDate", _sale.Date != null ? (DbFieldEntry)DbMgr.CreateDateTimeFieldEntry(_sale.Date) : (DbFieldEntry)DbMgr.CreateStringFieldEntry(""));
            query_map.Add("Memo", DbMgr.CreateStringFieldEntry(_sale.Memo));
            query_map.Add("ItemNumber", DbMgr.CreateStringFieldEntry(_line.ItemNumber));

            query_map.Add("Location", DbMgr.CreateStringFieldEntry(_line.Location != null ? _line.Location.ToString() : ""));
            query_map.Add("Quantity", DbMgr.CreateDoubleFieldEntry(_line.Quantity));
            query_map.Add("UnitCost", DbMgr.CreateDoubleFieldEntry(_line.UnitCost));
            query_map.Add("Amount", DbMgr.CreateDoubleFieldEntry(_line.Amount));

            if (_line.Account != null)
            {
                int account_number = 0;
                if (AccountNumber2Int(_line.AccountNumber, out account_number))
                {
                    query_map.Add("Account", DbMgr.CreateIntFieldEntry(account_number));
                }
            }
            if (_line.Job != null)
            {
                query_map.Add("JobNumber", DbMgr.CreateStringFieldEntry(_line.JobNumber));
            }

            query_map.Add("AllocationMemo", DbMgr.CreateStringFieldEntry(_line.Memo));
            //query_map.Add("Category", DbMgr.CreateStringFieldEntry(""));

            return(query_map);
        }