예제 #1
0
        /// <summary>
        /// 同步单位至应用中心
        /// </summary>
        /// <returns></returns>
        public ActionResult SyncUnitToAppCenter()
        {
            JsonReturnMessages data = new JsonReturnMessages()
            {
                IsSuccess = true, Msg = "操作成功"
            };

            Service.ApplicationCenterWS.WebService ws = new Service.ApplicationCenterWS.WebService();
            IList <SMC_Unit> units = BoFactory.GetSMC_UnitBo.GetAllUnits();

            if (units != null && units.Count > 0)
            {
                Service.ApplicationCenterWS.SMC_Unit[] _units = new Service.ApplicationCenterWS.SMC_Unit[units.Count];
                for (int i = 0; i < units.Count; ++i)
                {
                    SMC_Unit unit = units[i];
                    Service.ApplicationCenterWS.SMC_Unit _unit = new Service.ApplicationCenterWS.SMC_Unit();
                    _unit.Unit_CreatedTime = unit.Unit_CreatedTime;
                    _unit.Unit_CreatedUser = unit.Unit_CreatedUser;
                    _unit.Unit_Demo        = unit.Unit_Demo;
                    _unit.Unit_ID          = unit.Unit_ID;
                    _unit.Unit_Name        = unit.Unit_Name;
                    _unit.Unit_Path        = unit.Unit_Path;
                    _unit.Unit_Sequence    = unit.Unit_Sequence;
                    _unit.Unit_UpdateTime  = unit.Unit_UpdateTime;
                    _unit.Unit_UpdateUser  = unit.Unit_UpdateUser;
                    _unit.Upper_Unit_ID    = unit.Upper_Unit_ID;

                    _units[i] = _unit;
                }
                ws.SMC_UnitSync(_units);
            }
            return(Json(data));
        }
        /// <summary>
        /// 同步单位至应用中心
        /// </summary>
        /// <returns></returns>
        public ActionResult SyncUnitToAppCenter()
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };

            Service.ApplicationCenterWS.WebService ws = new Service.ApplicationCenterWS.WebService();
            IList<SMC_Unit> units = BoFactory.GetSMC_UnitBo.GetAllUnits();
            if (units != null && units.Count > 0) {
                Service.ApplicationCenterWS.SMC_Unit[] _units = new Service.ApplicationCenterWS.SMC_Unit[units.Count];
                for (int i = 0; i < units.Count; ++ i)
                {
                    SMC_Unit unit = units[i];
                    Service.ApplicationCenterWS.SMC_Unit _unit = new Service.ApplicationCenterWS.SMC_Unit();
                    _unit.Unit_CreatedTime = unit.Unit_CreatedTime;
                    _unit.Unit_CreatedUser = unit.Unit_CreatedUser;
                    _unit.Unit_Demo = unit.Unit_Demo;
                    _unit.Unit_ID = unit.Unit_ID;
                    _unit.Unit_Name = unit.Unit_Name;
                    _unit.Unit_Path = unit.Unit_Path;
                    _unit.Unit_Sequence = unit.Unit_Sequence;
                    _unit.Unit_UpdateTime = unit.Unit_UpdateTime;
                    _unit.Unit_UpdateUser = unit.Unit_UpdateUser;
                    _unit.Upper_Unit_ID = unit.Upper_Unit_ID;

                    _units[i] = _unit;
                }
                ws.SMC_UnitSync(_units);
            }
            return Json(data);
        }
 public void SyncUnits(SmartBox.Console.Bo.AppCenter.AppCenterBO bo, Service.ApplicationCenterWS.WebService ws)
 {
     IList<SMC_Unit> units = bo.GetNeedSyncSMC_Units();
     Service.ApplicationCenterWS.SMC_Unit[] _units = new Service.ApplicationCenterWS.SMC_Unit[units.Count];
     for (int i = 0; i < units.Count; ++i)
     {
         _units[i] = CopySMC_Unit(units[i]);
     }
     ws.SMC_UnitSync(_units.ToArray());
 }
        public Service.ApplicationCenterWS.SMC_Unit CopySMC_Unit(SMC_Unit unit)
        {
            Service.ApplicationCenterWS.SMC_Unit entity = new Service.ApplicationCenterWS.SMC_Unit();
            entity.Unit_CreatedTime = unit.Unit_CreatedTime;
            entity.Unit_CreatedUser = unit.Unit_CreatedUser;
            entity.Unit_Demo = unit.Unit_Demo;
            entity.Unit_ID = unit.Unit_ID;
            entity.Unit_Name = unit.Unit_Name;
            entity.Unit_Path = unit.Unit_Path;
            entity.Unit_Sequence = unit.Unit_Sequence;
            entity.Unit_UpdateTime = unit.Unit_UpdateTime;
            entity.Unit_UpdateUser = unit.Unit_UpdateUser;
            entity.Upper_Unit_ID = unit.Upper_Unit_ID;

            return entity;
        }