示例#1
0
        private void GetSettings(SpCompanyDetailReturnModel company)
        {
            var result = (from s in this.SettingsText
                          join c in this.Company on s.OwnerID equals c.tenantID
                          where c.companyID == company.companyID &&
                          s.OwnerType == Common.TenantOwnerType &&
                          (s.key == Common.FlatTenantKey || s.key == Common.UserManagementEmailMandatory)
                          select(s)).ToList();

            if (result != null && result.Count() > 0)
            {
                company.isFlatTenant = result.Where(x => x.key == Common.FlatTenantKey).Select(y => y.value).FirstOrDefault().ToUpper() == Common.Truthy;
                company.IsUserManagementEmailAddressMandatory = result.Where(x => x.key == Common.UserManagementEmailMandatory).Select(y => y.value).FirstOrDefault().ToUpper() == Common.Truthy;
            }
        }
示例#2
0
 public static Company ToCompanyViewModel(this SpCompanyDetailReturnModel rawCompanyDetails)
 {
     try
     {
         var company = rawCompanyDetails;
         return
             (new Company()
         {
             Id = Toolbox.GetValue <int>(company.companyID),
             Name = Toolbox.GetValue <string>(company.companyName),
             Description = Toolbox.GetValue <string>(company.contactName),
             Code = Toolbox.GetValue <string>(company.code),
             CompanyAddress = Toolbox.GetValue <string>(company.address),
             ContactName = Toolbox.GetValue <string>(company.contactName),
             ContactAddress = Toolbox.GetValue <string>(company.contactAddress),
             ContactPhone = Toolbox.GetValue <string>(company.contactPhone),
             Email = Toolbox.GetValue <string>(company.email),
             Suburb = Toolbox.GetValue <string>(company.suburb),
             CompanyStateId = Toolbox.GetValue <int>(company.state),
             DateIn = Toolbox.GetValue <DateTime>(company.dateIn),
             FaxNumber = Toolbox.GetValue <string>(company.faxNumber),
             IsActive = Toolbox.GetValue <bool>(company.isActive),
             Theme = Toolbox.GetValue <string>(company.Theme),
             SupportEmail = Toolbox.GetValue <string>(company.supportEmail),
             UserMonths = Toolbox.GetValue <int>(company.defaultUserMonths),
             NoTrainer = Toolbox.GetValue <bool>(company.noTrainer),
             TenantId = Toolbox.GetValue <int>(company.tenantID),
             SubDomain = Toolbox.GetValue <string>(company.Domain),
             TenantName = Toolbox.GetValue <string>(company.TenantName),
             isFlatTenant = Toolbox.GetValue <bool>(company.isFlatTenant),
             IsUserManagementEmailAddressMandatory = Toolbox.GetValue <bool>(company.IsUserManagementEmailAddressMandatory),
             CompanyDescription = CompanyDetailsSpAttribute.CompanyDescriptionDefaultValue,
             RegionDescr = CompanyDetailsSpAttribute.RegionDescrDefaultValue,
             LocationDescr = CompanyDetailsSpAttribute.LocationDescrDefaultValue,
             AreaDescr = CompanyDetailsSpAttribute.AreaDescrDefaultValue
         });
     }
     catch
     {
         throw new HttpResponseException(HttpStatusCode.NotFound);
     }
 }
示例#3
0
        public virtual SpCompanyDetailReturnModel GetCompanyDetails(int companyId)
        {
            SqlParameter companyIdParam =
                new SqlParameter
            {
                ParameterName = CompanyDetailsSpAttribute.CompanyId,
                SqlDbType     = SqlDbType.Int,
                Direction     = ParameterDirection.Input,
                Value         = companyId
            };

            SpCompanyDetailReturnModel procResultData =
                Database
                .SqlQuery <SpCompanyDetailReturnModel>(CompanyDetailsSpAttribute.SqlQuery, companyIdParam)
                .FirstOrDefault();

            GetSettings(procResultData);

            List <SpCustomUserFieldReturnModel> CustomUserFields = GetCustomUserFields(companyId);

            return(procResultData);
        }