Esempio n. 1
0
        public void Save(MasterBin data)
        {
            if (data.BinId == 0)
            {
                var institutionId = _securityService.GetCurrentInstitutionId();
                data.InstitutionId = institutionId;
            }

            _binRepository.Save(data);
            _binRepository.Commit();
        }
Esempio n. 2
0
 public IHttpActionResult Delete(MasterBin data)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         _binService.Delete(data);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 3
0
        public void Save(MasterReaderModule data)
        {
            var institutionId = _securityService.GetCurrentInstitutionId();

            if (data.ReaderModuleId == 0)
            {
                data.InstitutionId = institutionId;
            }
            _readerModuleRepository.Save(data);
            _readerModuleRepository.Commit();

            if (data.Bins == null || data.Bins.Count() == 0)
            {
                var count = 1;
                for (var i = 1; i <= data.NoOfStack; i++)
                {
                    for (var j = 1; j <= data.NoOfRow; j++)
                    {
                        var binCode = data.ReaderModuleCode + count.ToString("00");
                        var bin     = new MasterBin()
                        {
                            BinCode        = binCode,
                            EmptyDistance  = data.DefaultBinEmptyDistance,
                            ReaderModuleId = data.ReaderModuleId,
                            StackNo        = i,
                            RowNo          = j,
                            InstitutionId  = institutionId
                        };
                        _binService.Save(bin);
                        count++;
                    }
                }
            }
            else
            {
                _binService.Save(data.Bins.ToList());
            }
        }
Esempio n. 4
0
 public void Delete(MasterBin data)
 {
     _binRepository.Delete(data);
     _binRepository.Commit();
 }