예제 #1
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterItem filterItem)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                FilterItemId filterItemId = new FilterItemId(filterItem.Id);
                Quest.Services.Dbio.MasterPricing.FilterItems _filterItems = null;
                status = read(dbContext, filterItemId, out _filterItems);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(filterItem, _filterItems);
                dbContext.SaveChanges();
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }
예제 #2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterColumns
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterItem filterItem, out FilterItemId filterItemId)
        {
            // Initialize
            filterItemId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterItems _filterItems = new Quest.Services.Dbio.MasterPricing.FilterItems();
                BufferMgr.TransferBuffer(filterItem, _filterItems);
                dbContext.FilterItems.Add(_filterItems);
                dbContext.SaveChanges();
                if (_filterItems.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterItem not created"));
                }
                filterItemId = new FilterItemId(_filterItems.Id);
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }
예제 #3
0
        private questStatus create(MasterPricingEntities dbContext, List <Quest.Functional.MasterPricing.FilterItem> filterItemList, out List <Quest.Functional.MasterPricing.FilterItem> filterItemIdList)
        {
            // Initialize
            filterItemIdList = null;


            // Perform create
            try
            {
                List <Quest.Services.Dbio.MasterPricing.FilterItems> _filterItemList = new List <Quest.Services.Dbio.MasterPricing.FilterItems>();
                foreach (Quest.Functional.MasterPricing.FilterItem filterItem in filterItemList)
                {
                    Quest.Services.Dbio.MasterPricing.FilterItems _filterItem = new Quest.Services.Dbio.MasterPricing.FilterItems();
                    BufferMgr.TransferBuffer(filterItem, _filterItem);
                    _filterItemList.Add(_filterItem);
                }
                dbContext.FilterItems.AddRange(_filterItemList);
                dbContext.SaveChanges();

                filterItemIdList = new List <FilterItem>();
                foreach (Quest.Services.Dbio.MasterPricing.FilterItems _filterItem in _filterItemList)
                {
                    Quest.Functional.MasterPricing.FilterItem filterItem = new FilterItem();
                    filterItem.Id = _filterItem.Id;
                    filterItemIdList.Add(filterItem);
                }
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }
예제 #4
0
        public questStatus Read(DbMgrTransaction trans, FilterItemId filterItemId, out Quest.Functional.MasterPricing.FilterItem filterItem)
        {
            // Initialize
            questStatus status = null;

            filterItem = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.FilterItems _filterItems = null;
            status = read((MasterPricingEntities)trans.DbContext, filterItemId, out _filterItems);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterItem = new Quest.Functional.MasterPricing.FilterItem();
            BufferMgr.TransferBuffer(_filterItems, filterItem);

            return(new questStatus(Severity.Success));
        }
예제 #5
0
        private questStatus read(MasterPricingEntities dbContext, FilterItemId filterItemId, out Quest.Services.Dbio.MasterPricing.FilterItems filterItem)
        {
            // Initialize
            filterItem = null;


            try
            {
                filterItem = dbContext.FilterItems.Where(r => r.Id == filterItemId.Id).SingleOrDefault();
                if (filterItem == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("Id {0} not found", filterItemId.Id))));
                }
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }