示例#1
0
        public ActionResult SyncProjectAndScene(ModelBase model)
        {
            var result = new StandardJsonResult <dynamic>();

            result.Try(() =>
            {
                if (!ModelState.IsValid)
                {
                    throw new KnownException(ModelState.GetFirstError());
                }

                var service                = ML.BC.Infrastructure.Ioc.GetService <IProjectSceneManagementService>();
                var synservice             = Ioc.GetService <ISyncStateManagementService>();
                var SN                     = GetSession();
                SyncStateDto model_Project = new SyncStateDto()
                {
                    ActionType = (byte)TypeEnum.Project, DeviceID = SN.User.Device, UserID = SN.User.UserID
                };
                SyncStateDto model_Scene = new SyncStateDto()
                {
                    ActionType = (byte)TypeEnum.Scene, DeviceID = SN.User.Device, UserID = SN.User.UserID
                };
                synservice.SetSyncState(model_Project, model_Scene);

                result.Value = service.GetProjectAndSceneForSync(BCSession.User.EnterpriseID);
            });
            return(result);
        }
示例#2
0
        public ActionResult SyncOrganization(ModelBase model)
        {
            var result = new StandardJsonResult <dynamic>();

            result.Try(() =>
            {
                if (!ModelState.IsValid)
                {
                    throw new KnownException(ModelState.GetFirstError());
                }

                var service  = ML.BC.Infrastructure.Ioc.GetService <IEnterpriseManagementService>();
                result.Value = service.GetEnterpriseForSync(BCSession.User.EnterpriseID);

                SyncStateDto model_Department = new SyncStateDto()
                {
                    ActionType = (byte)TypeEnum.Department, DeviceID = BCSession.User.Device, UserID = BCSession.User.UserID
                };
                SyncStateDto model_FrontUser = new SyncStateDto()
                {
                    ActionType = (byte)TypeEnum.User, DeviceID = BCSession.User.Device, UserID = BCSession.User.UserID
                };
                SyncStateDto model_UserRole = new SyncStateDto()
                {
                    ActionType = (byte)TypeEnum.Role, DeviceID = BCSession.User.Device, UserID = BCSession.User.UserID
                };
                var synservice = Ioc.GetService <ISyncStateManagementService>();
                synservice.SetSyncState(model_Department, model_FrontUser, model_UserRole);
            });
            return(result);
        }