示例#1
0
        /// <summary>
        /// Loads the documents' templates into cache.
        /// </summary>
        private void LoadTemplates()
        {
            XDocument xml = this.ExecuteStoredProcedure(null, StoredProcedure.configuration_p_getConfiguration, true,
                                                        XDocument.Parse(@"<root><entry>templates.CommercialDocument.*</entry>
                                        <entry>templates.WarehouseDocument.*</entry>
                                        <entry>templates.FinancialDocument.*</entry>
                                        <entry>templates.Item.*</entry>
                                        <entry>templates.Contractor.*</entry>
                                        <entry>templates.ServiceDocument.*</entry>
                                        <entry>templates.ComplaintDocument.*</entry>
                                        <entry>templates.InventoryDocument.*</entry>
                                        <entry>templates.OfferDocument.*</entry>
                                  </root>"));

            this.Templates = new Dictionary <BusinessObjectType, Dictionary <string, XElement> >();

            foreach (XElement entry in xml.Root.Element("configuration").Elements().OrderBy(c => Convert.ToInt32(c.Element("xmlValue").Element("root").Element("order").Value, CultureInfo.InvariantCulture)))
            {
                string[]           splitted     = entry.Element("key").Value.Split('.');
                BusinessObjectType type         = (BusinessObjectType)Enum.Parse(typeof(BusinessObjectType), splitted[1], true);
                string             templateName = splitted[2];

                if (!this.Templates.ContainsKey(type))
                {
                    this.Templates.Add(type, new Dictionary <string, XElement>());
                }

                this.Templates[type].Add(templateName, (XElement)entry.Element("xmlValue").FirstNode);
            }
        }
示例#2
0
 /// <summary>
 /// Deletes business object.
 /// </summary>
 /// <param name="type">Type of <see cref="BusinessObject"/> to delete.</param>
 /// <param name="id">Id of the object to delete.</param>
 public override void DeleteBusinessObject(BusinessObjectType type, Guid id)
 {
     if (type == BusinessObjectType.FileDescriptor)
     {
         this.ExecuteStoredProcedure(StoredProcedure.repository_p_deleteFileDescriptor, false, "@id", id);
     }
 }
示例#3
0
        /// <summary>
        /// Creates a <see cref="BusinessObject"/> of a selected type.
        /// </summary>
        /// <param name="type">The type of <see cref="IBusinessObject"/> to create.</param>
        /// <param name="requestXml">Client requestXml containing initial parameters for the object.</param>
        /// <returns>A new <see cref="IBusinessObject"/>.</returns>
        public override IBusinessObject CreateNewBusinessObject(BusinessObjectType type, XDocument requestXml)
        {
            IBusinessObject bo = null;

            switch (type)
            {
            case BusinessObjectType.Contractor:
                bo = this.CreateNewContractor();
                break;

            case BusinessObjectType.Bank:
                bo = new Bank(null);
                break;

            case BusinessObjectType.Employee:
                bo = new Employee(null);
                break;

            case BusinessObjectType.ApplicationUser:
                bo = new ApplicationUser(null);
                break;

            default:
                throw new InvalidOperationException("ContractorMapper can only create contractors/banks/employees.");
            }

            bo.GenerateId();
            return(bo);
        }
示例#4
0
        public override IBusinessObject LoadBusinessObject(BusinessObjectType type, Guid id)
        {
            StoredProcedure?sp = null;
            string          procedureParamName = null;
            string          tableName          = null;

            if (type == BusinessObjectType.ShiftTransaction)
            {
                sp = StoredProcedure.warehouse_p_getShiftTransactionData;
                procedureParamName = "@shiftTransactionId";
                tableName          = "shiftTransaction";
            }
            else if (type == BusinessObjectType.Container)
            {
                sp = StoredProcedure.warehouse_p_getContainer;
                procedureParamName = "@containerId";
                tableName          = "container";
            }
            else
            {
                throw new InvalidOperationException("This type of object is not supported by WarehouseMapper.");
            }

            XDocument xdoc = this.ExecuteStoredProcedure(sp.Value, true, procedureParamName, id);

            if (xdoc.Root.Element(tableName).Elements().Count() == 0)
            {
                throw new ClientException(ClientExceptionId.ObjectNotFound);
            }

            xdoc = this.ConvertDBToBoXmlFormat(xdoc, id);

            return(this.ConvertToBusinessObject(xdoc.Root.Element(tableName), null));
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Item"/> class with a specified xml root element and default settings.
 /// </summary>
 /// <param name="parent">Parent <see cref="BusinessObject"/>.</param>
 /// <param name="boType">Type of <see cref="BusinessObject"/>.</param>
 public Item(BusinessObject parent, BusinessObjectType boType)
     : base(parent, boType)
 {
     this.Attributes       = new ItemAttrValues(this);
     this.Relations        = new ItemRelations(this);
     this.UnitRelations    = new ItemUnitRelations(this);
     this.GroupMemberships = new ItemGroupMemberships(this);
 }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BusinessObject"/> class with a specified xml root element.
        /// </summary>
        /// <param name="parent">Parent <see cref="BusinessObject"/>.</param>
        /// <param name="boType">Type of <see cref="BusinessObject"/>.</param>
        protected BusinessObject(BusinessObject parent, BusinessObjectType boType)
        {
            this.Parent = parent;
            this.BOType = boType;

            if (this.Id == null)
            {
                this.GenerateId();
            }
        }
示例#7
0
        /// <summary>
        /// Performs initial validation.
        /// </summary>
        /// <param name="requestXml">Client's request containing <see cref="BusinessObject"/>'s xml and its options.</param>
        protected override void PerformInitialValidation(XDocument requestXml)
        {
            string             boType = ((XElement)requestXml.Root.FirstNode).Attribute("type").Value;
            BusinessObjectType type   = (BusinessObjectType)Enum.Parse(typeof(BusinessObjectType), boType);

            if (!this.MapperTyped.SupportedBusinessObjectsTypes.Contains(type))
            {
                throw new ClientException(ClientExceptionId.UnknownBusinessObjectType, null, "objType:" + boType);
            }
        }
示例#8
0
        public XElement GetDocumentOperations(BusinessObjectType type, Guid id)
        {
            Document document = null;

            using (Coordinator c = Coordinator.GetCoordinatorForSpecifiedType(type))
            {
                document = (Document)c.LoadBusinessObject(type, id);
            }

            return(this.GetDocumentOperations(document));
        }
示例#9
0
        /// <summary>
        /// Creates a <see cref="BusinessObject"/> of a selected type.
        /// </summary>
        /// <param name="type">The type of <see cref="IBusinessObject"/> to create.</param>
        /// <param name="requestXml">Client requestXml containing initial parameters for the object.</param>
        /// <returns>A new <see cref="IBusinessObject"/>.</returns>
        public override IBusinessObject CreateNewBusinessObject(BusinessObjectType type, XDocument requestXml)
        {
            if (type != BusinessObjectType.Configuration)
            {
                throw new InvalidOperationException("ConfigurationMapper can only create configuration.");
            }

            Configuration conf = new Configuration();

            return(conf);
        }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Document"/> class with a specified xml root element and default settings.
        /// </summary>
        /// <param name="parent">Parent <see cref="BusinessObject"/>.</param>
        /// <param name="boType">Type of <see cref="Document"/>.</param>
        public Document(BusinessObjectType boType)
            : base(boType)
        {
            this.DocumentOptions = new List <IDocumentOption>();
            this.Attributes      = new DocumentAttrValues(this);
            this.Relations       = new DocumentRelations(this);

            //defaults
            this.SystemCurrencyId   = ConfigurationMapper.Instance.SystemCurrencyId;
            this.DocumentCurrencyId = ConfigurationMapper.Instance.SystemCurrencyId;
        }
示例#11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Contractor"/> class with a specified xml root element and default settings.
        /// </summary>
        /// <param name="parent">Parent <see cref="BusinessObject"/>.</param>
        /// <param name="boType">Type of <see cref="Contractor"/>.</param>
        public Contractor(BusinessObject parent, BusinessObjectType boType)
            : base(parent, boType)
        {
            this.Accounts         = new ContractorAccounts(this);
            this.Addresses        = new ContractorAddresses(this);
            this.Attributes       = new ContractorAttrValues(this);
            this.Relations        = new ContractorRelations(this);
            this.GroupMemberships = new ContractorGroupMemberships(this);

            this.NipPrefixCountryId = DictionaryMapper.Instance.GetCountry("PL").Id.Value;
        }
示例#12
0
        /// <summary>
        /// Loads the <see cref="BusinessObject"/> with a specified Id.
        /// </summary>
        /// <param name="type">Type of <see cref="BusinessObject"/> to load.</param>
        /// <param name="id"><see cref="IBusinessObject"/>'s id indicating which <see cref="BusinessObject"/> to load.</param>
        /// <returns>
        /// Loaded <see cref="IBusinessObject"/> object.
        /// </returns>
        public override IBusinessObject LoadBusinessObject(BusinessObjectType type, Guid id)
        {
            XDocument xdoc = this.ExecuteStoredProcedure(StoredProcedure.contractor_p_getContractorData, true, "@contractorId", id);

            if (xdoc.Root.Element("contractor").Elements().Count() == 0)
            {
                throw new ClientException(ClientExceptionId.ContractorNotFound);
            }

            xdoc = this.ConvertDBToBoXmlFormat(xdoc, id);

            return(this.ConvertToBusinessObject(xdoc.Root.Element("contractor"), null));
        }
示例#13
0
        /// <summary>
        /// Loads the <see cref="BusinessObject"/> with a specified Id.
        /// </summary>
        /// <param name="type">Type of <see cref="BusinessObject"/> to load.</param>
        /// <param name="id"><see cref="IBusinessObject"/>'s id indicating which <see cref="BusinessObject"/> to load.</param>
        /// <returns>
        /// Loaded <see cref="IBusinessObject"/> object.
        /// </returns>
        public override IBusinessObject LoadBusinessObject(BusinessObjectType type, Guid id)
        {
            XDocument xdoc = this.ExecuteStoredProcedure(StoredProcedure.repository_p_getFileDescriptor, true, "@id", id);

            if (xdoc.Root.Element("fileDescriptor").Elements().Count() == 0)
            {
                throw new ClientException(ClientExceptionId.ObjectNotFound);
            }

            xdoc = this.ConvertDBToBoXmlFormat(xdoc, id);

            return(this.ConvertToBusinessObject(xdoc.Root.Element("fileDescriptor"), null));
        }
示例#14
0
 public override void DeleteBusinessObject(BusinessObjectType type, Guid id)
 {
     try
     {
         this.ExecuteStoredProcedure(StoredProcedure.contractor_p_deleteContractor, false, "@contractorId", id);
     }
     catch (SqlException ex)
     {
         RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:120");
         if (ex.Number == 50000)
         {
             throw new ClientException(ClientExceptionId.ContractorRemovalError);
         }
     }
 }
示例#15
0
        /// <summary>
        /// Creates a <see cref="BusinessObject"/> of a selected type.
        /// </summary>
        /// <param name="type">The type of <see cref="IBusinessObject"/> to create.</param>
        /// <param name="requestXml">Client requestXml containing initial parameters for the object.</param>
        /// <returns>A new <see cref="IBusinessObject"/>.</returns>
        public override IBusinessObject CreateNewBusinessObject(BusinessObjectType type, XDocument requestXml)
        {
            IBusinessObject bo = null;

            if (type == BusinessObjectType.Item)
            {
                bo = new Item(null);
            }
            else
            {
                throw new InvalidOperationException("ItemMapper can only create items.");
            }

            bo.GenerateId();
            return(bo);
        }
示例#16
0
        public override IBusinessObject CreateNewBusinessObject(BusinessObjectType type, XDocument requestXml)
        {
            IBusinessObject bo = null;

            switch (type)
            {
            case BusinessObjectType.ServicedObject:
                bo = new ServicedObject();
                break;

            default:
                throw new InvalidOperationException("ServiceMapper cannot create such object.");
            }

            bo.GenerateId();
            return(bo);
        }
示例#17
0
        /// <summary>
        /// Creates a <see cref="BusinessObject"/> of a selected type.
        /// </summary>
        /// <param name="type">The type of <see cref="IBusinessObject"/> to create.</param>
        /// <param name="requestXml">Client requestXml containing initial parameters for the object.</param>
        /// <returns>A new <see cref="IBusinessObject"/>.</returns>
        public override IBusinessObject CreateNewBusinessObject(BusinessObjectType type, XDocument requestXml)
        {
            IBusinessObject bo = null;

            switch (type)
            {
            case BusinessObjectType.FileDescriptor:
                bo = this.CreateNewFileDescriptor();
                break;

            default:
                throw new InvalidOperationException("RepositoryMapper can only create fileDescriptors.");
            }

            bo.GenerateId();
            return(bo);
        }
示例#18
0
        /// <summary>
        /// Loads the <see cref="BusinessObject"/> with a specified Id. It appends modification user name.
        /// </summary>
        /// <param name="type">The type of <see cref="IBusinessObject"/> to load.</param>
        /// <param name="id">The id of the <see cref="IBusinessObject"/> to load.</param>
        /// <returns>Loaded <see cref="BusinessObject"/></returns>
        internal override IBusinessObject LoadBusinessObject(BusinessObjectType type, Guid id)
        {
            Contractor result = this.MapperTyped.LoadBusinessObject(id);

            if (result.ModificationUserId.HasValue)
            {
                Contractor modificationUser = this.MapperTyped.LoadBusinessObject(result.ModificationUserId.Value);
                result.ModificationUser = modificationUser.FullName;
            }

            if (result.CreationUserId.HasValue)
            {
                Contractor creationUser = this.MapperTyped.LoadBusinessObject(result.CreationUserId.Value);
                result.CreationUser = creationUser.FullName;
            }

            return(result);
        }
示例#19
0
        /// <summary>
        /// Deletes business object.
        /// </summary>
        /// <param name="requestXml">Client's request containing <see cref="BusinessObject"/>'s id to delete.</param>
        public override void DeleteBusinessObject(XDocument requestXml)
        {
            BusinessObjectType type = BusinessObjectType.Other;

            try
            {
                type = (BusinessObjectType)Enum.Parse(typeof(BusinessObjectType), requestXml.Root.Element("type").Value);
            }
            catch (ArgumentException)
            {
                RoboFramework.Tools.RandomLogHelper.GetLog().Debug("FractusRefactorTraceCatch:93");
                throw new ClientException(ClientExceptionId.UnknownBusinessObjectType, null, "objType:" + requestXml.Root.Element("type").Value);
            }

            Guid id = new Guid(requestXml.Root.Element("id").Value);

            this.Mapper.DeleteBusinessObject(type, id);
        }
示例#20
0
        /// <summary>
        /// Loads the <see cref="BusinessObject"/> with a specified Id. It appends modification user name.
        /// </summary>
        /// <param name="type">The type of <see cref="IBusinessObject"/> to load.</param>
        /// <param name="id">The id of the <see cref="IBusinessObject"/> to load.</param>
        /// <returns>Loaded <see cref="BusinessObject"/></returns>
        internal override IBusinessObject LoadBusinessObject(BusinessObjectType type, Guid id)
        {
            Item             result           = (Item)this.MapperTyped.LoadBusinessObject(BusinessObjectType.Item, id);
            ContractorMapper contractorMapper = new ContractorMapper();

            if (result.ModificationUserId.HasValue)
            {
                Contractor modificationUser = contractorMapper.LoadBusinessObject(result.ModificationUserId.Value);
                result.ModificationUser = modificationUser.FullName;
            }

            if (result.CreationUserId.HasValue)
            {
                Contractor creationUser = contractorMapper.LoadBusinessObject(result.CreationUserId.Value);
                result.CreationUser = creationUser.FullName;
            }

            return(result);
        }
示例#21
0
        public override IBusinessObject CreateNewBusinessObject(BusinessObjectType type, XDocument requestXml)
        {
            IBusinessObject bo = null;

            switch (type)
            {
            case BusinessObjectType.ShiftTransaction:
                bo = new ShiftTransaction(null);
                break;

            case BusinessObjectType.Container:
                bo = new Container(null);
                break;

            default:
                throw new InvalidOperationException("WarehouseMapper cannot create this type of objects.");
            }

            bo.GenerateId();
            return(bo);
        }
示例#22
0
        public CommercialDocumentBase(BusinessObjectType boType)
            : base(boType)
        {
            this.Lines           = new CommercialDocumentLines(this);
            this.VatTableEntries = new CommercialDocumentVatTableEntries(this);

            DateTime currentDateTime = SessionManager.VolatileElements.CurrentDateTime;

            //document defaults
            this.EventDate     = currentDateTime;
            this.IssuePlaceId  = new Guid(ConfigurationMapper.Instance.GetSingleConfigurationEntry("document.defaults.issuePlaceId").Value.Value);
            this.ExchangeDate  = currentDateTime.PreviousWorkDay();
            this.ExchangeScale = 1;
            this.ExchangeRate  = 1;

            Contractor issuingPerson = (Contractor)DependencyContainerManager.Container.Get <ContractorMapper>().LoadBusinessObject(BusinessObjectType.Contractor, SessionManager.User.UserId);

            this.IssuingPerson = issuingPerson;

            Contractor issuer = (Contractor)DependencyContainerManager.Container.Get <ContractorMapper>().LoadBusinessObject(BusinessObjectType.Contractor, new Guid(ConfigurationMapper.Instance.GetConfiguration(SessionManager.User, "document.defaults.issuerId").First().Value.Value));

            this.Issuer = issuer;

            //znajdywanie adresu do faktury
            Guid billingId = DictionaryMapper.Instance.GetContractorField(ContractorFieldName.Address_Billing).Id.Value;
            Guid defaultId = DictionaryMapper.Instance.GetContractorField(ContractorFieldName.Address_Default).Id.Value;
            ContractorAddress issuerAddress = issuer.Addresses.Children.Where(a => a.ContractorFieldId == billingId).FirstOrDefault();

            if (issuerAddress == null)
            {
                issuerAddress = issuer.Addresses.Children.Where(a => a.ContractorFieldId == defaultId).FirstOrDefault();
            }

            if (issuerAddress == null)
            {
                throw new ClientException(ClientExceptionId.MissingDefaultOrBillingAddress, null, "name:" + issuer.FullName);
            }

            this.IssuerAddressId = issuerAddress.Id.Value;
        }
示例#23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Document"/> class with a specified xml root element and default settings.
        /// </summary>
        /// <param name="parent">Parent <see cref="BusinessObject"/>.</param>
        /// <param name="boType">Type of <see cref="Document"/>.</param>
        public SimpleDocument(BusinessObjectType boType)
            : base(null, boType)
        {
            this.RelatedObjects = new List <IBusinessObject>();

            //defaults
            this.Number = new DocumentNumber(this);
            var defaultNumberSettingIdConf
                = ConfigurationMapper.Instance.GetSingleConfigurationEntry("document.defaults.numberSettingId");

            if (defaultNumberSettingIdConf == null)
            {
                throw new InvalidOperationException("Missing configuration setting: 'document.defaults.numberSettingId'");
            }
            this.Number.NumberSettingId = new Guid(defaultNumberSettingIdConf.Value.Value);
            this.IssueDate = SessionManager.VolatileElements.CurrentDateTime;

            User user = SessionManager.User;

            this.BranchId  = user.BranchId;
            this.CompanyId = user.CompanyId;
        }
示例#24
0
        /// <summary>
        /// Gets the random keywords collection for the specified business object type.
        /// </summary>
        /// <param name="type">The type of business object to get the keywords for.</param>
        /// <param name="amount">The amount of random keywords to get.</param>
        /// <returns>List of random keywords.</returns>
        public XDocument GetRandomBusinessObjectKeywords(BusinessObjectType type, int amount)
        {
            XDocument xml = XDocument.Parse("<root amount=\"" + amount.ToString(CultureInfo.InvariantCulture) + "\" />");

            StoredProcedure sp;

            if (type == BusinessObjectType.Item)
            {
                sp = StoredProcedure.item_p_getRandomKeywords;
            }
            else if (type == BusinessObjectType.Contractor)
            {
                sp = StoredProcedure.contractor_p_getRandomKeywords;
            }
            else
            {
                throw new NotSupportedException("Object type not supported");
            }

            xml = this.ExecuteStoredProcedure(sp, true, xml);

            return(xml);
        }
        public async Task <Unit> Handle(UpdateInterfaceStatusCommand request, CancellationToken cancellationToken)
        {
            foreach (var item in request.AccountingInterfaceError)
            {
                bool isResendRequest = true;
                int  tAorJLTypeId    = 0;
                if (item.TransactionDocumentTypeId == DocumentType.ManualTemporaryAdjustment)
                {
                    tAorJLTypeId = await _accountingInterfaceRepository.GetTATypeIdAsync(item.TransactionDocumentId, item.TransactionDocumentTypeId, request.Company);
                }
                BusinessObjectType businessObjectType = await GetBusinessObjectType(item.TransactionDocumentTypeId, tAorJLTypeId);

                var eventDto    = new EventDto(item.AccountingId, item.DocumentReference, (int)businessObjectType, request.Company);
                var eventStatus = await _interfaceEventLogService.FindEventAsync(eventDto);

                if (eventStatus != null)
                {
                    var processInterfaceData = new ProcessInterfaceDataChangeLogsRequest
                    {
                        DocumentTypeId          = item.TransactionDocumentTypeId,
                        CompanyId               = request.Company,
                        BusinessApplicationType = BusinessApplicationType.AX,
                        TransactionDocumentId   = item.TransactionDocumentId,
                        DocumentId              = item.AccountingId,
                    };
                    if (Enum.TryParse(request.AccountingInterfaceStatus, out InterfaceStatus status))
                    {
                        AuthorizationResult res = await this.CheckPrivileges(status);

                        if (res.Succeeded)
                        {
                            switch (status)
                            {
                            case InterfaceStatus.NotInterfaced:
                                _unitOfWork.BeginTransaction();
                                try
                                {
                                    await ProcessEventUpdate(eventStatus.EventId, InterfaceStatus.NotInterfaced, "Rejected from Error Management Screen", processInterfaceData.ESBMessage, ResultCode.Cancel.ToString(), null, processInterfaceData.CompanyId);
                                    await ProcessStatusUpdate(processInterfaceData, InterfaceStatus.NotInterfaced, "Rejected from Error Management Screen");

                                    _unitOfWork.Commit();
                                }
                                catch
                                {
                                    _unitOfWork.Rollback();
                                    throw;
                                }
                                break;

                            case InterfaceStatus.TransmitError:
                            case InterfaceStatus.InterfaceReady:
                                // Made changes to process the document directly instead of queueing into Process.Queue
                                // Processing it instead of queueing since we received bug which states document status after resend is not updated immediately
                                var companyDate = await _systemDateTimeService.GetCompanyDate(processInterfaceData.CompanyId);

                                if (processInterfaceData.DocumentTypeId == DocumentType.ManualTemporaryAdjustment)
                                {
                                    tAorJLTypeId = await _accountingInterfaceRepository.GetTATypeIdAsync(processInterfaceData.TransactionDocumentId, processInterfaceData.DocumentTypeId, processInterfaceData.CompanyId);
                                }
                                if (processInterfaceData.DocumentTypeId == DocumentType.RegularJournal)
                                {
                                    tAorJLTypeId = await _accountingInterfaceRepository.GetJLTypeIdAsync(processInterfaceData.TransactionDocumentId, processInterfaceData.DocumentTypeId, processInterfaceData.CompanyId);
                                }

                                _unitOfWork.BeginTransaction();
                                try
                                {
                                    await ProcessEventUpdate(eventStatus.EventId, InterfaceStatus.InterfaceReady, "Resend from Error Management Screen", processInterfaceData.ESBMessage, null, null, processInterfaceData.CompanyId);
                                    await ProcessStatusUpdate(processInterfaceData, InterfaceStatus.InterfaceReady, "Resend from Error Management Screen");

                                    _unitOfWork.Commit();
                                }
                                catch
                                {
                                    _unitOfWork.Rollback();
                                    throw;
                                }

                                _logger.LogInformation("Accounting Document with DocumentId {Atlas_DocumentId} having status {Atlas_Status} is sent to Accounting System at {Atlas_DateTime}", processInterfaceData.DocumentId, InterfaceStatus.ReadyToTransmit, companyDate);
                                var accountingInterfaceXMLMessage = await _accountingInterfaceRepository.GetESBMessageAsync(processInterfaceData.DocumentId, processInterfaceData.CompanyId);

                                // send the business object to Interface
                                await SendBusinessObjectToInterface(processInterfaceData, accountingInterfaceXMLMessage, tAorJLTypeId, eventStatus.EventId, isResendRequest);

                                break;
                            }
                        }
                        else
                        {
                            throw new AtlasSecurityException("One or more privileges are required to perform this action.");
                        }
                    }

                    _logger.LogInformation("Accounting Error with id {Atlas_DocumentReference} updated.", item.DocumentReference);
                }
            }

            return(Unit.Value);
        }
示例#26
0
 /// <summary>
 /// Gets the random keywords collection for the specified business object type.
 /// </summary>
 /// <param name="type">The type of business object to get the keywords for.</param>
 /// <param name="amount">The amount of random keywords to get.</param>
 /// <returns>List of random item keywords.</returns>
 public XDocument GetRandomBusinessObjectKeywords(BusinessObjectType type, int amount)
 {
     return(((ListMapper)this.Mapper).GetRandomBusinessObjectKeywords(type, amount));
 }
示例#27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MassiveBusinessObjectCollection&lt;T&gt;"/> class.
 /// </summary>
 public MassiveBusinessObjectCollection()
     : base(null, typeof(T).Name.Decapitalize())
 {
     this.type = (BusinessObjectType)Enum.Parse(typeof(BusinessObjectType), typeof(T).Name, true);
 }
示例#28
0
        /// <summary>
        /// Gets the templates of all document types.
        /// </summary>
        /// <returns>Templates list.</returns>
        public XDocument GetTemplates()
        {
            XDocument xml = XDocument.Parse("<root><warehouseDocument/><salesDocument/><purchaseDocument/><orderDocument/><financialDocument/><salesOrderDocument/><item/><contractor/><serviceDocument/><complaintDocument/><inventoryDocument/><technologyDocument/><productionOrderDocument/></root>");

            BusinessObjectType[] types = new BusinessObjectType[] { BusinessObjectType.WarehouseDocument,
                                                                    BusinessObjectType.CommercialDocument, BusinessObjectType.FinancialDocument,
                                                                    BusinessObjectType.Item, BusinessObjectType.Contractor, BusinessObjectType.ServiceDocument,
                                                                    BusinessObjectType.ComplaintDocument, BusinessObjectType.InventoryDocument };

            DictionaryMapper.Instance.CheckForChanges();

            foreach (BusinessObjectType type in types)
            {
                if (!ConfigurationMapper.Instance.Templates.ContainsKey(type))
                {
                    continue;
                }

                foreach (string templateName in ConfigurationMapper.Instance.Templates[type].Keys)
                {
                    XElement fullTemplate = ConfigurationMapper.Instance.Templates[type][templateName];

                    if (fullTemplate.Element("visible") != null && fullTemplate.Element("visible").Value.ToUpperInvariant() == "FALSE")
                    {
                        continue;
                    }


                    XElement labelsElement = fullTemplate.Element("labels");
                    string   Lang          = fullTemplate.Element("labels").Elements().Aggregate("", (b, node) => b += ";" + node.Value.ToString());

                    XElement template = new XElement("template",
                                                     new XAttribute("id", templateName),
                                                     new XAttribute("label", BusinessObjectHelper.GetXmlLabelInUserLanguage(fullTemplate.Element("labels")).Value),
                                                     new XAttribute("labelEn", Lang), //preferredLang.FirstOrDefault().ToString()
                                                     new XAttribute("icon", fullTemplate.Element("icon").Value));

                    if (fullTemplate.Element("isDefault") != null && fullTemplate.Element("isDefault").Value.ToUpperInvariant() == "TRUE")
                    {
                        template.Add(new XAttribute("isDefault", "true"));
                    }

                    DocumentCategory?dc = null;
                    XElement         documentTypeIdElement = ((XElement)fullTemplate.FirstNode).Element("documentTypeId");

                    if (documentTypeIdElement != null)
                    {
                        template.Add(new XAttribute("documentTypeId", documentTypeIdElement.Value));
                        Guid         documentTypeId = new Guid(documentTypeIdElement.Value);
                        DocumentType dt             = DictionaryMapper.Instance.GetDocumentType(documentTypeId);
                        if (dt == null)
                        {
                            throw new ArgumentException(String.Format("Invalid documentTypeId: {0} in template: {1}", documentTypeId.ToUpperString(), templateName));
                        }
                        dc = dt.DocumentCategory;
                    }

                    if (dc == DocumentCategory.Sales)
                    {
                        xml.Root.Element("salesDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Purchase)
                    {
                        xml.Root.Element("purchaseDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Warehouse)
                    {
                        xml.Root.Element("warehouseDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Order || dc == DocumentCategory.Reservation)
                    {
                        xml.Root.Element("orderDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Financial)
                    {
                        xml.Root.Element("financialDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Service)
                    {
                        xml.Root.Element("serviceDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Complaint)
                    {
                        xml.Root.Element("complaintDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Inventory)
                    {
                        xml.Root.Element("inventoryDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.SalesOrder)
                    {
                        xml.Root.Element("salesOrderDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.Technology)
                    {
                        xml.Root.Element("technologyDocument").Add(template);
                    }
                    else if (dc == DocumentCategory.ProductionOrder)
                    {
                        xml.Root.Element("productionOrderDocument").Add(template);
                    }
                    else if (dc == null)
                    {
                        xml.Root.Element(type.ToString().Decapitalize()).Add(template);
                    }
                }
            }

            return(xml);
        }
示例#29
0
 /// <summary>
 /// Loads the <see cref="BusinessObject"/> with a specified Id.
 /// </summary>
 /// <param name="type">Type of <see cref="BusinessObject"/> to load.</param>
 /// <param name="id"><see cref="IBusinessObject"/>'s id indicating which <see cref="BusinessObject"/> to load.</param>
 /// <returns>
 /// Loaded <see cref="IBusinessObject"/> object.
 /// </returns>
 public override IBusinessObject LoadBusinessObject(BusinessObjectType type, Guid id)
 {
     throw new NotImplementedException();
 }
示例#30
0
 /// <summary>
 /// Creates a <see cref="BusinessObject"/> of a selected type.
 /// </summary>
 /// <param name="type">The type of <see cref="IBusinessObject"/> to create.</param>
 /// <param name="requestXml">Client requestXml containing initial parameters for the object.</param>
 /// <returns>A new <see cref="IBusinessObject"/>.</returns>
 public override IBusinessObject CreateNewBusinessObject(BusinessObjectType type, XDocument requestXml)
 {
     throw new NotImplementedException();
 }