public void PublishSoft(long id, string[] dst) { ShareManDBDataContext context = new ShareManDBDataContext(); // 查找相关文件链接 ItemLink il = context.ItemLink.First(c => c.ID == id); FileSetLink fsl = context.FileSetLink.First(c => c.ID == il.InterLink); // 查询文件集信息 FSM.FileSetMan fsm = new ShareMan.FSM.FileSetMan(); QS.Queries qs = new ShareMan.QS.Queries(); string actIp = qs.QueryActInterSrv(); fsm.Url = qs.QueryUrl(qs.QueryActInterSrv(),QS.ServiceType.FileSetMan); FSM.FileSet fs = fsm.QureyFileSet(fsl.FileSetID); // 发布 foreach (string subCode in dst) { string ip = qs.QuerySrvIp(subCode); fsm.Url = qs.QueryUrl(ip, QS.ServiceType.FileSetMan); long fsid = fsm.CreateFileSet(fs,true); FSM.FileSet tmpFs = fsm.QureyFileSet(fsid); // 查询基本信息 BaseItem baseItem = context.BaseItem.First(c => c.ID == id); // 查询电影信息 Software softInfo = context.Software.First(c => c.ID == id); PublishType pubType = context.PublishType.First(c => c.ID == baseItem.PublishType); SB.ShareBrowse sb = new SB.ShareBrowse(); //sb.Url = "http://localhost/SB/ShareBrowse.asmx"; string url = qs.QueryUrl(ip,QS.ServiceType.ShareBrowse); sb.Url = url; sb.PublishSoft(this.Convert(baseItem), this.Convert(softInfo), this.Convert(pubType),fsid); CreateProgress(baseItem, actIp, ip, fsid, "发布", context); TransFileSet(qs.QueryActInterSrv(), ip,tmpFs); Distribute trbut = new Distribute { SubCode = subCode, ItemID = id }; context.Distribute.InsertOnSubmit(trbut); context.SubmitChanges(); Audit(id, 2); } }
public void PublishVidioNews(long id,string [] dst) { ShareManDBDataContext context = new ShareManDBDataContext(); try { context.Connection.Open(); context.Transaction = context.Connection.BeginTransaction(); // 查找相关文件链接 ItemLink il = context.ItemLink.First(c => c.ID == id); FileSetLink fsl = context.FileSetLink.First(c => c.ID == il.InterLink); // 查询文件集信息 FSM.FileSetMan fsm = new ShareMan.FSM.FileSetMan(); QS.Queries qs = new ShareMan.QS.Queries(); // 中转服务器ip string actIp = qs.QueryActInterSrv(); fsm.Url = qs.QueryUrl(qs.QueryActInterSrv(), QS.ServiceType.FileSetMan); FSM.FileSet fs = fsm.QureyFileSet(fsl.FileSetID); // 发布 foreach (string subCode in dst) { string ip = qs.QuerySrvIp(subCode); fsm.Url = qs.QueryUrl(ip, QS.ServiceType.FileSetMan); long fsid = fsm.CreateFileSet(fs, true); FSM.FileSet tmpFs = fsm.QureyFileSet(fsid); // 查询基本信息 BaseItem baseItem = context.BaseItem.First(c => c.ID == id); // 查询电影信息 VidioNews vnInfo = context.VidioNews.First(c => c.ID == id); PublishType pubType = context.PublishType.First(c => c.ID == baseItem.PublishType); SB.ShareBrowse sb = new SB.ShareBrowse(); string url = qs.QueryUrl(ip, QS.ServiceType.ShareBrowse); sb.Url = url; sb.PublishVidioNews(this.Convert(baseItem), this.Convert(vnInfo), this.Convert(pubType), fsid); CreateProgress(baseItem, actIp, ip, fsid, "发布", context); TransFileSet(actIp, ip, tmpFs); Distribute trbut = new Distribute { SubCode = subCode, ItemID = id }; context.Distribute.InsertOnSubmit(trbut); context.SubmitChanges(); Audit(id, 2); context.Transaction.Commit(); } } catch (System.Exception e) { context.Transaction.Rollback(); throw e; } }
public void PublishMusic(long id,string [] dst) { ShareManDBDataContext context = new ShareManDBDataContext(); // 查找相关文件链接 //var link = from l in context.ItemLink where l.ID == id select l; ItemLink il = context.ItemLink.First(c => c.ID == id); if (il == null) { throw new ArgumentException("il is null" + id.ToString()); } //var fslink = from f in context.FileSetLink where f.ID == il.SrcLink select f; FileSetLink fsl = context.FileSetLink.First(c => c.ID == il.InterLink); if (fsl == null) { throw new ArgumentException("fsl is null" + il.SrcLink.ToString()); } // 查询文件集信息 FSM.FileSetMan fsm = new ShareMan.FSM.FileSetMan(); QS.Queries qs = new ShareMan.QS.Queries(); string actIp = qs.QueryActInterSrv(); fsm.Url = qs.QueryUrl(qs.QueryActInterSrv(),QS.ServiceType.FileSetMan); FSM.FileSet fs = fsm.QureyFileSet(fsl.FileSetID); if(fs == null) { throw new ArgumentException("fs is null"+fsl.FileSetID.ToString()); } // 发布 foreach (string subCode in dst) { string ip = qs.QuerySrvIp(subCode); fsm.Url = qs.QueryUrl(ip, QS.ServiceType.FileSetMan); long fsid = fsm.CreateFileSet(fs,true); FSM.FileSet tmpFs = fsm.QureyFileSet(fsid); // 查询基本信息 BaseItem baseItem = context.BaseItem.First(c => c.ID == id); // 查询电影信息 Music musicInfo = context.Music.First(c => c.ID == id); PublishType pubType = context.PublishType.First(c => c.ID == baseItem.PublishType); SB.ShareBrowse sb = new SB.ShareBrowse(); string url = qs.QueryUrl(ip,QS.ServiceType.ShareBrowse); sb.Url = url; sb.PublishMusic(this.Convert(baseItem), this.Convert(musicInfo), this.Convert(pubType),fsid); CreateProgress(baseItem, actIp, ip, fsid, "发布", context); TransFileSet(qs.QueryActInterSrv(), ip,tmpFs); Distribute trbut = new Distribute { SubCode = subCode, ItemID = id }; context.Distribute.InsertOnSubmit(trbut); context.SubmitChanges(); Audit(id, 2); } }