Esempio n. 1
0
        public void Write(Assemblage assemblage)
        {
            var select = assemblage.ListOfNomenc.GroupBy(i => i.Nomenclature).Select(g => new LineItem()
            {
                Nomenclature = g.Key,
                Quantity     = g.Sum(i => i.Quantity),
                Sum          = g.Sum(i => i.Sum)
            });

            foreach (var item in select)
            {
                var recordNomenclature = new RemainNomenclature
                {
                    Nomenclature = item.Nomenclature,
                    RecordType   = RecordType.Expose,
                    Quantity     = item.Quantity,
                };
                var recordCostPrice = new RemainCostPrice
                {
                    Nomenclature = item.Nomenclature,
                    RecordType   = RecordType.Expose,
                    Amount       = item.Quantity,
                };

                recordNomenclature.Warehouse = assemblage.Warehouse;
                _remainNomenclature.Create(recordNomenclature);
                _remainCostPrice.Create(recordCostPrice);
            }
            _repository.Create(assemblage);
            _remainNomenclature.RecalcBalances();
            _remainCostPrice.RecalcBalances();
        }
 public Person Create(Person entity)
 {
     entity.Credential.EncryptedPassword();
     if (entity.IsValidForRegister())
     {
         return(_registerRepository.Create(entity));
     }
     return(null);
 }
        public ActionResult CreateRegister(RegisterViewModel registerViewModel)
        {
            Register register = new Register
            {
                Mark = registerViewModel.Mark
            };

            _registerRepository.Create(register, registerViewModel.CourseId, registerViewModel.StudentName);
            return(RedirectToAction("Grade", new { id = registerViewModel.CourseId }));
        }
Esempio n. 4
0
 public async Task Create(RegisterModel registerModel)
 {
     try
     {
         await _registerRepository.Create(registerModel);
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Esempio n. 5
0
        public void Write(Consumption consumption)
        {
            var select = consumption.ListOfNomenc.GroupBy(i => i.Nomenclature).Select(g => new LineItem()
            {
                Nomenclature = g.Key,
                Quantity     = g.Sum(i => i.Quantity),
                Sum          = g.Sum(i => i.Sum)
            });

            foreach (var item in select)
            {
                var availableQuantity = _table
                                        .Where(t => t.Nomenclature.Id == item.Nomenclature.Id)
                                        .Select(q => q.Quantity)
                                        .ToList();
                if (availableQuantity[0] < item.Quantity)
                {
                    throw new System.ArgumentException("Not enough goods in warehouse");
                }
                var recordNomenclature = new RemainNomenclature
                {
                    Nomenclature = item.Nomenclature,
                    RecordType   = RecordType.Expose,
                    Quantity     = item.Quantity,
                    Warehouse    = consumption.Warehouse
                };

                var recordCostPrice = new RemainCostPrice
                {
                    Nomenclature = item.Nomenclature,
                    Amount       = item.Quantity,
                    Sum          = item.Sum,
                    RecordType   = RecordType.Expose,
                };

                _remainNomenclature.Create(recordNomenclature);
                _remainCostPrice.Create(recordCostPrice);
            }

            _repository.Create(consumption);
            _remainNomenclature.RecalcBalances();
            _remainCostPrice.RecalcBalances();
        }
Esempio n. 6
0
        public void Write(Incoming incoming)
        {
            var select = incoming.ListOfNomenc.GroupBy(i => i.Nomenclature).Select(g => new LineItem()
            {
                Nomenclature = g.Key,
                Quantity     = g.Sum(i => i.Quantity),
                Sum          = g.Sum(i => i.Sum)
            });

            foreach (var item in select)
            {
                var recordNomenclature = new RemainNomenclature
                {
                    Nomenclature = item.Nomenclature,
                    RecordType   = RecordType.Receipt,
                    Quantity     = item.Quantity,
                    Warehouse    = incoming.Warehouse
                };

                var recordCostPrice = new RemainCostPrice
                {
                    Nomenclature = item.Nomenclature,
                    Incoming     = incoming,
                    Amount       = item.Quantity,
                    Sum          = item.Sum,
                    RecordType   = RecordType.Receipt
                };

                _remainNomenclature.Create(recordNomenclature);
                _remainCostPrice.Create(recordCostPrice);
            }

            _repository.Create(incoming);
            _remainNomenclature.RecalcBalances();
            _remainCostPrice.RecalcBalances();
        }