protected string ConstructorImgUrlManu(CY.CSTS.Core.Business.ManufacturerRepository manu) { string url = string.Empty; try { IEnumerable<CY.CSTS.Core.Business.Annex> annexes = manu.GetAnnexs(CY.Utility.Common.AnnexUtility.ImgAnnexType); if (annexes != null && annexes.Count() > 0) { url = annexes.First().AnnexURI; } return url; } catch (Exception ex) { throw ex; } }
protected string ConstructorImgUrl(CY.CSTS.Core.Business.view_INSTRUMENT inst) { string url = string.Empty; try { IEnumerable<CY.CSTS.Core.Business.Annex> annexes = inst.GetAnnexs(CY.Utility.Common.AnnexUtility.ImgAnnexType); if (annexes != null && annexes.Count() > 0) { url = annexes.First().AnnexURI; } return url; } catch (Exception ex) { throw ex; } }
/********************************中间***********************************/ /// <summary> /// 视频信息绑定 /// </summary> /// <param name="instrument"></param> protected void VideosDataBind(CY.CSTS.Core.Business.view_INSTRUMENT instrument) { try { if (instrument != null) { IEnumerable<CY.CSTS.Core.Business.Annex> videos = instrument.GetAnnexs(CY.Utility.Common.AnnexUtility.VideoAnneType); if (videos != null) { rpVideo.DataSource = videos; rpVideo.DataBind(); } } } catch (Exception ex) { throw ex; } }
protected void InitialCarolImg(ref CY.CSTS.Core.Business.view_INSTRUMENT instrument, ref IEnumerable<CY.CSTS.Core.Business.Annex> imgs, ref int count) { try { if (instrument != null) { imgs = instrument.GetAnnexs(CY.Utility.Common.AnnexUtility.ImgAnnexType); if (imgs != null) { count = imgs.Count(); } } } catch (Exception ex) { throw ex; } }
protected string ConstructorUrl(CY.CSTS.Core.Business.view_INSTRUMENT instrument) { StringBuilder sbResult = new StringBuilder(); string defaultPath = CY.Utility.Common.CodeInterface.DefaultImg.InstrumentDefaultImg.Dir + CY.Utility.Common.CodeInterface.DefaultImg.InstrumentDefaultImg.Name + CY.Utility.Common.CodeInterface.DefaultImg.InstrumentDefaultImg.Extention; string physicalRootPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath; try { sbResult.Append("["); if (instrument != null) { CY.CSTS.Core.Business.AnnexType type = CY.CSTS.Core.Business.AnnexType.SelectAnnexTypeByTypeName( CY.Utility.Common.AnnexUtility.ImgAnnexType ); if (type == null) { type = new CY.CSTS.Core.Business.AnnexType() { TypeName = CY.Utility.Common.AnnexUtility.ImgAnnexType }; type.Save(); } IEnumerable<CY.CSTS.Core.Business.Annex> imgs = instrument.GetAnnexs(CY.Utility.Common.AnnexUtility.ImgAnnexType); if (imgs != null && imgs.Count() > 0) { string smallPath = string.Empty; string middlePath = string.Empty; string bigPath = string.Empty; string virtualPath = string.Empty; defaultPath = imgs.First().AnnexURI; foreach (CY.CSTS.Core.Business.Annex i in imgs) { sbResult.Append("{"); virtualPath = CY.Utility.Common.SiteUtility.CurHttpContext.Server.MapPath(i.AnnexURI); if (!string.IsNullOrEmpty(CY.Utility.Common.FileUtility.GetFileExtension(i.AnnexURI))) smallPath = CY.Utility.Common.FileUtility.GetFileDirPath(virtualPath) + CY.Utility.Common.FileUtility.GetFileName(virtualPath) + CY.Utility.Common.CodeInterface.ImgInfo.SmallImg + CY.Utility.Common.FileUtility.GetFileExtension(virtualPath); middlePath = CY.Utility.Common.FileUtility.GetFileDirPath(virtualPath) + CY.Utility.Common.FileUtility.GetFileName(virtualPath) + CY.Utility.Common.CodeInterface.ImgInfo.MiddleImg + CY.Utility.Common.FileUtility.GetFileExtension(virtualPath); bigPath = CY.Utility.Common.FileUtility.GetFileDirPath(virtualPath) + CY.Utility.Common.FileUtility.GetFileName(virtualPath) + CY.Utility.Common.CodeInterface.ImgInfo.BigImg + CY.Utility.Common.FileUtility.GetFileExtension(virtualPath); if (string.IsNullOrEmpty(CY.Utility.Common.FileUtility.GetFileExtension(i.AnnexURI))) { smallPath = "/Content/Default/InstrumentDefault.jpg"; } if (string.IsNullOrEmpty(CY.Utility.Common.FileUtility.GetFileExtension(i.AnnexURI))) { middlePath = "/Content/Default/InstrumentDefault.jpg"; } if (string.IsNullOrEmpty(CY.Utility.Common.FileUtility.GetFileExtension(i.AnnexURI))) { bigPath = "/Content/Default/InstrumentDefault.jpg"; } if (!string.IsNullOrEmpty(CY.Utility.Common.FileUtility.GetFileExtension(i.AnnexURI))) { sbResult.Append(string.Format("small:'{0}'", CY.Utility.Common.StringUtility.EscapeString( File.Exists(smallPath) ? CY.Utility.Common.FileUtility.GetHttpDirPath(@i.AnnexURI.Replace("\\", "/")) + @i.Name + "_small" + CY.Utility.Common.FileUtility.GetFileExtension(@i.AnnexURI) : defaultPath ))); sbResult.Append(string.Format(",middle:'{0}'", CY.Utility.Common.StringUtility.EscapeString( File.Exists(middlePath) ? CY.Utility.Common.FileUtility.GetHttpDirPath(@i.AnnexURI.Replace("\\", "/")) + @i.Name + "_middle" + CY.Utility.Common.FileUtility.GetFileExtension(@i.AnnexURI) : defaultPath ))); sbResult.Append(string.Format(",big:'{0}'", CY.Utility.Common.StringUtility.EscapeString( File.Exists(bigPath) ? CY.Utility.Common.FileUtility.GetHttpDirPath(@i.AnnexURI.Replace("\\", "/")) + @i.Name + "_big" + CY.Utility.Common.FileUtility.GetFileExtension(@i.AnnexURI) : defaultPath ))); } else { sbResult.Append(string.Format("small:'{0}'", CY.Utility.Common.StringUtility.EscapeString( smallPath ))); sbResult.Append(string.Format(",middle:'{0}'", CY.Utility.Common.StringUtility.EscapeString( middlePath ))); sbResult.Append(string.Format(",big:'{0}'", CY.Utility.Common.StringUtility.EscapeString( bigPath ))); } sbResult.Append("},"); } if (imgs.Count() > 0) { sbResult.Remove(sbResult.Length - 1, 1); } } } sbResult.Append("]"); } catch (Exception ex) { throw ex; } return sbResult.ToString(); }
private string ConstructorImgUrl(CY.CSTS.Core.Business.view_INSTRUMENT inst, ref Guid imgid) { string url = string.Empty; try { IEnumerable<CY.CSTS.Core.Business.Annex> annexes = inst.GetAnnexs(CY.Utility.Common.AnnexUtility.ImgAnnexType); if (annexes != null && annexes.Count() > 0) { url = annexes.First().AnnexURI.Replace("\\", "/"); if (string.IsNullOrEmpty(CY.Utility.Common.FileUtility.GetFileExtension(url))) { url = "/Content/Default/InstrumentDefault.jpg"; } imgid = annexes.First().Id; } else { url = "/Content/Default/InstrumentDefault.jpg"; } return url; } catch (Exception ex) { throw ex; } }