static SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ CopyPackageFAQ(SMC_PackageFAQ faq) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ entity = new SmartBox.Console.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); }
public static void SyncPackages(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, SmartBox.Console.Service.ApplicationCenterWS.WebService ws) { string smartbox_console_path = System.Configuration.ConfigurationManager.AppSettings["smartbox_console_path"]; IList<SMC_PackageExt> data = bo.GetNeedSyncPackageList(); foreach (SMC_PackageExt ext in data) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageExt entity = CopyPackageExt(ext); //同步安装包到外网应用中心 ws.PackageExtSync(entity); SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ faqEntity = new SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ(); //同步问题反馈到外网应用中心 //IList<SMC_PackageFAQ> faqs = bo.GetPackageFAQs(entity.pe_id); //foreach (SMC_PackageFAQ _faq in faqs) //{ // OutsideWS.SMC_PackageFAQ faq = CopyPackageFAQ(_faq); // ws.PackageFAQSync(faq); //} //同步应用手册到外网应用中心 IList<SMC_PackageManual> manuals = bo.GetPackageManuals(entity.pe_id); foreach (SMC_PackageManual _manual in manuals) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageManual manual = CopyPackageManual(_manual); ws.PackageManualSync(manual); } //同步截图表到外网应用中心 IList<SMC_PackagePicture> pics = bo.GetPackagePictures(entity.pe_id); foreach (SMC_PackagePicture _pic in pics) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackagePicture pic = CopyPackagePicture(_pic); ws.PackagePictuerSync(pic); } //同步附件到外网应用中心 string entityFolder = smartbox_console_path + "\\PackageExt\\" + ext.pe_id; if (Directory.Exists(entityFolder)) { string[] files = System.IO.Directory.GetFiles(entityFolder); List<SmartBox.Console.Service.ApplicationCenterWS.FileEntity> fs = new List<SmartBox.Console.Service.ApplicationCenterWS.FileEntity>(); foreach (string filePath in files) { if (File.Exists(filePath)) { FileStream s = new FileStream(filePath, FileMode.Open, FileAccess.Read); SmartBox.Console.Service.ApplicationCenterWS.FileEntity fEntity = new SmartBox.Console.Service.ApplicationCenterWS.FileEntity(); fEntity.Content = new byte[s.Length]; s.Read(fEntity.Content, 0, (int)s.Length); fEntity.FileName = Path.GetFileName(filePath); fs.Add(fEntity); } } try { ws.PackageFilesSync(fs.ToArray(), ext.pe_id); } catch (Exception ex) { } } } }
static SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ CopyPackageFAQ(SMC_PackageFAQ faq) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ entity = new SmartBox.Console.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; }
public static void SyncPackages(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, SmartBox.Console.Service.ApplicationCenterWS.WebService ws) { string smartbox_console_path = System.Configuration.ConfigurationManager.AppSettings["smartbox_console_path"]; IList <SMC_PackageExt> data = bo.GetNeedSyncPackageList(); foreach (SMC_PackageExt ext in data) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageExt entity = CopyPackageExt(ext); //同步安装包到外网应用中心 ws.PackageExtSync(entity); SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ faqEntity = new SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageFAQ(); //同步问题反馈到外网应用中心 //IList<SMC_PackageFAQ> faqs = bo.GetPackageFAQs(entity.pe_id); //foreach (SMC_PackageFAQ _faq in faqs) //{ // OutsideWS.SMC_PackageFAQ faq = CopyPackageFAQ(_faq); // ws.PackageFAQSync(faq); //} //同步应用手册到外网应用中心 IList <SMC_PackageManual> manuals = bo.GetPackageManuals(entity.pe_id); foreach (SMC_PackageManual _manual in manuals) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackageManual manual = CopyPackageManual(_manual); ws.PackageManualSync(manual); } //同步截图表到外网应用中心 IList <SMC_PackagePicture> pics = bo.GetPackagePictures(entity.pe_id); foreach (SMC_PackagePicture _pic in pics) { SmartBox.Console.Service.ApplicationCenterWS.SMC_PackagePicture pic = CopyPackagePicture(_pic); ws.PackagePictuerSync(pic); } //同步附件到外网应用中心 string entityFolder = smartbox_console_path + "\\PackageExt\\" + ext.pe_id; if (Directory.Exists(entityFolder)) { string[] files = System.IO.Directory.GetFiles(entityFolder); List <SmartBox.Console.Service.ApplicationCenterWS.FileEntity> fs = new List <SmartBox.Console.Service.ApplicationCenterWS.FileEntity>(); foreach (string filePath in files) { if (File.Exists(filePath)) { FileStream s = new FileStream(filePath, FileMode.Open, FileAccess.Read); SmartBox.Console.Service.ApplicationCenterWS.FileEntity fEntity = new SmartBox.Console.Service.ApplicationCenterWS.FileEntity(); fEntity.Content = new byte[s.Length]; s.Read(fEntity.Content, 0, (int)s.Length); fEntity.FileName = Path.GetFileName(filePath); fs.Add(fEntity); } } try { ws.PackageFilesSync(fs.ToArray(), ext.pe_id); } catch (Exception ex) { } } } }