Example #1
0
        public string Disable(StorageBinDTO storageBin)
        {
            //if (_unitOfWork.Repository<DeliveryHeaderDTO>().Query().Get().Any(i => i.StorageBinId == storageBin.Id) ||
            //    _unitOfWork.Repository<DocumentDTO>().Query().Get().Any(i => i.StorageBinId == storageBin.Id))
            //{
            //    return "Can't delete the item, it is already in use...";
            //}

            if (storageBin == null)
            {
                return(GenericMessages.ObjectIsNull);
            }

            string stat;

            try
            {
                _storageBinRepository.Update(storageBin);
                _unitOfWork.Commit();
                stat = string.Empty;
            }
            catch (Exception exception)
            {
                stat = exception.Message;
            }
            return(stat);
        }
Example #2
0
        public bool ObjectExists(StorageBinDTO storageBin)
        {
            var objectExists = false;
            var iDbContext   = DbContextUtil.GetDbContextInstance();

            try
            {
                var catRepository = new Repository <StorageBinDTO>(iDbContext);
                var catExists     = catRepository.Query()
                                    .Filter(bp => (bp.Shelve == storageBin.Shelve || bp.BoxNumber == storageBin.BoxNumber) &&
                                            bp.Id != storageBin.Id)
                                    .Get()
                                    .FirstOrDefault();


                if (catExists != null)
                {
                    objectExists = true;
                }
            }
            finally
            {
                iDbContext.Dispose();
            }

            return(objectExists);
        }
Example #3
0
        public string InsertOrUpdate(StorageBinDTO storageBin)
        {
            try
            {
                var validate = Validate(storageBin);
                if (!string.IsNullOrEmpty(validate))
                {
                    return(validate);
                }

                if (ObjectExists(storageBin))
                {
                    return(GenericMessages.DatabaseErrorRecordAlreadyExists + Environment.NewLine +
                           "With the same Name/Tin No. Exists");
                }

                _storageBinRepository.InsertUpdate(storageBin);
                _unitOfWork.Commit();
                return(string.Empty);
            }
            catch (Exception exception)
            {
                return(exception.Message);
            }
        }
Example #4
0
        public string Validate(StorageBinDTO storageBin)
        {
            if (null == storageBin)
            {
                return(GenericMessages.ObjectIsNull);
            }

            if (storageBin.Warehouse == null)
            {
                return("Warehouse " + GenericMessages.ObjectIsNull);
            }

            if (String.IsNullOrEmpty(storageBin.Shelve))
            {
                return(storageBin.Shelve + " " + GenericMessages.StringIsNullOrEmpty);
            }

            if (String.IsNullOrEmpty(storageBin.BoxNumber))
            {
                return(storageBin.BoxNumber + " " + GenericMessages.StringIsNullOrEmpty);
            }

            return(string.Empty);
        }