Beispiel #1
0
        public long Save(long tranId, DateTime valueDate, int storeId, string partyCode, int priceTypeId,
                         string referenceNumber, string data, string statementReference, string attachmentsJSON)
        {
            try
            {
                if (!StockTransaction.IsValidStockTransactionByTransactionMasterId(AppUsers.GetCurrentUserDB(), tranId))
                {
                    throw new InvalidOperationException(Warnings.InvalidStockTransaction);
                }

                if (!StockTransaction.IsValidPartyByTransactionMasterId(AppUsers.GetCurrentUserDB(), tranId, partyCode))
                {
                    throw new InvalidOperationException(Warnings.InvalidParty);
                }

                Collection <StockDetail> details = CollectionHelper.GetStockMasterDetailCollection(data, storeId);


                Collection <Attachment> attachments = CollectionHelper.GetAttachmentCollection(attachmentsJSON);

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

                return(Data.Transactions.Return.PostTransaction(AppUsers.GetCurrentUserDB(), tranId, valueDate, officeId, userId, loginId, storeId,
                                                                partyCode, priceTypeId, referenceNumber, statementReference, details, attachments));
            }
            catch (Exception ex)
            {
                Log.Warning("Could not save purchase return entry. {Exception}", ex);
                throw;
            }
        }
Beispiel #2
0
        public long Save(long tranId, DateTime valueDate, int storeId, string partyCode, int priceTypeId, string referenceNumber, string data, string statementReference, string attachmentsJSON)
        {
            if (!StockTransaction.IsValidStockTransactionByTransactionMasterId(tranId))
            {
                throw new InvalidOperationException(Resources.Warnings.InvalidStockTransaction);
            }

            if (!StockTransaction.IsValidPartyByTransactionMasterId(tranId, partyCode))
            {
                throw new InvalidOperationException(Resources.Warnings.InvalidParty);
            }

            Collection <StockMasterDetailModel> details = CollectionHelper.GetStockMasterDetailCollection(data, storeId);

            if (!this.ValidateDetails(details, tranId))
            {
                return(0);
            }

            JavaScriptSerializer         js          = new JavaScriptSerializer();
            Collection <AttachmentModel> attachments = js.Deserialize <Collection <AttachmentModel> >(attachmentsJSON);

            int  officeId = SessionHelper.GetOfficeId();
            int  userId   = SessionHelper.GetUserId();
            long loginId  = SessionHelper.GetLogOnId();

            return(Data.Helpers.Return.PostTransaction(tranId, valueDate, officeId, userId, loginId, storeId, partyCode, priceTypeId, referenceNumber, statementReference, details, attachments));
        }
Beispiel #3
0
        public long Save(long tranId, DateTime valueDate, int storeId, string partyCode, int priceTypeId, string referenceNumber, string data, string statementReference, string attachmentsJSON)
        {
            if (!StockTransaction.IsValidStockTransactionByTransactionMasterId(tranId))
            {
                throw new InvalidOperationException(Resources.Warnings.InvalidStockTransaction);
            }

            if (!StockTransaction.IsValidPartyByTransactionMasterId(tranId, partyCode))
            {
                throw new InvalidOperationException(Resources.Warnings.InvalidParty);
            }

            Collection <StockDetail> details = CollectionHelper.GetStockMasterDetailCollection(data, storeId);

            if (!this.ValidateDetails(details, tranId))
            {
                return(0);
            }

            Collection <Attachment> attachments = CollectionHelper.GetAttachmentCollection(attachmentsJSON);

            int  officeId = CurrentUser.GetSignInView().OfficeId.ToInt();
            int  userId   = CurrentUser.GetSignInView().UserId.ToInt();
            long loginId  = CurrentUser.GetSignInView().LoginId.ToLong();

            return(Data.Transactions.Return.PostTransaction(tranId, valueDate, officeId, userId, loginId, storeId, partyCode, priceTypeId, referenceNumber, statementReference, details, attachments));
        }