Ejemplo n.º 1
0
        public AditionalDocumentsViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oAditionalData)
        {
            AditionalDataId = oAditionalData.ItemId.ToString();
            Enable          = oAditionalData.Enable;
            Title           = oAditionalData.ItemName;

            AditionalDataTypeId = oAditionalData.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCompanyInfoType.AditionalDocumentType).
                                  Select(x => x.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            AditionalDataType = oAditionalData.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCompanyInfoType.AditionalDocumentType).
                                Select(x => x.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            ModuleId = oAditionalData.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCompanyInfoType.ModuleType).
                       Select(x => x.ItemInfoId.ToString()).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            Module = oAditionalData.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCompanyInfoType.ModuleType).
                     Select(x => x.Value).
                     DefaultIfEmpty(string.Empty).
                     FirstOrDefault();
        }
 public ProviderBalanceSheetViewModel
     (ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedAccount,
     ProveedoresOnLine.CompanyProvider.Models.Provider.BalanceSheetDetailModel oRelatedBalanceSheetDetail)
 {
     RelatedAccount            = oRelatedAccount;
     RelatedBalanceSheetDetail = oRelatedBalanceSheetDetail;
 }
        public void AditionalDocumentsUpsert()
        {
            ProveedoresOnLine.CompanyCustomer.Models.Customer.CustomerModel oModel        = new Models.Customer.CustomerModel();
            ProveedoresOnLine.Company.Models.Util.GenericItemModel          oGenericModel = new ProveedoresOnLine.Company.Models.Util.GenericItemModel();

            oModel.RelatedCompany = new Company.Models.Company.CompanyModel();
            oModel.RelatedCompany.CompanyPublicId = "DA5C572E";

            oModel.AditionalDocuments = new List <Company.Models.Util.GenericItemModel>();

            oGenericModel = new Company.Models.Util.GenericItemModel()
            {
                ItemId   = 0,
                ItemName = "Archivo adicional de prueba",
                Enable   = true,
                ItemInfo = new List <Company.Models.Util.GenericItemInfoModel>(),
            };

            oGenericModel.ItemInfo.Add(
                new Company.Models.Util.GenericItemInfoModel()
            {
                ItemInfoId   = 0,
                ItemInfoType = new Company.Models.Util.CatalogModel()
                {
                    ItemId = 220003,
                },
                Value  = "1701001",
                Enable = true,
            });

            oGenericModel.ItemInfo.Add(
                new Company.Models.Util.GenericItemInfoModel()
            {
                ItemInfoId   = 0,
                ItemInfoType = new Company.Models.Util.CatalogModel()
                {
                    ItemId = 220004,
                },
                Value  = "701001",
                Enable = true,
            }
                );

            oModel.AditionalDocuments.Add(oGenericModel);

            oModel = ProveedoresOnLine.CompanyCustomer.Controller.CompanyCustomer.AditionalDocumentsUpsert(oModel);

            Assert.AreEqual(true, oModel != null && oModel.AditionalDocuments != null);
        }
        public AdminReportRoleViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedReportRole)
        {
            RelatedReporRole = oRelatedReportRole;

            this.ReportRoleId = RelatedReporRole.ItemId.ToString();

            this.ReportRole = RelatedReporRole.ItemName;

            this.ReportRoleTypeId = RelatedReporRole.ItemType.ItemId.ToString();

            this.ReportRoleTypeName = RelatedReporRole.ItemType.ItemName;

            this.Enable = RelatedReporRole.Enable;

            this.LastModify = RelatedReporRole.LastModify.ToString();

            this.CreateDate = RelatedReporRole.CreateDate.ToString();
        }
        public AdminModuleOptionViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedModuleOption)
        {
            this.oModuleOptions = oRelatedModuleOption;

            this.ModuleOptionId = oModuleOptions.ItemId.ToString();

            this.ModuleOption = oModuleOptions.ItemName;

            this.ModuleOptionTypeId = oModuleOptions.ItemType.ItemId.ToString();

            this.ModuleOptionTypeName = oModuleOptions.ItemType.ItemName;

            this.Enable = oModuleOptions.Enable;

            this.LastModify = oModuleOptions.LastModify.ToString();

            this.CreateDate = oModuleOptions.CreateDate.ToString();
        }
        public void CustomerProvider_Sanofi_CustomDataInfo_Upsert()
        {
            ProveedoresOnLine.Company.Models.Util.GenericItemModel oReturn = new ProveedoresOnLine.Company.Models.Util.GenericItemModel()
            {
                ItemId   = 8,
                ItemInfo = new List <ProveedoresOnLine.Company.Models.Util.GenericItemInfoModel>()
                {
                    new ProveedoresOnLine.Company.Models.Util.GenericItemInfoModel()
                    {
                        ItemInfoId = 8,
                        Value      = "201005",
                        Enable     = true,
                    },
                },
            };

            oReturn = IntegrationPlatform.Controller.IntegrationPlatform.CustomerProvider_Sanofi_CustomDataInfo_Upsert(oReturn);

            Assert.AreEqual(true, oReturn != null);
        }
Ejemplo n.º 7
0
        public SurveyConfigItemViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedSurveyConfigItem)
        {
            RelatedSurveyConfigItem = oRelatedSurveyConfigItem;

            AreaId = oRelatedSurveyConfigItem.ParentItem != null?oRelatedSurveyConfigItem.ParentItem.ItemId.ToString() : string.Empty;

            AreaName = oRelatedSurveyConfigItem.ParentItem != null ? oRelatedSurveyConfigItem.ParentItem.ItemName : string.Empty;

            SurveyConfigItemInfoRol = oRelatedSurveyConfigItem.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumSurveyConfigItemInfoType.RolId).
                                      Select(y => y.Value).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            SurveyConfigItemInfoRolId = oRelatedSurveyConfigItem.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumSurveyConfigItemInfoType.RolId).
                                        Select(y => y.ItemInfoId.ToString()).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault();

            SurveyConfigItemInfoRolName = !string.IsNullOrEmpty(SurveyConfigItemInfoRol) ? MarketPlace.Models.Company.CompanyUtil.CompanyRole.RelatedRole.
                                          Where(x => x.ItemId.ToString() == SurveyConfigItemInfoRol)
                                          .Select(x => x.ItemName).FirstOrDefault() : string.Empty;

            SurveyConfigItemInfoRolWeight = oRelatedSurveyConfigItem.ItemInfo.
                                            Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumSurveyConfigItemInfoType.RolWeight).
                                            Select(y => y.Value).
                                            DefaultIfEmpty(string.Empty).
                                            FirstOrDefault();

            SurveyConfigItemInfoRolWeightId = oRelatedSurveyConfigItem.ItemInfo.
                                              Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumSurveyConfigItemInfoType.RolWeight).
                                              Select(y => y.ItemInfoId.ToString()).
                                              DefaultIfEmpty(string.Empty).
                                              FirstOrDefault();
        }
        public static ProveedoresOnLine.Company.Models.Util.GenericItemModel AditionalDocumentsInfoUpsert(ProveedoresOnLine.Company.Models.Util.GenericItemModel AditionalDocuementsInfoToUpsert)
        {
            if (AditionalDocuementsInfoToUpsert != null &&
                AditionalDocuementsInfoToUpsert.ItemId > 0 &&
                AditionalDocuementsInfoToUpsert.ItemInfo != null)
            {
                AditionalDocuementsInfoToUpsert.ItemInfo.All(adinf =>
                {
                    LogManager.Models.LogModel oLog = Company.Controller.Company.GetGenericLogModel();

                    try
                    {
                        adinf.ItemInfoId = ProveedoresOnLine.CompanyCustomer.DAL.Controller.CompanyCustomerDataController.Instance.AditionalDocumentsInfoUpsert(
                            AditionalDocuementsInfoToUpsert.ItemId,
                            adinf.ItemInfoId > 0 ? (int?)adinf.ItemInfoId : null,
                            adinf.ItemInfoType.ItemId,
                            adinf.Value,
                            adinf.LargeValue,
                            adinf.Enable);

                        oLog.IsSuccess = true;
                    }
                    catch (Exception err)
                    {
                        oLog.IsSuccess = false;
                        oLog.Message   = err.Message + " - " + err.StackTrace;

                        throw err;
                    }
                    finally
                    {
                        oLog.LogObject = adinf;

                        oLog.RelatedLogInfo.Add(new LogManager.Models.LogInfoModel()
                        {
                            LogInfoType = "AditionalDocumentsInfo",
                            Value       = adinf.ItemInfoId.ToString(),
                        });

                        LogManager.ClientLog.AddLog(oLog);
                    }

                    return(true);
                });
            }

            return(AditionalDocuementsInfoToUpsert);
        }
Ejemplo n.º 9
0
        public ProviderLegalViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedLegal,
                                      List <ProveedoresOnLine.Company.Models.Util.GenericItemModel> oICA)
        {
            RelatedLegal = oRelatedLegal;

            LegalId = oRelatedLegal.ItemId.ToString();

            LegalName = oRelatedLegal.ItemName;

            Enable = oRelatedLegal.Enable;

            #region ChaimberOfComerce
            CP_ConstitutionDate = RelatedLegal.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_ConstitutionDate).
                                  Select(y => y.Value).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            CP_ConstitutionDateId = RelatedLegal.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_ConstitutionDate).
                                    Select(y => y.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            CP_ConstitutionEndDate = RelatedLegal.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_ConstitutionEndDate).
                                     Select(y => y.Value).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            CP_ConstitutionEndDateId = RelatedLegal.ItemInfo.
                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_ConstitutionEndDate).
                                       Select(y => y.ItemInfoId.ToString()).
                                       DefaultIfEmpty(string.Empty).
                                       FirstOrDefault();

            CP_State = RelatedLegal.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_State).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            CP_StateId = RelatedLegal.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_State).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            CP_InscriptionCity = RelatedLegal.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_InscriptionCity).
                                 Select(y => y.Value).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            CP_InscriptionCityId = RelatedLegal.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_InscriptionCity).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            CP_InscriptionNumber = RelatedLegal.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_InscriptionNumber).
                                   Select(y => y.Value).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            CP_InscriptionNumberId = RelatedLegal.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_InscriptionNumber).
                                     Select(y => y.ItemInfoId.ToString()).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            CP_ExistenceAndLegalPersonCertificate = RelatedLegal.ItemInfo.
                                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_ExistenceAndLegalPersonCertificate).
                                                    Select(y => y.Value).
                                                    DefaultIfEmpty(string.Empty).
                                                    FirstOrDefault();

            CP_ExistenceAndLegalPersonCertificateId = RelatedLegal.ItemInfo.
                                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_ExistenceAndLegalPersonCertificate).
                                                      Select(y => y.ItemInfoId.ToString()).
                                                      DefaultIfEmpty(string.Empty).
                                                      FirstOrDefault();

            CP_CertificateExpeditionDate = RelatedLegal.ItemInfo.
                                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_CertificateExpeditionDate).
                                           Select(y => y.Value).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();

            CP_CertificateExpeditionDateId = RelatedLegal.ItemInfo.
                                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_CertificateExpeditionDate).
                                             Select(y => y.ItemInfoId.ToString()).
                                             DefaultIfEmpty(string.Empty).
                                             FirstOrDefault();

            CP_SocialObject = RelatedLegal.ItemInfo.
                              Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_SocialObject).
                              Select(y => y.LargeValue).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();

            CP_SocialObjectId = RelatedLegal.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CP_SocialObject).
                                Select(y => y.ItemInfoId.ToString()).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            #endregion

            #region Designations

            CD_PartnerName = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CD_PartnerName).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            CD_PartnerNameId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CD_PartnerName).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            CD_PartnerIdentificationNumber = RelatedLegal.ItemInfo.
                                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CD_PartnerIdentificationNumber).
                                             Select(y => y.Value).
                                             DefaultIfEmpty(string.Empty).
                                             FirstOrDefault();

            CD_PartnerIdentificationNumberId = RelatedLegal.ItemInfo.
                                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CD_PartnerIdentificationNumber).
                                               Select(y => y.ItemInfoId.ToString()).
                                               DefaultIfEmpty(string.Empty).
                                               FirstOrDefault();

            CD_PartnerRank = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CD_PartnerRank).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            CD_PartnerRankId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CD_PartnerRank).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();
            #endregion

            #region RUT

            R_PersonType = RelatedLegal.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_PersonType).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            R_PersonTypeId = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_PersonType).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            R_LargeContributor = RelatedLegal.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributor).
                                 Select(y => (y.Value)).
                                 FirstOrDefault() == "True" ? true : false;

            R_LargeContributorId = RelatedLegal.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributor).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            R_LargeContributorReceipt = RelatedLegal.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributorReceipt).
                                        Select(y => y.Value).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault();

            R_LargeContributorReceiptId = RelatedLegal.ItemInfo.
                                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributorReceipt).
                                          Select(y => y.ItemInfoId.ToString()).
                                          DefaultIfEmpty(string.Empty).
                                          FirstOrDefault();

            R_LargeContributorDate = RelatedLegal.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributorDate).
                                     Select(y => y.Value).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            R_LargeContributorDateId = RelatedLegal.ItemInfo.
                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributorDate).
                                       Select(y => y.ItemInfoId.ToString()).
                                       DefaultIfEmpty(string.Empty).
                                       FirstOrDefault();

            R_SelfRetainer = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainer).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault() == "True" ? true : false;

            R_SelfRetainerId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainer).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            R_SelfRetainerReciept = RelatedLegal.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainerReciept).
                                    Select(y => y.Value).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            R_SelfRetainerRecieptId = RelatedLegal.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainerReciept).
                                      Select(y => y.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            R_SelfRetainerDate = RelatedLegal.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainerDate).
                                 Select(y => y.Value).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            R_SelfRetainerDateId = RelatedLegal.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainerDate).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            R_EntityType = RelatedLegal.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_EntityType).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            R_EntityTypeId = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_EntityType).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            R_IVA = RelatedLegal.ItemInfo.
                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_IVA).
                    Select(y => y.Value).
                    DefaultIfEmpty(string.Empty).
                    FirstOrDefault() == "True" ? true : false;

            R_IVAId = RelatedLegal.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_IVA).
                      Select(y => y.ItemInfoId.ToString()).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            R_TaxPayerType = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_TaxPayerType).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            R_TaxPayerTypeId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_TaxPayerType).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            R_ICA = RelatedLegal.ItemInfo.
                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_ICA).
                    Select(y => y.Value).
                    DefaultIfEmpty(string.Empty).
                    FirstOrDefault();

            R_ICAId = RelatedLegal.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_ICA).
                      Select(y => y.ItemInfoId.ToString()).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            if (oICA != null && oICA.Count > 0)
            {
                R_ICAName = oICA.
                            Where(x => x.ItemId.ToString() == R_ICA).
                            Select(x => x.ItemName).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();
            }

            R_RUTFile = RelatedLegal.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_RUTFile).
                        Select(y => y.Value).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            R_RUTFileId = RelatedLegal.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_RUTFile).
                          Select(y => y.ItemInfoId.ToString()).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();

            R_LargeContributorFile = RelatedLegal.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributorFile).
                                     Select(y => y.Value).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            R_LargeContributorFileId = RelatedLegal.ItemInfo.
                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_LargeContributorFile).
                                       Select(y => y.ItemInfoId.ToString()).
                                       DefaultIfEmpty(string.Empty).
                                       FirstOrDefault();

            R_SelfRetainerFile = RelatedLegal.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainerFile).
                                 Select(y => y.Value).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            R_SelfRetainerFileId = RelatedLegal.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_SelfRetainerFile).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            R_ClassTax = RelatedLegal.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_ClassTax).
                         Select(y => y.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            R_ClassTaxId = RelatedLegal.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.R_ClassTax).
                           Select(y => y.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            #endregion

            #region CIFIN

            CF_QueryDate = RelatedLegal.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CF_QueryDate).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            CF_QueryDateId = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CF_QueryDate).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            CF_ResultQuery = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CF_ResultQuery).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            CF_ResultQueryId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CF_ResultQuery).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            CF_AutorizationFile = RelatedLegal.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CF_AutorizationFile).
                                  Select(y => y.Value).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            CF_AutorizationFileId = RelatedLegal.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.CF_AutorizationFile).
                                    Select(y => y.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            #endregion

            #region SARLAFT

            SF_ProcessDate = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.SF_ProcessDate).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            SF_ProcessDateId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.SF_ProcessDate).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            SF_PersonType = RelatedLegal.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.SF_PersonType).
                            Select(y => y.Value).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            SF_PersonTypeId = RelatedLegal.ItemInfo.
                              Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.SF_PersonType).
                              Select(y => y.ItemInfoId.ToString()).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();

            SF_SARLAFTFile = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.SF_SARLAFTFile).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            SF_SARLAFTFileId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.SF_SARLAFTFile).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            #endregion

            #region Resolutions


            RS_EntityType = RelatedLegal.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_EntityType).
                            Select(y => y.Value).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            RS_EntityTypeId = RelatedLegal.ItemInfo.
                              Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_EntityType).
                              Select(y => y.ItemInfoId.ToString()).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();

            RS_ResolutionFile = RelatedLegal.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_ResolutionFile).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            RS_ResolutionFileId = RelatedLegal.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_ResolutionFile).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            RS_StartDate = RelatedLegal.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_StartDate).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            RS_StartDateId = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_StartDate).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            RS_EndDate = RelatedLegal.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_EndDate).
                         Select(y => y.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            RS_EndDateId = RelatedLegal.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_EndDate).
                           Select(y => y.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            RS_Description = RelatedLegal.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_Description).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            RS_DescriptionId = RelatedLegal.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumLegalInfoType.RS_Description).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();


            #endregion
        }
 public ProviderDesignationsViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel RelatedLegal)
 {
     RelatedLegalInfo = RelatedLegal;
 }
        public string GetJsonDataFinancial(ProveedoresOnLine.Company.Models.Util.GenericItemModel RelatedAccount)
        {
            StringBuilder oReturn = new StringBuilder();

            MarketPlace.Models.Company.CompanyUtil.FinancialAccount.
            Where(ac =>
                  RelatedAccount != null ?
                  (ac.ParentItem != null && ac.ParentItem.ItemId == RelatedAccount.ItemId) :
                  (ac.ParentItem == null)).
            OrderBy(ac => ac.ItemInfo.
                    Where(aci => aci.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumCategoryInfoType.AI_Order).
                    Select(aci => Convert.ToInt32(aci.Value)).
                    DefaultIfEmpty(0).
                    FirstOrDefault()).
            All(ac =>
            {
                #region Get Account Values

                //get account type
                string strAccountType = ac.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumCategoryInfoType.AI_IsValue).
                                        Select(y => y.Value.Replace(" ", "")).
                                        DefaultIfEmpty("2").
                                        FirstOrDefault();

                //get account unit
                string oAccountUnit = ac.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)MarketPlace.Models.General.enumCategoryInfoType.AI_Unit).
                                      Select(y => y.Value.Replace(" ", "")).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

                #endregion

                if (strAccountType != "2")
                {
                    //get child values
                    oReturn.AppendLine(GetJsonDataFinancial(ac));
                }

                oReturn.Append("{");

                #region Item data

                CompareColumns.All(col =>
                {
                    if (col == "EvaluationArea")
                    {
                        oReturn.Append("EvaluationArea:{" +
                                       MarketPlace.Models.General.Constants.C_Program_Compare_Value_EvaluationArea.
                                       Replace("{Name}", "'" + ac.ItemName + "'").
                                       Replace("{Type}", "'" + strAccountType + "'") +
                                       "},");
                    }
                    else if (col != "EvaluationArea" && RelatedCompare.RelatedProvider != null)
                    {
                        //get currency rate
                        int oCurrencyFrom = RelatedCompare.RelatedProvider.
                                            Where(rp => rp.RelatedCompany != null &&
                                                  rp.RelatedCompany.CompanyPublicId == col &&
                                                  rp.CompareDetail != null &&
                                                  rp.CompareDetail.Count > 0).
                                            Select(rp => rp.CompareDetail.
                                                   Where(cd => cd.EvaluationAreaId == ac.ItemId &&
                                                         !string.IsNullOrEmpty(cd.Currency)).
                                                   Select(cd => Convert.ToInt32(cd.Currency)).
                                                   FirstOrDefault()).
                                            FirstOrDefault();

                        decimal CurrencyRate = GetCurrencyRateCaching
                                                   (oCurrencyFrom, CompareCurrency, Year == null ? DateTime.Now.Year : Year.Value);

                        //get company values
                        List <Tuple <int, string, string> > lstValItem = RelatedCompare.RelatedProvider.
                                                                         Where(rp => rp.RelatedCompany != null &&
                                                                               rp.RelatedCompany.CompanyPublicId == col &&
                                                                               rp.CompareDetail != null &&
                                                                               rp.CompareDetail.Count > 0).
                                                                         Select(rp => rp.CompareDetail.
                                                                                Where(cd => cd.EvaluationAreaId == ac.ItemId &&
                                                                                      cd.Value != null &&
                                                                                      cd.Value.Count > 0).
                                                                                Select(cd => cd.Value).
                                                                                FirstOrDefault()).
                                                                         FirstOrDefault();

                        oReturn.Append("_" + col + ":{");

                        for (int i = 1; i <= MaxValueCount; i++)
                        {
                            //get current value
                            Tuple <int, string, string> ValItem = null;
                            if (lstValItem != null && lstValItem.Count > 0)
                            {
                                ValItem = lstValItem.Where(vi => vi.Item1 == i).FirstOrDefault();
                            }
                            oReturn.Append(MarketPlace.Models.General.Constants.C_Program_Compare_Value_Item.
                                           Replace("{i}", i.ToString()).
                                           Replace("{Value}", "'" + (ValItem != null ? (oAccountUnit != "$" ? ValItem.Item2 : GetDecimalCurrency(ValItem.Item2, CurrencyRate)) : (strAccountType == "2" ? " - " : "0")) + "'").
                                           Replace("{After}", "'" + (oAccountUnit == "$" ? string.Empty : (ValItem != null ? ValItem.Item3 : string.Empty)) + "'").
                                           Replace("{Before}", "'" + (oAccountUnit != "$" ? string.Empty : (ValItem != null ? ValItem.Item3 : string.Empty)) + "'"));
                        }

                        oReturn.Append("},");
                    }
                    return(true);
                });

                #endregion

                oReturn.Append("},");

                if (strAccountType == "2")
                {
                    //get child values
                    oReturn.Append(GetJsonDataFinancial(ac));
                }

                return(true);
            });

            return(oReturn.ToString());
        }
Ejemplo n.º 12
0
        public ProviderAditionalDocumentViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedAditionalDocument,
                                                  ProveedoresOnLine.CompanyCustomer.Models.Customer.CustomerModel oCustomerList)
        {
            RelatedAditionalDocument = oRelatedAditionalDocument;

            AditionalDocumentId   = RelatedAditionalDocument.ItemId.ToString();
            AditionalDocumentName = RelatedAditionalDocument.ItemName;
            Enable = RelatedAditionalDocument.Enable;

            #region Aditional Document

            AD_FileId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_File).
                        Select(x => x.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            AD_File = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_File).
                      Select(x => x.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            AD_RelatedCustomerId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_RelatedCustomer).
                                   Select(x => x.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            AD_RelatedCustomer = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_RelatedCustomer).
                                 Select(x => x.Value).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            AD_RelatedCustomerName = oCustomerList.RelatedProvider.Where(x => x.RelatedProvider.CompanyPublicId == AD_RelatedCustomer).
                                     Select(x => x.RelatedProvider.CompanyName).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            AD_RelatedUserId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_RelatedUser).
                               Select(x => x.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            AD_RelatedUser = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_RelatedUser).
                             Select(x => x.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            AD_CreateDate = RelatedAditionalDocument.LastModify.ToString();

            AD_Title = RelatedAditionalDocument.ItemName;

            AD_ValueId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_Value).
                         Select(x => x.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();
            AD_Value = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_Value).
                       Select(x => x.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            AD_InitialDateId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_InitialDate).
                               Select(x => x.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();
            AD_InitialDate = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_InitialDate).
                             Select(x => x.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();
            AD_EndDateId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_EndDate).
                           Select(x => x.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();
            AD_EndDate = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_EndDate).
                         Select(x => x.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            AD_VigencyId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_Vigency).
                           Select(x => x.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();
            AD_Vigency = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_Vigency).
                         Select(x => x.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            AD_DescriptionId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_Description).
                               Select(x => x.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();
            AD_Description = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDocumentInfoType.AD_Description).
                             Select(x => x.LargeValue).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            #endregion

            #region Aditional Data

            ADT_DataTypeId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_DataType).
                             Select(x => x.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            ADT_DataType = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_DataType).
                           Select(x => x.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            ADT_DataValueId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_Value).
                              Select(x => x.ItemInfoId.ToString()).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();

            ADT_DataValue = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_Value).
                            Select(x => x.Value).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            ADT_RelatedCustomerId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_RelatedCustomer).
                                    Select(x => x.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            ADT_RelatedCustomer = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_RelatedCustomer).
                                  Select(x => x.Value).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            ADT_RelatedCustomerName = oCustomerList.RelatedProvider.Where(x => x.RelatedProvider.CompanyPublicId == ADT_RelatedCustomer).
                                      Select(x => x.RelatedProvider.CompanyName).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            ADT_RelatedUserId = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_RelatedUser).
                                Select(x => x.ItemInfoId.ToString()).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            ADT_RelatedUser = RelatedAditionalDocument.ItemInfo.Where(x => x.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumAditionalDataInfoType.ADT_RelatedUser).
                              Select(x => x.Value).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();

            ADT_CreateDate = RelatedAditionalDocument.LastModify.ToString();

            ADT_Title = RelatedAditionalDocument.ItemName;

            #endregion
        }
        public static ProveedoresOnLine.Company.Models.Util.GenericItemModel CustomerProvider_Publicar_CustomDataInfo_Upsert(ProveedoresOnLine.Company.Models.Util.GenericItemModel oCustomDataToUpsert)
        {
            if (oCustomDataToUpsert != null &&
                oCustomDataToUpsert.ItemInfo != null &&
                oCustomDataToUpsert.ItemInfo.Count > 0)
            {
                oCustomDataToUpsert.ItemInfo.All(dti =>
                {
                    LogManager.Models.LogModel oLog = ProveedoresOnLine.Company.Controller.Company.GetGenericLogModel();

                    try
                    {
                        dti.ItemInfoId = DAL.Controller.IntegrationPlatformDataController.Instance.Publicar_AditionalDataInfo_Upsert(
                            dti.ItemInfoId,
                            oCustomDataToUpsert.ItemId,
                            dti.ItemInfoType != null ? dti.ItemInfoType.ItemId : 0,
                            dti.Value,
                            dti.LargeValue,
                            dti.Enable);

                        oLog.IsSuccess = true;
                    }
                    catch (Exception err)
                    {
                        oLog.IsSuccess = false;
                        oLog.Message   = err.Message + " - " + err.StackTrace;

                        throw err;
                    }
                    finally
                    {
                        oLog.LogObject = dti;

                        oLog.RelatedLogInfo.Add(new LogManager.Models.LogInfoModel()
                        {
                            LogInfoType = "CustomDataInfo",
                            Value       = dti.ItemInfoId.ToString(),
                        });

                        LogManager.ClientLog.AddLog(oLog);
                    }

                    return(true);
                });
            }

            return(oCustomDataToUpsert);
        }
 public ProviderAditionalDocumentViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedAditionalDocument)
 {
     RelatedAditionalDocument = oRelatedAditionalDocument;
 }
        public ProviderContactViewModel
            (ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedContact,
            List <ProveedoresOnLine.Company.Models.Util.GeographyModel> oCities)
        {
            RelatedContact = oRelatedContact;

            ContactId = RelatedContact.ItemId.ToString();

            ContactName = RelatedContact.ItemName;

            Enable = RelatedContact.Enable;

            #region CompanyContact

            CC_Value = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CC_Value).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            CC_ValueId = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CC_Value).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            CC_CompanyContactType = RelatedContact.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CC_CompanyContactType).
                                    Select(y => y.Value).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            CC_CompanyContactTypeId = RelatedContact.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CC_CompanyContactType).
                                      Select(y => y.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            #endregion

            #region PersonContact

            CP_PersonContactType = RelatedContact.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_PersonContactType).
                                   Select(y => y.Value).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();
            CP_PersonContactTypeId = RelatedContact.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_PersonContactType).
                                     Select(y => y.ItemInfoId.ToString()).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            CP_IdentificationType = RelatedContact.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationType).
                                    Select(y => y.Value).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();
            CP_IdentificationTypeId = RelatedContact.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationType).
                                      Select(y => y.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            CP_IdentificationNumber = RelatedContact.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationNumber).
                                      Select(y => y.Value).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();
            CP_IdentificationNumberId = RelatedContact.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationNumber).
                                        Select(y => y.ItemInfoId.ToString()).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault();

            CP_IdentificationCity = RelatedContact.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationCity).
                                    Select(y => y.Value).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();
            CP_IdentificationCityId = RelatedContact.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationCity).
                                      Select(y => y.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            CP_IdentificationFile = RelatedContact.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationFile).
                                    Select(y => y.Value).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();
            CP_IdentificationFileId = RelatedContact.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_IdentificationFile).
                                      Select(y => y.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            CP_Phone = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Phone).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();
            CP_PhoneId = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Phone).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            CP_Extent = RelatedContact.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Extent).
                        Select(y => y.Value).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();
            CP_ExtentId = RelatedContact.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Extent).
                          Select(y => y.ItemInfoId.ToString()).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();

            CP_Email = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Email).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();
            CP_EmailId = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Email).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            CP_Negotiation = RelatedContact.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Negotiation).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();
            CP_NegotiationId = RelatedContact.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.CP_Negotiation).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            #endregion

            #region Branch

            BR_Representative = RelatedContact.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Representative).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();
            BR_RepresentativeId = RelatedContact.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Representative).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            BR_Address = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Address).
                         Select(y => y.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();
            BR_AddressId = RelatedContact.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Address).
                           Select(y => y.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            BR_City = RelatedContact.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_City).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();
            BR_CityId = RelatedContact.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_City).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            if (oCities != null && oCities.Count > 0)
            {
                BR_CityName = oCities.
                              Where(x => x.City.ItemId.ToString() == BR_City).
                              Select(x => x.Country.ItemName + "," + x.State.ItemName + "," + x.City.ItemName).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();
            }

            BR_Phone = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Phone).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();
            BR_PhoneId = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Phone).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            BR_Extent = RelatedContact.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Extent).
                        Select(y => y.Value).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();
            BR_ExtentId = RelatedContact.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Extent).
                          Select(y => y.ItemInfoId.ToString()).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();

            BR_Cellphone = RelatedContact.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Cellphone).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();
            BR_CellphoneId = RelatedContact.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Cellphone).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            BR_Fax = RelatedContact.ItemInfo.
                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Fax).
                     Select(y => y.Value).
                     DefaultIfEmpty(string.Empty).
                     FirstOrDefault();
            BR_FaxId = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Fax).
                       Select(y => y.ItemInfoId.ToString()).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            BR_Email = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Email).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();
            BR_EmailId = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Email).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            BR_Website = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Website).
                         Select(y => y.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();
            BR_WebsiteId = RelatedContact.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Website).
                           Select(y => y.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            BR_Latitude = RelatedContact.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Latitude).
                          Select(y => y.Value).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();
            BR_LatitudeId = RelatedContact.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Latitude).
                            Select(y => y.ItemInfoId.ToString()).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            BR_Longitude = RelatedContact.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Longitude).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();
            BR_LongitudeId = RelatedContact.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_Longitude).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            BR_IsPrincipal = RelatedContact.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_IsPrincipal).
                             Select(y => y.Value == "1" ? true : false).
                             DefaultIfEmpty().
                             FirstOrDefault();
            BR_IsPrincipalId = RelatedContact.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.BR_IsPrincipal).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            #endregion

            #region Distributor

            DT_DistributorType = RelatedContact.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DistributorType).
                                 Select(y => y.Value).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();
            DT_DistributorTypeId = RelatedContact.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DistributorType).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            DT_Representative = RelatedContact.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_Representative).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();
            DT_RepresentativeId = RelatedContact.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_Representative).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            DT_Email = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_Email).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();
            DT_EmailId = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_Email).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            DT_Phone = RelatedContact.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_Phone).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();
            DT_PhoneId = RelatedContact.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_Phone).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            DT_City = RelatedContact.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_City).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();
            DT_CityId = RelatedContact.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_City).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();
            if (oCities != null && oCities.Count > 0)
            {
                DT_CityName = oCities.
                              Where(x => x.City.ItemId.ToString() == DT_City).
                              Select(x => x.Country.ItemName + "," + x.State.ItemName + "," + x.City.ItemName).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();
            }

            DT_DateIssue = RelatedContact.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DateIssue).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();
            DT_DateIssueId = RelatedContact.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DateIssue).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            //DT_DueDate = RelatedContact.ItemInfo.
            //       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DueDate).
            //       Select(y => y.Value).
            //       DefaultIfEmpty(string.Empty).
            //       FirstOrDefault();
            //DT_DueDateId = RelatedContact.ItemInfo.
            //        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DueDate).
            //        Select(y => y.ItemInfoId.ToString()).
            //        DefaultIfEmpty(string.Empty).
            //        FirstOrDefault();

            DT_DistributorFile = RelatedContact.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DistributorFile).
                                 Select(y => y.Value).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();
            DT_DistributorFileId = RelatedContact.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumContactInfoType.DT_DistributorFile).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            #endregion
        }
        public EvaluationItemViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedEvaluationItem)
        {
            RelatedEvaluationItem = oRelatedEvaluationItem;

            EvaluationItemId       = RelatedEvaluationItem.ItemId.ToString();
            EvaluationItemName     = RelatedEvaluationItem.ItemName;
            EvaluationItemTypeId   = RelatedEvaluationItem.ItemType.ItemId.ToString();
            EvaluationItemTypeName = RelatedEvaluationItem.ItemType.ItemName;
            ParentEvaluationItem   = RelatedEvaluationItem.ParentItem == null ? null : RelatedEvaluationItem.ParentItem.ToString();
            EvaluationItemEnable   = RelatedEvaluationItem.Enable;

            EA_EvaluatorTypeId = RelatedEvaluationItem.ItemInfo.
                                 Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.EvaluatorType).
                                 Select(x => x.ItemInfoId.ToString()).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();
            EA_EvaluatorType = RelatedEvaluationItem.ItemInfo.
                               Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.EvaluatorType).
                               Select(x => (BackOffice.Models.General.enumEvaluatorType)Convert.ToInt32(x.Value.Replace(" ", ""))).
                               DefaultIfEmpty(BackOffice.Models.General.enumEvaluatorType.None).
                               FirstOrDefault();

            EA_EvaluatorId = RelatedEvaluationItem.ItemInfo.
                             Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Evaluator).
                             Select(x => x.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();
            EA_Evaluator = RelatedEvaluationItem.ItemInfo.
                           Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Evaluator).
                           Select(x => x.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();
            if (RelatedEvaluationItem.ItemInfo != null &&
                RelatedEvaluationItem.ItemInfo.Count > 0 &&
                EA_EvaluatorType == Models.General.enumEvaluatorType.AnyoneRole)
            {
                EA_EvaluatorName = RelatedEvaluationItem.ItemInfo.
                                   Where(x => x.ItemInfoId.ToString() == EA_EvaluatorId).
                                   Select(x => x.Value).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();
            }

            EA_UnitId = RelatedEvaluationItem.ItemInfo.
                        Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Unit).
                        Select(x => x.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();
            EA_Unit = RelatedEvaluationItem.ItemInfo.
                      Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Unit).
                      Select(x => (BackOffice.Models.General.enumEvaluationItemUnitType)Convert.ToInt32(x.Value.Replace(" ", ""))).
                      DefaultIfEmpty(BackOffice.Models.General.enumEvaluationItemUnitType.None).
                      FirstOrDefault();

            EA_OrderId = RelatedEvaluationItem.ItemInfo.
                         Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Order).
                         Select(x => x.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();
            EA_Order = RelatedEvaluationItem.ItemInfo.
                       Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Order).
                       Select(x => x.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            EA_ApprovePercentageId = RelatedEvaluationItem.ItemInfo.
                                     Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.ApprovePercentage).
                                     Select(x => x.ItemInfoId.ToString()).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();
            EA_ApprovePercentage = RelatedEvaluationItem.ItemInfo.
                                   Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.ApprovePercentage).
                                   Select(x => x.Value).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            EC_EvaluatorTypeId = RelatedEvaluationItem.ItemInfo.
                                 Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.EvaluatorType).
                                 Select(x => x.ItemInfoId.ToString()).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();
            EC_EvaluatorType = RelatedEvaluationItem.ItemInfo.
                               Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.EvaluatorType).
                               Select(x => (BackOffice.Models.General.enumEvaluatorType)Convert.ToInt32(x.Value.Replace(" ", ""))).
                               DefaultIfEmpty(BackOffice.Models.General.enumEvaluatorType.None).
                               FirstOrDefault();

            EC_EvaluatorId = RelatedEvaluationItem.ItemInfo.
                             Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Evaluator).
                             Select(x => x.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();
            EC_Evaluator = RelatedEvaluationItem.ItemInfo.
                           Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Evaluator).
                           Select(x => x.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            EC_UnitId = RelatedEvaluationItem.ItemInfo.
                        Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Unit).
                        Select(x => x.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();
            EC_Unit = RelatedEvaluationItem.ItemInfo.
                      Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Unit).
                      Select(x => (BackOffice.Models.General.enumEvaluationItemUnitType)Convert.ToInt32(x.Value.Replace(" ", ""))).
                      DefaultIfEmpty(BackOffice.Models.General.enumEvaluationItemUnitType.None).
                      FirstOrDefault();

            EC_RatingId = RelatedEvaluationItem.ItemInfo.
                          Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Rating).
                          Select(x => x.ItemInfoId.ToString()).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();
            EC_Rating = RelatedEvaluationItem.ItemInfo.
                        Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Rating).
                        Select(x => x.Value).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            EC_EvaluationCriteriaId = RelatedEvaluationItem.ItemInfo.
                                      Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.EvaluationCriteria).
                                      Select(x => x.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();
            EC_EvaluationCriteria = RelatedEvaluationItem.ItemInfo.
                                    Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.EvaluationCriteria).
                                    Select(x => (BackOffice.Models.General.enumEvaluationCriteriaType)Convert.ToInt32(x.Value.Replace(" ", ""))).
                                    DefaultIfEmpty(BackOffice.Models.General.enumEvaluationCriteriaType.None).
                                    FirstOrDefault();

            EC_InfoType_Value_OperatorId = RelatedEvaluationItem.ItemInfo.
                                           Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.InfoType_Value_Operator).
                                           Select(x => x.ItemInfoId.ToString()).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();
            EC_InfoType_Value_Operator = RelatedEvaluationItem.ItemInfo.
                                         Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.InfoType_Value_Operator).
                                         Select(x => x.Value).
                                         DefaultIfEmpty(string.Empty).
                                         FirstOrDefault();

            EC_YearsQuantityId = RelatedEvaluationItem.ItemInfo.
                                 Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.YearsQuantity).
                                 Select(x => x.ItemInfoId.ToString()).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();
            EC_YearsQuantity = RelatedEvaluationItem.ItemInfo.
                               Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.YearsQuantity).
                               Select(x => x.Value).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            EC_ExperienceConfigId = RelatedEvaluationItem.ItemInfo.
                                    Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.ExperienceConfig).
                                    Select(x => x.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();
            EC_ExperienceConfig = RelatedEvaluationItem.ItemInfo.
                                  Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.ExperienceConfig).
                                  Select(x => x.LargeValue).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            EC_OrderId = RelatedEvaluationItem.ItemInfo.
                         Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Order).
                         Select(x => x.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();
            EC_Order = RelatedEvaluationItem.ItemInfo.
                       Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Order).
                       Select(x => x.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            EC_ApprovePercentageId = RelatedEvaluationItem.ItemInfo.
                                     Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Order).
                                     Select(x => x.ItemInfoId.ToString()).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();
            EC_ApprovePercentage = RelatedEvaluationItem.ItemInfo.
                                   Where(x => x.ItemInfoType.ItemId == (int)Models.General.enumEvaluationItemInfoType.Order).
                                   Select(x => x.Value).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();
        }
Ejemplo n.º 17
0
 public ProviderFinancialBasicInfoViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedInfo, decimal oExchange)
 {
     RelatedFinancialBasicInfo = oRelatedInfo;
     Exchange = oExchange;
     BI_Year  = oRelatedInfo.ItemName;
 }
        public ProviderFinancialViewModel
            (ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedFinancial,
            List <ProveedoresOnLine.Company.Models.Util.GenericItemModel> oBank)
        {
            RelatedFinancial = oRelatedFinancial;

            FinancialId = RelatedFinancial.ItemId.ToString();

            FinancialName = RelatedFinancial.ItemName;

            Enable = RelatedFinancial.Enable;

            #region Balance sheet

            SH_Year = RelatedFinancial.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.SH_Year).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            SH_YearId = RelatedFinancial.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.SH_Year).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            SH_BalanceSheetFile = RelatedFinancial.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.SH_BalanceSheetFile).
                                  Select(y => y.Value).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            SH_BalanceSheetFileId = RelatedFinancial.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.SH_BalanceSheetFile).
                                    Select(y => y.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            SH_Currency = RelatedFinancial.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.SH_Currency).
                          Select(y => y.Value).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();

            SH_CurrencyId = RelatedFinancial.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.SH_Currency).
                            Select(y => y.ItemInfoId.ToString()).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            #endregion

            #region Taxes

            TX_Year = RelatedFinancial.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.TX_Year).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            TX_YearId = RelatedFinancial.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.TX_Year).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            TX_TaxFile = RelatedFinancial.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.TX_TaxFile).
                         Select(y => y.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            TX_TaxFileId = RelatedFinancial.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.TX_TaxFile).
                           Select(y => y.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            #endregion

            #region Income Statement

            IS_Year = RelatedFinancial.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_Year).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            IS_YearId = RelatedFinancial.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_Year).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            IS_GrossIncome = RelatedFinancial.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_GrossIncome).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            IS_GrossIncomeId = RelatedFinancial.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_GrossIncome).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            IS_NetIncome = RelatedFinancial.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_NetIncome).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            IS_NetIncomeId = RelatedFinancial.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_NetIncome).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            IS_GrossEstate = RelatedFinancial.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_GrossEstate).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            IS_GrossEstateId = RelatedFinancial.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_GrossEstate).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            IS_LiquidHeritage = RelatedFinancial.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_LiquidHeritage).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            IS_LiquidHeritageId = RelatedFinancial.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_LiquidHeritage).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            IS_FileIncomeStatement = RelatedFinancial.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_FileIncomeStatement).
                                     Select(y => y.Value).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            IS_FileIncomeStatementId = RelatedFinancial.ItemInfo.
                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IS_FileIncomeStatement).
                                       Select(y => y.ItemInfoId.ToString()).
                                       DefaultIfEmpty(string.Empty).
                                       FirstOrDefault();

            #endregion

            #region Bank Info

            IB_Bank = RelatedFinancial.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_Bank).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            IB_BankId = RelatedFinancial.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_Bank).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            if (oBank != null && oBank.Count > 0)
            {
                IB_BankName = oBank.
                              Where(y => y.ItemId.ToString() == IB_Bank).
                              Select(y => y.ItemName).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();
            }

            IB_AccountType = RelatedFinancial.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountType).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            IB_AccountTypeId = RelatedFinancial.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountType).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            IB_AccountNumber = RelatedFinancial.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountNumber).
                               Select(y => y.Value).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            IB_AccountNumberId = RelatedFinancial.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountNumber).
                                 Select(y => y.ItemInfoId.ToString()).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            IB_AccountHolder = RelatedFinancial.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountHolder).
                               Select(y => y.Value).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            IB_AccountHolderId = RelatedFinancial.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountHolder).
                                 Select(y => y.ItemInfoId.ToString()).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            IB_ABA = RelatedFinancial.ItemInfo.
                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_ABA).
                     Select(y => y.Value).
                     DefaultIfEmpty(string.Empty).
                     FirstOrDefault();

            IB_ABAId = RelatedFinancial.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_ABA).
                       Select(y => y.ItemInfoId.ToString()).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            IB_Swift = RelatedFinancial.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_Swift).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            IB_SwiftId = RelatedFinancial.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_Swift).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            IB_IBAN = RelatedFinancial.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_IBAN).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            IB_IBANId = RelatedFinancial.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_IBAN).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            IB_Customer = RelatedFinancial.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_Customer).
                          Select(y => y.Value).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();

            IB_CustomerId = RelatedFinancial.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_Customer).
                            Select(y => y.ItemInfoId.ToString()).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            IB_AccountFile = RelatedFinancial.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountFile).
                             Select(y => y.Value).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            IB_AccountFileId = RelatedFinancial.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumFinancialInfoType.IB_AccountFile).
                               Select(y => y.ItemInfoId.ToString()).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            #endregion
        }
Ejemplo n.º 19
0
        public ProviderCommercialViewModel
            (ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedCommercial)
        {
            RelatedCommercial = oRelatedCommercial;

            CommercialId = RelatedCommercial.ItemId.ToString();

            CommercialName = RelatedCommercial.ItemName;

            Enable = RelatedCommercial.Enable;

            #region Experience

            EX_ContractType = RelatedCommercial.ItemInfo.
                              Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractType).
                              Select(y => y.Value).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();

            EX_ContractTypeId = RelatedCommercial.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractType).
                                Select(y => y.ItemInfoId.ToString()).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            EX_Currency = RelatedCommercial.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_Currency).
                          Select(y => y.Value).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();

            EX_CurrencyId = RelatedCommercial.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_Currency).
                            Select(y => y.ItemInfoId.ToString()).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            EX_DateIssue = RelatedCommercial.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_DateIssue).
                           Select(y => y.Value).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            EX_DateIssueId = RelatedCommercial.ItemInfo.
                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_DateIssue).
                             Select(y => y.ItemInfoId.ToString()).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();

            EX_DueDate = RelatedCommercial.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_DueDate).
                         Select(y => y.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            EX_DueDateId = RelatedCommercial.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_DueDate).
                           Select(y => y.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            EX_Client = RelatedCommercial.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_Client).
                        Select(y => y.Value).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            EX_ClientId = RelatedCommercial.ItemInfo.
                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_Client).
                          Select(y => y.ItemInfoId.ToString()).
                          DefaultIfEmpty(string.Empty).
                          FirstOrDefault();

            EX_ContractNumber = RelatedCommercial.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractNumber).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            EX_ContractNumberId = RelatedCommercial.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractNumber).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            EX_ContractValue = RelatedCommercial.ItemInfo.
                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractValue).
                               Select(y => y.Value).
                               DefaultIfEmpty(string.Empty).
                               FirstOrDefault();

            EX_ContractValueId = RelatedCommercial.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractValue).
                                 Select(y => y.ItemInfoId.ToString()).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            EX_Phone = RelatedCommercial.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_Phone).
                       Select(y => y.Value).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();

            EX_PhoneId = RelatedCommercial.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_Phone).
                         Select(y => y.ItemInfoId.ToString()).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();

            EX_ExperienceFile = RelatedCommercial.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ExperienceFile).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();

            EX_ExperienceFileId = RelatedCommercial.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ExperienceFile).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            EX_ContractSubject = RelatedCommercial.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractSubject).
                                 Select(y => y.LargeValue).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();

            EX_ContractSubjectId = RelatedCommercial.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_ContractSubject).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            EX_EconomicActivity = RelatedCommercial.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_EconomicActivity).
                                  Select(y => y.ValueName).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault().
                                  Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).
                                  Where(y => y.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Length >= 2).
                                  Select(y => new BackOffice.Models.General.EconomicActivityViewModel()
            {
                EconomicActivityId = y.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0],
                ActivityName       = y.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[1],
            }).ToList();

            EX_EconomicActivityId = RelatedCommercial.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_EconomicActivity).
                                    Select(y => y.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            EX_CustomEconomicActivity = RelatedCommercial.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_CustomEconomicActivity).
                                        Select(y => y.ValueName).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault().
                                        Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).
                                        Where(y => y.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Length >= 2).
                                        Select(y => new BackOffice.Models.General.EconomicActivityViewModel()
            {
                EconomicActivityId = y.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0],
                ActivityName       = y.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[1],
            }).ToList();

            EX_CustomEconomicActivityId = RelatedCommercial.ItemInfo.
                                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumCommercialInfoType.EX_CustomEconomicActivity).
                                          Select(y => y.ItemInfoId.ToString()).
                                          DefaultIfEmpty(string.Empty).
                                          FirstOrDefault();

            #endregion
        }
Ejemplo n.º 20
0
 public EvaluationItemViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedEvaluationItem)
 {
     RelatedEvaluationItem = oRelatedEvaluationItem;
 }
        public ProviderHSEQViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedCertification,
                                     List <ProveedoresOnLine.Company.Models.Util.GenericItemModel> oRule,
                                     List <ProveedoresOnLine.Company.Models.Util.GenericItemModel> oCompanyRule,
                                     List <ProveedoresOnLine.Company.Models.Util.GenericItemModel> oARL)
        {
            RelatedCertification = oRelatedCertification;
            CertificationId      = RelatedCertification.ItemId.ToString();
            CertificationName    = RelatedCertification.ItemName;
            Enable = RelatedCertification.Enable;

            #region Certifications

            C_CertificationCompany = RelatedCertification.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_CertificationCompany).
                                     Select(y => y.Value).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();
            C_CertificationCompanyId = RelatedCertification.ItemInfo.
                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_CertificationCompany).
                                       Select(y => y.ItemInfoId.ToString()).
                                       DefaultIfEmpty(string.Empty).
                                       FirstOrDefault();
            if (oCompanyRule != null && oCompanyRule.Count > 0)
            {
                C_CertificationCompanyName = oCompanyRule.
                                             Where(x => x.ItemId.ToString() == C_CertificationCompany).
                                             Select(x => x.ItemName).
                                             DefaultIfEmpty(string.Empty).
                                             FirstOrDefault();
            }

            C_Rule = RelatedCertification.ItemInfo.
                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_Rule).
                     Select(y => y.Value).
                     DefaultIfEmpty(string.Empty).
                     FirstOrDefault();
            C_RuleId = RelatedCertification.ItemInfo.
                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_Rule).
                       Select(y => y.ItemInfoId.ToString()).
                       DefaultIfEmpty(string.Empty).
                       FirstOrDefault();
            if (oRule != null && oRule.Count > 0)
            {
                C_RuleName = oRule.
                             Where(x => x.ItemId.ToString() == C_Rule).
                             Select(x => x.ItemName).
                             DefaultIfEmpty(string.Empty).
                             FirstOrDefault();
            }

            C_StartDateCertification = RelatedCertification.ItemInfo.
                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_StartDateCertification).
                                       Select(y => y.Value).
                                       DefaultIfEmpty(string.Empty).
                                       FirstOrDefault();
            C_StartDateCertificationId = RelatedCertification.ItemInfo.
                                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_StartDateCertification).
                                         Select(y => y.ItemInfoId.ToString()).
                                         DefaultIfEmpty(string.Empty).
                                         FirstOrDefault();

            C_EndDateCertification = RelatedCertification.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_EndDateCertification).
                                     Select(y => y.Value).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();
            C_EndDateCertificationId = RelatedCertification.ItemInfo.
                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_EndDateCertification).
                                       Select(y => y.ItemInfoId.ToString()).
                                       DefaultIfEmpty(string.Empty).
                                       FirstOrDefault();

            C_CCS = RelatedCertification.ItemInfo.
                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_CCS).
                    Select(y => y.Value).
                    DefaultIfEmpty(string.Empty).
                    FirstOrDefault();
            C_CCSId = RelatedCertification.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_CCS).
                      Select(y => y.ItemInfoId.ToString()).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();

            C_CertificationFile = RelatedCertification.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_CertificationFile).
                                  Select(y => y.Value).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();
            C_CertificationFileId = RelatedCertification.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_CertificationFile).
                                    Select(y => y.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            C_Scope = RelatedCertification.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_Scope).
                      Select(y => y.LargeValue).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();
            C_ScopeId = RelatedCertification.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.C_Scope).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            #endregion

            #region HealtyPolitics

            CH_Year = RelatedCertification.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_Year).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();
            CH_YearId = RelatedCertification.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_Year).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            CH_PoliticsSecurity = RelatedCertification.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticsSecurity).
                                  Select(y => y.Value).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();
            CH_PoliticsSecurityId = RelatedCertification.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticsSecurity).
                                    Select(y => y.ItemInfoId.ToString()).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();

            CH_PoliticIntegral = RelatedCertification.ItemInfo.
                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticIntegral).
                                 Select(y => y.Value).
                                 DefaultIfEmpty(string.Empty).
                                 FirstOrDefault();
            CH_PoliticIntegralId = RelatedCertification.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticIntegral).
                                   Select(y => y.ItemInfoId.ToString()).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();

            CH_PoliticsNoAlcohol = RelatedCertification.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticsNoAlcohol).
                                   Select(y => y.Value).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();
            CH_PoliticsNoAlcoholId = RelatedCertification.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticsNoAlcohol).
                                     Select(y => y.ItemInfoId.ToString()).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            CH_ProgramOccupationalHealth = RelatedCertification.ItemInfo.
                                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_ProgramOccupationalHealth).
                                           Select(y => y.Value).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();
            CH_ProgramOccupationalHealthId = RelatedCertification.ItemInfo.
                                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_ProgramOccupationalHealth).
                                             Select(y => y.ItemInfoId.ToString()).
                                             DefaultIfEmpty(string.Empty).
                                             FirstOrDefault();

            CH_RuleIndustrialSecurity = RelatedCertification.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_RuleIndustrialSecurity).
                                        Select(y => y.Value).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault();
            CH_RuleIndustrialSecurityId = RelatedCertification.ItemInfo.
                                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_RuleIndustrialSecurity).
                                          Select(y => y.ItemInfoId.ToString()).
                                          DefaultIfEmpty(string.Empty).
                                          FirstOrDefault();

            CH_MatrixRiskControl = RelatedCertification.ItemInfo.
                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_MatrixRiskControl).
                                   Select(y => y.Value).
                                   DefaultIfEmpty(string.Empty).
                                   FirstOrDefault();
            CH_MatrixRiskControlId = RelatedCertification.ItemInfo.
                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_MatrixRiskControl).
                                     Select(y => y.ItemInfoId.ToString()).
                                     DefaultIfEmpty(string.Empty).
                                     FirstOrDefault();

            CH_CorporateSocialResponsability = RelatedCertification.ItemInfo.
                                               Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_CorporateSocialResponsability).
                                               Select(y => y.Value).
                                               DefaultIfEmpty(string.Empty).
                                               FirstOrDefault();
            CH_CorporateSocialResponsabilityId = RelatedCertification.ItemInfo.
                                                 Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_CorporateSocialResponsability).
                                                 Select(y => y.ItemInfoId.ToString()).
                                                 DefaultIfEmpty(string.Empty).
                                                 FirstOrDefault();

            CH_ProgramEnterpriseSecurity = RelatedCertification.ItemInfo.
                                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_ProgramEnterpriseSecurity).
                                           Select(y => y.Value).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();
            CH_ProgramEnterpriseSecurityId = RelatedCertification.ItemInfo.
                                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_ProgramEnterpriseSecurity).
                                             Select(y => y.ItemInfoId.ToString()).
                                             DefaultIfEmpty(string.Empty).
                                             FirstOrDefault();

            CH_PoliticsRecruiment = RelatedCertification.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticsRecruiment).
                                    Select(y => y.Value).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();
            CH_PoliticsRecruimentId = RelatedCertification.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_PoliticsRecruiment).
                                      Select(y => y.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            CH_CertificationsForm = RelatedCertification.ItemInfo.
                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_CertificationsForm).
                                    Select(y => y.Value).
                                    DefaultIfEmpty(string.Empty).
                                    FirstOrDefault();
            CH_CertificationsFormId = RelatedCertification.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CH_CertificationsForm).
                                      Select(y => y.ItemInfoId.ToString()).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            #endregion

            #region RiskPolicies

            CR_SystemOccupationalHazards = RelatedCertification.ItemInfo.
                                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CR_SystemOccupationalHazards).
                                           Select(y => y.Value).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();
            CR_SystemOccupationalHazardsId = RelatedCertification.ItemInfo.
                                             Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CR_SystemOccupationalHazards).
                                             Select(y => y.ItemInfoId.ToString()).
                                             DefaultIfEmpty(string.Empty).
                                             FirstOrDefault();
            if (oARL != null && oARL.Count > 0)
            {
                CR_SystemOccupationalHazardsName = oARL.
                                                   Where(x => x.ItemId.ToString() == CR_SystemOccupationalHazards).
                                                   Select(x => x.ItemName).
                                                   DefaultIfEmpty(string.Empty).
                                                   FirstOrDefault();
            }

            CR_RateARL = RelatedCertification.ItemInfo.
                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CR_RateARL).
                         Select(y => y.Value).
                         DefaultIfEmpty(string.Empty).
                         FirstOrDefault();
            CR_RateARLId = RelatedCertification.ItemInfo.
                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CR_RateARL).
                           Select(y => y.ItemInfoId.ToString()).
                           DefaultIfEmpty(string.Empty).
                           FirstOrDefault();

            CR_CertificateAffiliateARL = RelatedCertification.ItemInfo.
                                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CR_CertificateAffiliateARL).
                                         Select(y => y.Value).
                                         DefaultIfEmpty(string.Empty).
                                         FirstOrDefault();
            CR_CertificateAffiliateARLId = RelatedCertification.ItemInfo.
                                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CR_CertificateAffiliateARL).
                                           Select(y => y.ItemInfoId.ToString()).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();

            CR_LTIFResult = RelatedCertification.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CR_LTIFResult).
                            Select(y => y.Value).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();

            #endregion

            #region CertificatesAcccident

            CA_Year = RelatedCertification.ItemInfo.
                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_Year).
                      Select(y => y.Value).
                      DefaultIfEmpty(string.Empty).
                      FirstOrDefault();
            CA_YearId = RelatedCertification.ItemInfo.
                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_Year).
                        Select(y => y.ItemInfoId.ToString()).
                        DefaultIfEmpty(string.Empty).
                        FirstOrDefault();

            CA_ManHoursWorked = RelatedCertification.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_ManHoursWorked).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();
            CA_ManHoursWorkedId = RelatedCertification.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_ManHoursWorked).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            CA_Fatalities = RelatedCertification.ItemInfo.
                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_Fatalities).
                            Select(y => y.Value).
                            DefaultIfEmpty(string.Empty).
                            FirstOrDefault();
            CA_FatalitiesId = RelatedCertification.ItemInfo.
                              Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_Fatalities).
                              Select(y => y.ItemInfoId.ToString()).
                              DefaultIfEmpty(string.Empty).
                              FirstOrDefault();

            CA_NumberAccident = RelatedCertification.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_NumberAccident).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();
            CA_NumberAccidentId = RelatedCertification.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_NumberAccident).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            CA_NumberAccidentDisabling = RelatedCertification.ItemInfo.
                                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_NumberAccidentDisabling).
                                         Select(y => y.Value).
                                         DefaultIfEmpty(string.Empty).
                                         FirstOrDefault();
            CA_NumberAccidentDisablingId = RelatedCertification.ItemInfo.
                                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_NumberAccidentDisabling).
                                           Select(y => y.ItemInfoId.ToString()).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();

            CA_DaysIncapacity = RelatedCertification.ItemInfo.
                                Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_DaysIncapacity).
                                Select(y => y.Value).
                                DefaultIfEmpty(string.Empty).
                                FirstOrDefault();
            CA_DaysIncapacityId = RelatedCertification.ItemInfo.
                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_DaysIncapacity).
                                  Select(y => y.ItemInfoId.ToString()).
                                  DefaultIfEmpty(string.Empty).
                                  FirstOrDefault();

            CA_CertificateAccidentARL = RelatedCertification.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_CertificateAccidentARL).
                                        Select(y => y.Value).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault();
            CA_CertificateAccidentARLId = RelatedCertification.ItemInfo.
                                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumHSEQInfoType.CA_CertificateAccidentARL).
                                          Select(y => y.ItemInfoId.ToString()).
                                          DefaultIfEmpty(string.Empty).
                                          FirstOrDefault();
            #endregion
        }
Ejemplo n.º 22
0
        public SurveyConfigItemViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel oRelatedConfigItem)
        {
            RelatedConfigItem = oRelatedConfigItem;

            //generic values
            SurveyConfigItemId     = RelatedConfigItem.ItemId.ToString();
            SurveyConfigItemName   = RelatedConfigItem.ItemName;
            SurveyConfigItemTypeId = RelatedConfigItem.ItemType.ItemId.ToString();
            ParentSurveyConfigItem = RelatedConfigItem.ParentItem == null ? null : RelatedConfigItem.ParentItem.ItemId.ToString();
            SurveyConfigItemEnable = RelatedConfigItem.Enable;
            //generic infos
            SurveyConfigItemInfoOrder = RelatedConfigItem.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.Order).
                                        Select(y => y.Value).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault();

            SurveyConfigItemInfoOrderId = RelatedConfigItem.ItemInfo.
                                          Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.Order).
                                          Select(y => y.ItemInfoId.ToString()).
                                          DefaultIfEmpty(string.Empty).
                                          FirstOrDefault();

            SurveyConfigItemInfoWeight = RelatedConfigItem.ItemInfo.
                                         Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.Weight).
                                         Select(y => y.Value).
                                         DefaultIfEmpty(string.Empty).
                                         FirstOrDefault();

            SurveyConfigItemInfoWeightId = RelatedConfigItem.ItemInfo.
                                           Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.Weight).
                                           Select(y => y.ItemInfoId.ToString()).
                                           DefaultIfEmpty(string.Empty).
                                           FirstOrDefault();

            SurveyConfigItemInfoRol = RelatedConfigItem.ItemInfo.
                                      Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.RolId).
                                      Select(y => y.Value).
                                      DefaultIfEmpty(string.Empty).
                                      FirstOrDefault();

            SurveyConfigItemInfoRolId = RelatedConfigItem.ItemInfo.
                                        Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.RolId).
                                        Select(y => y.ItemInfoId.ToString()).
                                        DefaultIfEmpty(string.Empty).
                                        FirstOrDefault();

            SurveyConfigItemInfoRolWeight = RelatedConfigItem.ItemInfo.
                                            Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.RolWeight).
                                            Select(y => y.Value).
                                            DefaultIfEmpty(string.Empty).
                                            FirstOrDefault();

            SurveyConfigItemInfoRolWeightId = RelatedConfigItem.ItemInfo.
                                              Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.RolWeight).
                                              Select(y => y.ItemInfoId.ToString()).
                                              DefaultIfEmpty(string.Empty).
                                              FirstOrDefault();

            SurveyConfigItemInfoAreaHasDescription = RelatedConfigItem.ItemInfo.
                                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.AreaHasDescription).
                                                     Select(y => y.Value).
                                                     DefaultIfEmpty(string.Empty).
                                                     FirstOrDefault();

            SurveyConfigItemInfoAreaHasDescriptionId = RelatedConfigItem.ItemInfo.
                                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.AreaHasDescription).
                                                       Select(y => y.ItemInfoId.ToString()).
                                                       DefaultIfEmpty(string.Empty).
                                                       FirstOrDefault();

            if (RelatedConfigItem.ItemType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemType.Question)
            {
                #region Question

                SurveyConfigItemInfoHasDescription = RelatedConfigItem.ItemInfo.
                                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.HasDescription).
                                                     Select(y => y.Value.ToLower() == "true").
                                                     DefaultIfEmpty(false).
                                                     FirstOrDefault();

                SurveyConfigItemInfoHasDescriptionId = RelatedConfigItem.ItemInfo.
                                                       Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.HasDescription).
                                                       Select(y => y.ItemInfoId.ToString()).
                                                       DefaultIfEmpty(string.Empty).
                                                       FirstOrDefault();

                SurveyConfigItemInfoIsMandatory = RelatedConfigItem.ItemInfo.
                                                  Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.IsMandatory).
                                                  Select(y => y.Value.ToLower() == "true").
                                                  DefaultIfEmpty(false).
                                                  FirstOrDefault();

                SurveyConfigItemInfoIsMandatoryId = RelatedConfigItem.ItemInfo.
                                                    Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.IsMandatory).
                                                    Select(y => y.ItemInfoId.ToString()).
                                                    DefaultIfEmpty(string.Empty).
                                                    FirstOrDefault();

                SurveyConfigItemInfoQuestionTypeId = RelatedConfigItem.ItemInfo.
                                                     Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.QuestionType).
                                                     Select(y => y.ItemInfoId.ToString()).
                                                     DefaultIfEmpty(string.Empty).
                                                     FirstOrDefault();

                SurveyConfigItemInfoQuestionType = RelatedConfigItem.ItemInfo.
                                                   Where(y => y.ItemInfoType.ItemId == (int)BackOffice.Models.General.enumSurveyConfigItemInfoType.QuestionType).
                                                   Select(y => y.Value.ToString()).
                                                   DefaultIfEmpty(string.Empty).
                                                   FirstOrDefault();

                #endregion
            }
        }
 public ProviderHSEQViewModel(ProveedoresOnLine.Company.Models.Util.GenericItemModel RelatedCertification)
 {
     RelatedHSEQInfo = RelatedCertification;
 }