public Service.ApplicationCenterWS.SMC_PackageFAQ CopyPackageFAQ(SMC_PackageFAQ faq) { Service.ApplicationCenterWS.SMC_PackageFAQ entity = new Service.ApplicationCenterWS.SMC_PackageFAQ(); entity.pe_id = faq.pe_id; entity.pf_answer = faq.pf_answer; entity.pf_askdate = faq.pf_askdate; entity.pf_askemail = faq.pf_askemail; entity.pf_askmobile = faq.pf_askmobile; entity.pf_id = faq.pf_id; entity.pf_peplyman = faq.pf_peplyman; entity.pf_question = faq.pf_question; entity.pf_uid = faq.pf_uid; entity.pf_uname = faq.pf_uname; return entity; }
protected void SyncPackageExtToAppCenter(SMC_PackageExt ext, Hashtable r, int batch_no) { SmartBox.Console.Bo.AppCenter.AppCenterBO bo = Bo.BoFactory.GetAppCenterBO; Service.ApplicationCenterWS.WebService ws = new Service.ApplicationCenterWS.WebService(); string smartbox_console_path = HttpRuntime.AppDomainAppPath; Service.ApplicationCenterWS.SMC_PackageExt entity = CopyPackageExt(ext); bool flag = true; //Log4NetHelper.Info("wsurl:" + ws.Url); try { //同步安装包到外网应用中心 ws.PackageExtSync(entity); Service.ApplicationCenterWS.SMC_PackageFAQ faqEntity = new Service.ApplicationCenterWS.SMC_PackageFAQ(); //同步应用手册到外网应用中心 IList<SMC_PackageManual> manuals = bo.GetPackageManuals(entity.pe_id); foreach (SMC_PackageManual _manual in manuals) { Service.ApplicationCenterWS.SMC_PackageManual manual = CopyPackageManual(_manual); bool f = ws.PackageManualSync(manual); flag = flag && f; } //同步截图表到外网应用中心 IList<SMC_PackagePicture> pics = bo.GetPackagePictures(entity.pe_id); if (pics.Count > 0) { foreach (SMC_PackagePicture _pic in pics) { Service.ApplicationCenterWS.SMC_PackagePicture pic = CopyPackagePicture(_pic); bool f = ws.PackagePictuerSync(pic); flag = flag && f; } } //同步附件到外网应用中心 string entityFolder = smartbox_console_path + "\\PackageExt\\" + ext.pe_id; if (Directory.Exists(entityFolder)) { string[] files = System.IO.Directory.GetFiles(entityFolder); List<Service.ApplicationCenterWS.FileEntity> fs = new List<Service.ApplicationCenterWS.FileEntity>(); foreach (string filePath in files) { if (System.IO.File.Exists(filePath)) { FileStream s = new FileStream(filePath, FileMode.Open, FileAccess.Read); Service.ApplicationCenterWS.FileEntity fEntity = new Service.ApplicationCenterWS.FileEntity(); fEntity.Content = new byte[s.Length]; s.Read(fEntity.Content, 0, (int)s.Length); s.Close(); s.Dispose(); fEntity.FileName = Path.GetFileName(filePath); fs.Add(fEntity); } } bool f = true; if (fs.Count > 0) { f = ws.PackageFilesSync(fs.ToArray(), ext.pe_id); } flag = flag && f; } r["r"] = flag; r["d"] = "同步" + (flag ? "成功!" : "失败!"); //同步成功 ext.pe_SyncStatus = flag ? 1 : 2; BoFactory.GetVersionTrackBo.UpdatePackageExt(ext); SMC_PackageExtSyncToOutside sync = new SMC_PackageExtSyncToOutside(); sync.sync_bat_no = batch_no; sync.pe_id = ext.pe_id; sync.pe_name = ext.pe_Name; sync.sync_status = true; sync.sync_time = DateTime.Now; sync.description = "同步成功"; BoFactory.GetSMC_PackageExtSyncToOutsideBO.Insert(sync); } catch (Exception xe) { Log4NetHelper.Error(xe); //同步失败 BoFactory.GetVersionTrackBo.UpdatePackageExt(ext); SMC_PackageExtSyncToOutside sync = new SMC_PackageExtSyncToOutside(); sync.sync_bat_no = batch_no; sync.pe_id = ext.pe_id; sync.pe_name = ext.pe_Name; sync.sync_status = false; sync.sync_time = DateTime.Now; sync.description = xe.Message; BoFactory.GetSMC_PackageExtSyncToOutsideBO.Insert(sync); r["r"] = false; r["d"] = "同步失败!"; } }
public virtual void UpdatePackageFAQ(SMC_PackageFAQ packageFAQ) { packageFAQDao.Update(packageFAQ); Service.ApplicationCenterWS.WebService ws = new Service.ApplicationCenterWS.WebService(); Service.ApplicationCenterWS.SMC_PackageFAQ faq = new Service.ApplicationCenterWS.SMC_PackageFAQ(); faq.pe_id = packageFAQ.pe_id; faq.pf_answer = packageFAQ.pf_answer; faq.pf_askdate = packageFAQ.pf_askdate; faq.pf_askemail = packageFAQ.pf_askemail; faq.pf_askmobile = packageFAQ.pf_askmobile; faq.pf_id = packageFAQ.pf_id; faq.pf_need_syncto_inside = packageFAQ.pf_need_syncto_inside; faq.pf_need_syncto_outside = packageFAQ.pf_need_syncto_outside; faq.pf_peplyman = packageFAQ.pf_peplyman; faq.pf_question = packageFAQ.pf_question; faq.pf_uid = packageFAQ.pf_uid; faq.pf_uname = packageFAQ.pf_uname; //同步问题反馈回复至外网 ws.PackageFAQSync(faq); }