Esempio n. 1
0
        public AdminKeysModels GetAdminKey(AdminKeyIds adminKeyIds)
        {
            AdminKeysModels adminKeysModels = null;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_AdminKeys_Get");

            command.AddParameter("@KeyEnumID", SqlDbType.TinyInt, ((int)adminKeyIds).ToString());

            command.AddCommonInputParams();

            using (IDataReader reader = command.ExecuteReader())
            {
                adminKeysModels = new AdminKeysModels();

                if (reader.Read())
                {
                    adminKeysModels.Key            = reader.GetDbStriing("KeyValue");
                    adminKeysModels.KeyName        = reader.GetDbStriing("KeyName");
                    adminKeysModels.KeyDescription = reader.GetDbStriing("KeyDescription");
                    adminKeysModels.KeyId          = reader.GetDbTinyInt("KeyEnumId");
                }
                else
                {
                    command.GetCommonOutputParams(adminKeysModels.responseModel);
                }
            }
            command.Connection.Close();

            return(adminKeysModels);
        }
Esempio n. 2
0
        public string GetAdminKeyString(AdminKeyIds adminKeyIds)
        {
            AdminKeysModels AdminKeysModels;
            AdminKeysDa     adminKeysDa = new AdminKeysDa();

            AdminKeysModels = adminKeysDa.GetAdminKey(adminKeyIds);

            if (AdminKeysModels.responseModel != null && AdminKeysModels.responseModel.ExecutionStatus == -1)
            {
                return(string.Empty);
            }

            return(AdminKeysModels?.Key);
        }