Exemplo n.º 1
0
        private UploadAppSampleDataDictionary GetSampleData()
        {
            var r = new UploadAppSampleDataDictionary
            {
                ApplicationType            = ApplicationType.XKeys(),
                CreditTermAsked            = new[] { CreditTermAskedFrom.Text.Toi(), CreditTermAskedTo.Text.Toi() },
                DepositTermAsked           = new[] { DepositTermAskedFrom.Text.Toi(), DepositTermAskedTo.Text.Toi() },
                CreditLimitAsked           = new[] { CreditLimitAskedFrom.Text.Toi(), CreditLimitAskedTo.Text.Toi() },
                DepositLimitAsked          = new[] { DepositLimitAskedFrom.Text.Toi(), DepositLimitAskedTo.Text.Toi() },
                CardCategory               = CardCategory.XKeys(),
                PaternalNameM              = PaternalNameM.XVals(),
                NameM                      = NameM.XVals(),
                LastNameM                  = LastNameM.XVals(),
                PaternalNameG              = PaternalNameG.XVals(),
                NameG                      = NameG.XVals(),
                LastNameG                  = LastNameG.XVals(),
                IsSecondNameNOTChanged     = IsSecondNameNOTChanged.XKeys(),
                PreviousSecondName         = PreviousSecondName.XVals(),
                PlaceOfBirth               = PlaceOfBirth.XVals(),
                BirthDate                  = new[] { BirthDateFrom.Value, BirthDateTo.Value },
                Gender                     = Gender.XKeys(),
                IssuedOn                   = new[] { IssuedOnFrom.Value, IssuedOnTo.Value },
                IssuePlace                 = IssuePlace.XVals(),
                IssuedBy                   = IssuedBy.XVals(),
                LineCodeKLADR              = LineCodeKLADR.XKeys(),
                Building                   = new[] { BuildingFrom.Text.Toi(), BuildingTo.Text.Toi() },
                DeliveryAddress            = DeliveryAddress.XKeys(),
                AccountName                = AccountName.XVals(),
                AccountType                = AccountType.XKeys(),
                LaborContractType          = LaborContractType.XKeys(),
                TotalWorkExperience        = TotalWorkExperience.XKeys(),
                LastSeniority              = LastSeniority.XKeys(),
                JobTitle                   = JobTitle.XKeys(),
                AverageMonthlyIncome       = new[] { AverageMonthlyIncomeFrom.Text.Toi(), AverageMonthlyIncomeTo.Text.Toi() },
                IncomeCheckStatus          = IncomeCheckStatus.XKeys(),
                DeliveryAddressV           = DeliveryAddressV.XKeys(),
                Education                  = Education.XKeys(),
                MaritalStatus              = MaritalStatus.XKeys(),
                MinorChildrenNummber       = MinorChildrenNummber.XKeys(),
                ContactName                = ContactName.XVals(),
                RelationDegree             = RelationDegree.XKeys(),
                IsNotPublicPerson          = IsNotPublicPerson.XKeys(),
                MaidenName                 = MaidenName.XVals(),
                SecretQuestion             = SecretQuestion.XKeys(),
                PreviousCreditsQuantity    = PreviousCreditsQuantity.XKeys(),
                AccountSphere              = AccountSphere.XKeys(),
                AccountCompanyEmployeesQty = AccountCompanyEmployeesQty.XVals(),
                SecretWord                 = SecretWord.XVals(),
                BankingServiceCredit       = BankingServiceCredit.XKeys(),
                BankingServiceDebit        = BankingServiceDebit.XKeys(),
                CurrencyAsked              = CurrencyAsked.XKeys(),
                IsAgreeAuthorityTransfer   = IsAgreeAuthorityTransfer.XKeys(),
                IsDataAuthentic            = IsDataAuthentic.XKeys(),
                Street                     = Street.XVals(),
                PercentPayment             = PercentPayment.XVals(),
                PercentPaymentMethod       = PercentPaymentMethod.XVals(),
                DependentsNumber           = DependantsNumber.XKeys(),
                EarlierCreditStatuse       = EarlierCreditStatuse.XKeys(),
                EarlierCreditType          = EarlierCreditType.XKeys(),
                EarlierBank                = EarlierBank.XKeys(),
                EarlierMaxLoanTerm         = EarlierMaxLoanTerm.XKeys(),
                ClientType                 = ClientType.XKeys(),
            };

            return(r);
        }
Exemplo n.º 2
0
        public static void GetPrintXml(XDocument xml, string customLabelsLang)
        {
            string emptyGuid = Guid.Empty.ToString();

            var foreignKeys = from node in xml.Root.Descendants()
                              where node.Name.LocalName != "id" && node.Name.LocalName.EndsWith("Id", StringComparison.Ordinal) &&
                              node.Value != emptyGuid
                              select node;

            foreach (XElement element in foreignKeys)
            {
                ILabeledDictionaryBusinessObject bo = null;

                switch (element.Name.LocalName)
                {
                case "contractorFieldId":
                    bo = DictionaryMapper.Instance.GetContractorField(new Guid(element.Value));
                    element.Add(new XAttribute("name", ((ContractorField)bo).Name));
                    break;

                case "documentFieldId":
                    bo = DictionaryMapper.Instance.GetDocumentField(new Guid(element.Value));
                    DocumentField df = (DocumentField)bo;
                    element.Add(new XAttribute("name", df.Name));
                    //jezeli jest to id magazynu przeciwnego to dolaczamy jego label i symbol
                    if (df.Name == DocumentFieldName.ShiftDocumentAttribute_OppositeWarehouseId.ToString())
                    {
                        Warehouse whOp = DictionaryMapper.Instance.GetWarehouse(new Guid(element.Parent.Element("value").Value));
                        element.Add(new XAttribute("warehouseLabel", BusinessObjectHelper.GetBusinessObjectLabelInUserLanguage(whOp, customLabelsLang).Value));
                        element.Add(new XAttribute("warehouseSymbol", whOp.Symbol));
                    }
                    //jeśli jest atrybut typu select to zamiast wartości musi się pojawić etykieta odpowiadająca tej wartości w języku usera
                    if (df.DataType == DataType.Select)
                    {
                        XElement valueElement = element.Parent.Element(XmlName.Value);
                        if (valueElement != null)
                        {
                            valueElement.Value = BusinessObjectHelper.GetSelectedValueInUserLanguage(df, valueElement.Value);
                        }
                    }
                    break;

                case "jobPositionId":
                    bo = DictionaryMapper.Instance.GetJobPosition(new Guid(element.Value));
                    break;

                case "countryId":
                case "nipPrefixCountryId":
                    bo = DictionaryMapper.Instance.GetCountry(new Guid(element.Value));
                    element.Add(new XAttribute("symbol", ((Country)bo).Symbol));
                    break;

                case "contractorRelationTypeId":
                    bo = DictionaryMapper.Instance.GetContractorRelationType(new Guid(element.Value));
                    break;

                case "itemFieldId":
                    bo = DictionaryMapper.Instance.GetItemField(new Guid(element.Value));
                    element.Add(new XAttribute("name", ((ItemField)bo).Name));
                    break;

                case "itemRAVTypeId":
                    bo = DictionaryMapper.Instance.GetItemRelationAttrValueType(new Guid(element.Value));
                    break;

                case "itemRelationId":
                    bo = DictionaryMapper.Instance.GetItemRelationType(new Guid(element.Value));
                    break;

                case "itemTypeId":
                    bo = DictionaryMapper.Instance.GetItemType(new Guid(element.Value));
                    break;

                case "unitId":
                    bo = DictionaryMapper.Instance.GetUnit(new Guid(element.Value));
                    element.Add(new XAttribute("symbol", BusinessObjectHelper.GetBusinessObjectLabelInUserLanguage(bo, customLabelsLang).Attribute("symbol").Value));
                    break;

                case "unitTypeId":
                    bo = DictionaryMapper.Instance.GetUnitType(new Guid(element.Value));
                    break;

                case "vatRateId":
                    bo = DictionaryMapper.Instance.GetVatRate(new Guid(element.Value));
                    VatRate vr = (VatRate)bo;
                    element.Add(new XAttribute("fiscalSymbol", vr.FiscalSymbol));
                    element.Add(new XAttribute("symbol", vr.Symbol));
                    break;

                case "documentCurrencyId":
                case "systemCurrencyId":
                case "paymentCurrencyId":
                    bo = DictionaryMapper.Instance.GetCurrency(new Guid(element.Value));
                    element.Add(new XAttribute("symbol", ((Currency)bo).Symbol));
                    break;

                case "documentTypeId":
                    bo = DictionaryMapper.Instance.GetDocumentType(new Guid(element.Value));
                    element.Add(new XAttribute("symbol", ((DocumentType)bo).Symbol));
                    break;

                case "issuePlaceId":
                    bo = null;
                    IssuePlace issuePlace = DictionaryMapper.Instance.GetIssuePlace(new Guid(element.Value));
                    if (issuePlace == null)
                    {
                        throw new ArgumentNullException("issuePlaceId");
                    }
                    element.Add(new XAttribute("label", issuePlace.Name));
                    break;

                case "paymentMethodId":
                    bo = DictionaryMapper.Instance.GetPaymentMethod(new Guid(element.Value));
                    element.Add(new XAttribute("isIncrementingDueAmount", ((PaymentMethod)bo).IsIncrementingDueAmount ? "1" : "0"));
                    break;

                case "warehouseId":
                    bo = DictionaryMapper.Instance.GetWarehouse(new Guid(element.Value));
                    Warehouse wh = (Warehouse)bo;
                    element.Add(new XAttribute("symbol", wh.Symbol));
                    break;

                case "financialRegisterId":
                    FinancialRegister fr = DictionaryMapper.Instance.GetFinancialRegister(new Guid(element.Value));
                    bo = fr;

                    element.Add(new XAttribute("registerCategory", ((int)fr.RegisterCategory).ToString(CultureInfo.InvariantCulture)));

                    Guid     systemCurrencyId = ConfigurationMapper.Instance.SystemCurrencyId;
                    Currency currency         = DictionaryMapper.Instance.GetCurrency(fr.CurrencyId);

                    element.Add(new XAttribute("currencyId", currency.Id.ToUpperString()));
                    element.Add(new XAttribute("currencySymbol", currency.Symbol));
                    element.Add(new XAttribute("systemCurrencyId", systemCurrencyId.ToUpperString()));

                    if (!String.IsNullOrEmpty(fr.AccountingAccount))
                    {
                        element.Add(new XAttribute("accountingAccount", fr.AccountingAccount));
                    }

                    if (!String.IsNullOrEmpty(fr.BankAccountNumber))
                    {
                        element.Add(new XAttribute("bankAccountNumber", fr.BankAccountNumber));
                    }

                    break;

                case "containerTypeId":
                    bo = DictionaryMapper.Instance.GetContainerType(new Guid(element.Value));
                    break;

                case "servicePlaceId":
                    element.Add(new XAttribute("label", DictionaryMapper.Instance.GetServicePlace(new Guid(element.Value)).Name));
                    break;

                case "itemGroupId":
                    string path = DictionaryMapper.Instance.GetItemGroupMembershipPath(element.Value);
                    if (path != null)
                    {
                        element.Add(new XAttribute("path", path));
                    }
                    break;
                }

                if (bo != null)
                {
                    element.Add(new XAttribute("label", BusinessObjectHelper.GetBusinessObjectLabelInUserLanguage(bo, customLabelsLang).Value));
                }
            }
        }