Beispiel #1
0
        /// <summary>
        /// 업체 수정
        /// </summary>
        /// <param name="carCategoryCode"></param>
        /// <param name="codeName"></param>
        /// <returns></returns>
        public int updateCompany(CompanyInfo company)
        {
            log.Debug("=================START updateCompany=================");
            log.Debug("company = " + company.ToString());

            StringBuilder sql_update = new StringBuilder();

            sql_update.Append("UPDATE Company SET");
            sql_update.Append(" companyName=N'" + company.CompanyName + "',");
            sql_update.Append("regNumber1='" + company.RegNumber1 + "',");
            sql_update.Append("regNumber2='" + company.RegNumber2 + "',");
            sql_update.Append("regNumber3='" + company.RegNumber3 + "',");
            sql_update.Append("phone1='" + company.Phone1 + "',");
            sql_update.Append("phone2='" + company.Phone2 + "',");
            sql_update.Append("phone3='" + company.Phone3 + "',");
            sql_update.Append("masterName=N'" + company.MasterName + "',");
            sql_update.Append("approve=N'" + company.Approve + "',");
            sql_update.Append("address=N'" + company.Address + "',");
            sql_update.Append("companyManagementNo=N'" + company.CompanyManagementNo + "',");
            sql_update.Append("companyStartNo=N'" + company.CompanyStartNo + "'");
            sql_update.Append("WHERE	companyCode="+ company.CompanyCode);

            int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_update.ToString(), null);

            log.Debug(@"=================END updateCompany=================");

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 업체 저장
        /// </summary>
        /// <param name="codeName"></param>
        /// <returns></returns>
        public int insertCompany(CompanyInfo company)
        {
            log.Debug("=================START insertCompany=================");
            log.Debug("company = " + company.ToString());

            StringBuilder sql_insert = new StringBuilder();

            sql_insert.Append("INSERT INTO Company");
            sql_insert.Append("(companyName,regNumber1,regNumber2,regNumber3,phone1,phone2,phone3,masterName,address,regDate,approve,employeeCode,companyManagementNo,companyStartNo)");
            sql_insert.Append("VALUES");
            sql_insert.Append("(N'" + company.CompanyName + "','" + company.RegNumber1 + "','" + company.RegNumber2 + "','" + company.RegNumber3 + "',");
            sql_insert.Append("'" + company.Phone1 + "','" + company.Phone2 + "','" + company.Phone3 + "',N'" + company.MasterName + "',N'" + company.Address + "',");
            sql_insert.Append("GETDATE()," + company.Approve + ",'" + company.EmployeeCode + "',N'" + company.CompanyManagementNo + "',N'" + company.CompanyStartNo + "')");

            int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, sql_insert.ToString(), null);

            log.Debug(@"=================END insertCompany=================");

            return(result);
        }
        public override async Task <bool> UpdateFromOnlineMusicTrackAlbumCompanyAsync(AlbumInfo album, CompanyInfo company, string language, bool cacheOnly)
        {
            try
            {
                AudioDbAlbum albumDetail = null;
                language = language ?? PreferredLanguage;

                if (album.AudioDbId > 0)
                {
                    albumDetail = await _audioDbHandler.GetAlbumAsync(album.AudioDbId, language, cacheOnly).ConfigureAwait(false);
                }
                if (albumDetail == null && !string.IsNullOrEmpty(album.MusicBrainzId))
                {
                    List <AudioDbAlbum> foundAlbums = await _audioDbHandler.GetAlbumByMbidAsync(album.MusicBrainzId, language, cacheOnly).ConfigureAwait(false);

                    if (foundAlbums != null && foundAlbums.Count == 1)
                    {
                        //Get the album into the cache
                        albumDetail = await _audioDbHandler.GetAlbumAsync(foundAlbums[0].AlbumId, language, cacheOnly).ConfigureAwait(false);
                    }
                }
                if (albumDetail == null)
                {
                    return(false);
                }

                if (!string.IsNullOrEmpty(albumDetail.Label) && company.MatchNames(company.Name, albumDetail.Label) && albumDetail.LabelId.HasValue)
                {
                    company.AudioDbId = albumDetail.LabelId.Value;
                    company.Name      = albumDetail.Label;
                    company.Type      = CompanyAspect.COMPANY_MUSIC_LABEL;
                    return(true);
                }

                return(false);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Debug("TheAudioDbWrapper: Exception while processing company {0}", ex, company.ToString());
                return(false);
            }
        }
        public override async Task <bool> UpdateFromOnlineMusicTrackAlbumCompanyAsync(AlbumInfo album, CompanyInfo company, string language, bool cacheOnly)
        {
            try
            {
                TrackLabel labelDetail = null;
                if (!string.IsNullOrEmpty(company.MusicBrainzId))
                {
                    labelDetail = await _musicBrainzHandler.GetLabelAsync(company.MusicBrainzId, cacheOnly).ConfigureAwait(false);
                }
                if (labelDetail == null)
                {
                    return(false);
                }
                if (labelDetail.Label == null)
                {
                    return(false);
                }

                company.MusicBrainzId = labelDetail.Label.Id;
                company.Name          = labelDetail.Label.Name;
                company.Type          = CompanyAspect.COMPANY_MUSIC_LABEL;

                return(true);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Debug("MusicBrainzWrapper: Exception while processing company {0}", ex, company.ToString());
                return(false);
            }
        }
Beispiel #5
0
        public override async Task <bool> UpdateFromOnlineSeriesCompanyAsync(SeriesInfo seriesInfo, CompanyInfo company, TvdbLanguage language, bool cacheOnly)
        {
            try
            {
                if (company.Type != CompanyAspect.COMPANY_TV_NETWORK)
                {
                    return(false);
                }

                language = language ?? PreferredLanguage;

                TvdbSeries seriesDetail = null;
                if (seriesInfo.TvdbId > 0)
                {
                    seriesDetail = await _tvdbHandler.GetSeriesAsync(seriesInfo.TvdbId, language, true, false, false).ConfigureAwait(false);
                }
                if (seriesDetail == null && !cacheOnly && !string.IsNullOrEmpty(seriesInfo.ImdbId))
                {
                    TvdbSearchResult foundSeries = await _tvdbHandler.GetSeriesByRemoteIdAsync(ExternalId.ImdbId, seriesInfo.ImdbId).ConfigureAwait(false);

                    if (foundSeries != null)
                    {
                        seriesDetail = await _tvdbHandler.GetSeriesAsync(foundSeries.Id, language, true, false, false).ConfigureAwait(false);
                    }
                }
                if (seriesDetail == null)
                {
                    return(false);
                }

                List <CompanyInfo> companies = ConvertToCompanies(seriesDetail.NetworkID, seriesDetail.Network, CompanyAspect.COMPANY_TV_NETWORK);
                int index = companies.IndexOf(company);
                if (index >= 0)
                {
                    company.TvdbId = companies[index].TvdbId;
                    company.Name   = companies[index].Name;
                    company.Type   = companies[index].Type;
                    company.Order  = companies[index].Order;

                    return(true);
                }

                return(false);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Debug("TvDbWrapper: Exception while processing company {0}", ex, company.ToString());
                return(false);
            }
        }