Esempio n. 1
0
        public IEnumerable <StockTransferDeliveryModel> GetModel(long requestId)
        {
            if (requestId <= 0)
            {
                throw new MixERPException(Warnings.AccessIsDenied);
            }

            return(StockTransferDelivery.GetModel(AppUsers.GetCurrentUserDB(), requestId));
        }
        public long Save(DateTime valueDate, string referenceNumber, string statementReference, long requestId,
                         int sourceStoreId, int shipperId, string data)
        {
            try
            {
                Collection <StockAdjustmentDetail> models = GetModels(data);

                if (requestId <= 0)
                {
                    throw new MixERPException(Warnings.AccessIsDenied);
                }


                if (models == null || models.Count.Equals(0))
                {
                    throw new MixERPException(Warnings.GridViewEmpty);
                }

                if (sourceStoreId <= 0)
                {
                    throw new MixERPException(Warnings.InvalidStore);
                }

                if (shipperId <= 0)
                {
                    throw new MixERPException(Warnings.InvalidShippingCompany);
                }

                int  officeId = AppUsers.GetCurrent().View.OfficeId.ToInt();
                int  userId   = AppUsers.GetCurrent().View.UserId.ToInt();
                long loginId  = AppUsers.GetCurrent().View.LoginId.ToLong();

                return(StockTransferDelivery.Add(AppUsers.GetCurrentUserDB(), officeId, userId, loginId, requestId,
                                                 valueDate,
                                                 referenceNumber, statementReference, shipperId, sourceStoreId, models));
            }
            catch (Exception ex)
            {
                Log.Warning("Could not save inventory transfer entry. {Exception}", ex);
                throw;
            }
        }