Exemple #1
0
        /// <summary>
        /// MT_INSTALL_RESULT_STATUSテーブルからMtInstallResultStatusを取得する
        /// </summary>
        /// <param name="code">取得するデータのCode</param>
        /// <returns>取得したデータ</returns>
        public MtInstallResultStatus ReadMtInstallResultStatus(string code)
        {
            MtInstallResultStatus model = null;

            try
            {
                _logger.Enter($"{nameof(code)}={code}");

                DBAccessor.Models.MtInstallResultStatus entity = null;
                _dbPolly.Execute(() =>
                {
                    using (DBAccessor.Models.RmsDbContext db = new DBAccessor.Models.RmsDbContext(_appSettings))
                    {
                        entity = db.MtInstallResultStatus.FirstOrDefault(x => x.Code.Equals(code));
                    }
                });

                if (entity != null)
                {
                    model = entity.ToModel();
                }

                return(model);
            }
            catch (Exception e)
            {
                throw new RmsException("MT_INSTALL_RESULT_STATUSテーブルのSelectに失敗しました。", e);
            }
            finally
            {
                _logger.LeaveJson("{0}", model);
            }
        }
Exemple #2
0
        /// <summary>
        /// 配信グループを追加する
        /// </summary>
        /// <remarks>sd 01-2.配信グループ登録</remarks>
        /// <param name="utilParam">配信グループパラメータ</param>
        /// <returns>DBに追加したパラメータ(Result付き)</returns>
        public Result <DtDeliveryGroup> Create(DtDeliveryGroup utilParam)
        {
            Result <DtDeliveryGroup> result = null;

            try
            {
                _logger.EnterJson("In Param: {0}", utilParam);

                // 適用結果ステータス(notstart)のSIDを取得する
                MtInstallResultStatus status = _mtInstallResultStatusRepository.ReadMtInstallResultStatus(Const.InstallResultStatus.NotStarted);

                // 配信結果に適用結果履歴の初期値を設定する
                foreach (var deliveryResult in utilParam.DtDeliveryResult)
                {
                    deliveryResult.DtInstallResult.Add(new DtInstallResult()
                    {
                        DeviceSid = deliveryResult.DeviceSid,
                        ////DeliveryResultSid
                        InstallResultStatusSid = status.Sid,
                        CollectDatetime        = _timeProvider.UtcNow
                    });
                }

                // Sq1.1.1 配信グループを登録する
                DtDeliveryGroup model = _dtDeliveryGroupRepository.CreateDtDeliveryGroup(utilParam);

                _logger.Info(nameof(Resources.CO_API_DGC_004));

                result = new Result <DtDeliveryGroup>(ResultCode.Succeed, Resources.CO_API_DGC_004, model);
                return(result);
            }
            catch (RmsParameterException e)
            {
                _logger.Error(e, nameof(Resources.CO_API_DGC_002), new object[] { e.Message });
                result = new Result <DtDeliveryGroup>(ResultCode.ParameterError, string.Format(Resources.CO_API_DGC_002, e.Message), utilParam);
                return(result);
            }
            catch (Exception e)
            {
                _logger.Error(e, nameof(Resources.CO_API_DGC_003));
                result = new Result <DtDeliveryGroup>(ResultCode.ServerEerror, Resources.CO_API_DGC_003, utilParam);
                return(result);
            }
            finally
            {
                _logger.LeaveJson("Result Param: {0}", result);
            }
        }
Exemple #3
0
        /// <summary>
        /// 引数に指定したMtInstallResultStatusをMT_INSTALL_RESULT_STATUSテーブルへ登録する
        /// </summary>
        /// <param name="inData">登録するデータ</param>
        /// <returns>処理結果</returns>
        public MtInstallResultStatus CreateMtInstallResultStatus(MtInstallResultStatus inData)
        {
            MtInstallResultStatus model = null;

            try
            {
                _logger.EnterJson("{0}", inData);

                DBAccessor.Models.MtInstallResultStatus entity = new DBAccessor.Models.MtInstallResultStatus(inData);

                _dbPolly.Execute(() =>
                {
                    entity.CreateDatetime = _timePrivder.UtcNow;

                    using (DBAccessor.Models.RmsDbContext db = new DBAccessor.Models.RmsDbContext(_appSettings))
                    {
                        var dbdata = db.MtInstallResultStatus.Add(entity).Entity;
                        db.SaveChanges();
                        model = dbdata.ToModel();
                    }
                });

                return(model);
            }
            catch (ValidationException e)
            {
                throw new RmsParameterException(e.ValidationResult.ErrorMessage, e);
            }
            catch (Exception e)
            {
                throw new RmsException("MT_INSTALL_RESULT_STATUSテーブルへのInsertに失敗しました。", e);
            }
            finally
            {
                _logger.LeaveJson("{0}", model);
            }
        }
Exemple #4
0
        public static InstancesOnDb CreateMasterTables(InstancesOnDb list = null)
        {
            if (list == null)
            {
                list = new InstancesOnDb();
            }

            var builder = new TestDiProviderBuilder();

            builder.ServiceCollection.AddTransient <IMtDeliveryFileTypeRepository, MtDeliveryFileTypeRepository>();
            var provider = builder.Build();

            // 配信ファイル種別マスタテーブル
            {
                var repository = provider.GetRequiredService <IMtDeliveryFileTypeRepository>();

                // A / Lソフト
                var newdata = new MtDeliveryFileType()
                {
                    Code = Rms.Server.Core.Utility.Const.DeliveryFileType.AlSoft
                };
                var result = repository.CreateMtDeliveryFileType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // コンソールのHotfix
                newdata = new MtDeliveryFileType()
                {
                    Code = Rms.Server.Core.Utility.Const.DeliveryFileType.HotFixConsole
                };
                result = repository.CreateMtDeliveryFileType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // HobbitのHotfix
                newdata = new MtDeliveryFileType()
                {
                    Code = Rms.Server.Core.Utility.Const.DeliveryFileType.HotFixHobbit
                };
                result = repository.CreateMtDeliveryFileType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // パッケージ
                newdata = new MtDeliveryFileType()
                {
                    Code = Rms.Server.Core.Utility.Const.DeliveryFileType.Package
                };
                result = repository.CreateMtDeliveryFileType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);
            }

            // 接続ステータスマスタテーブル
            {
                var repository = provider.GetRequiredService <IMtConnectStatusRepository>();

                // 未接続(接続歴なし)
                var connectStatusNewData = new MtConnectStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.ConnectStatus.Unconnected
                };
                var result = repository.CreateMtConnectStatus(connectStatusNewData);
                Assert.IsNotNull(result);
                list.Add(result);

                // 接続中
                connectStatusNewData = new MtConnectStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.ConnectStatus.Connected
                };
                result = repository.CreateMtConnectStatus(connectStatusNewData);
                Assert.IsNotNull(result);
                list.Add(result);

                // 切断
                connectStatusNewData = new MtConnectStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.ConnectStatus.Disconnected
                };
                result = repository.CreateMtConnectStatus(connectStatusNewData);
                Assert.IsNotNull(result);
                list.Add(result);
            }

            // 配信グループステータスマスタテーブル
            {
                var repository = provider.GetRequiredService <IMtDeliveryGroupStatusRepository>();

                // 未開始(開始前)
                var newdata = new MtDeliveryGroupStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.DeliveryGroupStatus.NotStarted
                };
                var result = repository.CreateMtDeliveryGroupStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // 開始済み
                newdata = new MtDeliveryGroupStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.DeliveryGroupStatus.Started
                };
                result = repository.CreateMtDeliveryGroupStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // 完了
                newdata = new MtDeliveryGroupStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.DeliveryGroupStatus.Completed
                };
                result = repository.CreateMtDeliveryGroupStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);
            }

            // 適用結果ステータスマスタテーブル
            {
                var repository = provider.GetRequiredService <IMtInstallResultStatusRepository>();

                // 未開始
                var newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.NotStarted
                };
                var result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // メッセージ送信済み
                newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.MessageSent
                };
                result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // 対象外
                newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.Nottarget
                };
                result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // ダウンロード済み
                newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.Downloaded
                };
                result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // 配布中
                newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.Dispatching
                };
                result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // 配布済み
                newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.Dispatched
                };
                result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // ユーザによる適用キャンセル
                newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.Usercanceled
                };
                result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // 適用済み
                newdata = new MtInstallResultStatus()
                {
                    Code = Rms.Server.Core.Utility.Const.InstallResultStatus.Installed
                };
                result = repository.CreateMtInstallResultStatus(newdata);
                Assert.IsNotNull(result);
                list.Add(result);
            }

            // 機器分類マスタテーブル
            {
                var repository = provider.GetRequiredService <IMtEquipmentTypeRepository>();

                // ゲートウェイ
                var newdata = new MtEquipmentType()
                {
                    Code = Rms.Server.Core.Utility.Const.EquipmentType.Gateway
                };
                var result = repository.CreateMtEquipmentType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // デバイス
                newdata = new MtEquipmentType()
                {
                    Code = Rms.Server.Core.Utility.Const.EquipmentType.Device
                };
                result = repository.CreateMtEquipmentType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // ユニット
                newdata = new MtEquipmentType()
                {
                    Code = Rms.Server.Core.Utility.Const.EquipmentType.Unit
                };
                result = repository.CreateMtEquipmentType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);
            }

            // 機器型式マスタテーブル
            {
                var repository = provider.GetRequiredService <IMtEquipmentModelRepository>();
                var newdata    = new MtEquipmentModel()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = "model1"
                };
                var result = repository.CreateMtEquipmentModel(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                newdata = new MtEquipmentModel()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = "model2"
                };
                result = repository.CreateMtEquipmentModel(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                newdata = new MtEquipmentModel()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = "model3"
                };
                result = repository.CreateMtEquipmentModel(newdata);
                Assert.IsNotNull(result);
                list.Add(result);
            }

            // インストールタイプマスタテーブル
            {
                var repository = provider.GetRequiredService <IMtInstallTypeRepository>();

                // RSPC
                var newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.Rspc
                };
                var result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // Console
                newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.ConsoleRspc
                };
                result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // Console(RSPCレス)
                newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.ConsoleRspcless
                };
                result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // Console MINI(単独)
                newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.ConsoleMini
                };
                result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // Console MINI(Hobbit連携)
                newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.ConsoleMiniHobbit
                };
                result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // Hobbitサーバ
                newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.HobbitServer
                };
                result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // Hobbitクライアント
                newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.HobbitClient
                };
                result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);

                // リモート端末
                newdata = new MtInstallType()
                {
                    EquipmentTypeSid = list.GetMtEquipmentlTypeSid(Rms.Server.Core.Utility.Const.EquipmentType.Gateway),
                    Code             = Rms.Server.Core.Utility.Const.InstallType.Remote
                };
                result = repository.CreateMtInstallType(newdata);
                Assert.IsNotNull(result);
                list.Add(result);
            }

            return(list);
        }