예제 #1
0
 public bool InsertOrUpdate(OutputStock OutputStock)
 {
     return(_epr.InsertOrUpdate(OutputStock));
 }
예제 #2
0
 public bool Save(OutputStock OutputStock)
 {
     _OutputStockApp.InsertOrUpdate(OutputStock);
     return(_connection.Save());
 }
예제 #3
0
        public bool InsertOrUpdate(IntegrationCapeStock integrationCapeStock)
        {
            var integration = _epr.Search(integrationCapeStock.GetExpressionByRelation()).FirstOrDefault();

            if (integration != null)
            {
                integration = _stockMapper.StartMapper(integrationCapeStock, integration);
            }

            if (integration != null)
            {
                _epr.InsertOrUpdate(integration);

                if (_conn.Save())
                {
                    InputStock  inputStock  = null;
                    OutputStock outputStock = null;

                    switch (integration.TypeIntegration)
                    {
                    case TypeIntegration.InputStock:

                        inputStock = _inputStockApp.Search(c => c.IntegrationCapeStockId == integration.Id).FirstOrDefault();
                        _inputStockApp.InsertOrUpdate(_stockMapper.StartMapper(integration, inputStock ?? new InputStock()));
                        break;

                    case TypeIntegration.OutputStock:

                        outputStock = _outputStockApp.Search(c => c.IntegrationCapeStockId == integration.Id).FirstOrDefault();
                        _outputStockApp.InsertOrUpdate(_stockMapper.StartMapper(integration, outputStock ?? new OutputStock()));
                        break;

                    default:
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                _epr.InsertOrUpdate(integrationCapeStock);

                if (_conn.Save())
                {
                    switch (integrationCapeStock.TypeIntegration)
                    {
                    case TypeIntegration.InputStock:

                        _inputStockApp.InsertOrUpdate(_stockMapper.StartMapper <InputStock>(integrationCapeStock));
                        break;

                    case TypeIntegration.OutputStock:

                        _outputStockApp.InsertOrUpdate(_stockMapper.StartMapper <OutputStock>(integrationCapeStock));
                        break;

                    default:
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(_conn.Save());
        }
예제 #4
0
 public ActionResult Create(OutputStock outputStock)
 {
     _outputStockRepository.Create(outputStock);
     return(RedirectToAction("Index"));
 }