示例#1
0
        public static void SyncUnits(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, OutsideWS.WebService ws)
        {
            IList <SMC_Unit> units = bo.GetNeedSyncSMC_Units();

            OutsideWS.SMC_Unit[] _units = new OutsideWS.SMC_Unit[units.Count];
            for (int i = 0; i < units.Count; ++i)
            {
                _units[i] = CopySMC_Unit(units[i]);
            }
            ws.SMC_UnitSync(_units.ToArray());
        }
示例#2
0
        public static void SyncUsers(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, OutsideWS.WebService ws)
        {
            IList <SMC_User> users = bo.GetNeedSyncSMC_Users();

            OutsideWS.SMC_User[] _users = new OutsideWS.SMC_User[users.Count];
            for (int i = 0; i < users.Count; ++i)
            {
                _users[i] = CopySMC_User(users[i]);
            }
            ws.SMC_UserSync(_users.ToArray());
        }
示例#3
0
        static void Main(string[] args)
        {
            IProxy proxy = ProxyFactory.CreateProxy();

            SmartBox.Console.Bo.AppCenter.AppCenterBO bo = proxy.CreateObject <SmartBox.Console.Bo.AppCenter.AppCenterBO>();

            OutsideWS.WebService ws = new OutsideWS.WebService();
            //SyncInsideDataToOutside.SyncProgram.SyncPackages(bo, ws);
            SyncInsideDataToOutside.SyncProgram.SyncUnits(bo, ws);
            SyncInsideDataToOutside.SyncProgram.SyncUsers(bo, ws);
        }
示例#4
0
        public static void SyncPackages(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, OutsideWS.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)
            {
                OutsideWS.SMC_PackageExt entity = CopyPackageExt(ext);

                //同步安装包到外网应用中心
                ws.PackageExtSync(entity);

                OutsideWS.SMC_PackageFAQ faqEntity = new OutsideWS.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)
                {
                    OutsideWS.SMC_PackageManual manual = CopyPackageManual(_manual);
                    ws.PackageManualSync(manual);
                }

                //同步截图表到外网应用中心
                IList <SMC_PackagePicture> pics = bo.GetPackagePictures(entity.pe_id);
                foreach (SMC_PackagePicture _pic in pics)
                {
                    OutsideWS.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 <OutsideWS.FileEntity> fs = new List <OutsideWS.FileEntity>();
                    foreach (string filePath in files)
                    {
                        if (File.Exists(filePath))
                        {
                            FileStream           s       = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                            OutsideWS.FileEntity fEntity = new OutsideWS.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) {
                    }
                }
            }
        }