public int AddPluginMap(PluginMap pluginMap)
 {
     return(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(this.ConnectString, "SP_AddPluginMap",
                                                                       pluginMap.PluginClass,
                                                                       pluginMap.PluginType,
                                                                       pluginMap.Description,
                                                                       pluginMap.FileName,
                                                                       pluginMap.ClassFullName));
 }
 public int AddPluginMap(PluginMap pluginMap)
 {
     return Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(this.ConnectString, "SP_AddPluginMap",
         pluginMap.PluginClass,
         pluginMap.PluginType,
         pluginMap.Description,
         pluginMap.FileName,
         pluginMap.ClassFullName);
 }
 public List<PluginMap> RetrievePluginMapByClassAndType(string pluginClass,string pluginType)
 {
     DataSet dataSet = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(this.ConnectString, "SP_RetrievePluginMapByClassAndType", pluginClass, pluginType);
     List<PluginMap> pluginMaps = new List<PluginMap>();
     foreach (DataRow item in dataSet.Tables[0].Rows)
     {
         PluginMap pluginMap = new PluginMap();
         pluginMap.PluginClass = item["PluginClass"] as string;
         pluginMap.PluginType = item["PluginType"] as string;
         pluginMap.Description = item["Description"] as string;
         pluginMap.FileName = item["FileName"] as string;
         pluginMap.ClassFullName = item["ClassFullName"] as string;
         pluginMaps.Add(pluginMap);
     }
     return pluginMaps;
 }
        public List <PluginMap> RetrievePluginMapByClassAndType(string pluginClass, string pluginType)
        {
            DataSet          dataSet    = Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteDataset(this.ConnectString, "SP_RetrievePluginMapByClassAndType", pluginClass, pluginType);
            List <PluginMap> pluginMaps = new List <PluginMap>();

            foreach (DataRow item in dataSet.Tables[0].Rows)
            {
                PluginMap pluginMap = new PluginMap();
                pluginMap.PluginClass   = item["PluginClass"] as string;
                pluginMap.PluginType    = item["PluginType"] as string;
                pluginMap.Description   = item["Description"] as string;
                pluginMap.FileName      = item["FileName"] as string;
                pluginMap.ClassFullName = item["ClassFullName"] as string;
                pluginMaps.Add(pluginMap);
            }
            return(pluginMaps);
        }
        public void TestAddResourceAndPluginMap()
        {
            PluginResourceAction resourceAction = new PluginResourceAction(ConnectString);
            Resource resource = new Resource();
            resource.ResourceType = "Plugin";

            FileStream fileStream = new FileStream(@"D:\Crazywolf\Devops\DevopsSupportCenter\HP.TS.Devops.CentralConnect.Plugin.General\bin\Debug\HP.TS.Devops.CentralConnect.Plugin.General.dll", FileMode.Open, FileAccess.Read, FileShare.None);
            StreamReader streamReader = new StreamReader(fileStream);
            byte[] source = new byte[fileStream.Length];
            fileStream.Read(source, 0, (int)fileStream.Length);
            fileStream.Close();
            resource.ResourceType = "Plugin";
            resource.FileName = @"HP.TS.Devops.CentralConnect.Plugin.General.dll";
            resource.FileContent = source;
            resource.CreateBy = "UnitTest";
            int result = resourceAction.AddResource(resource);
            PluginMap pluginMap = new PluginMap();
            pluginMap.PluginClass = "CentralConnectMetrics";
            pluginMap.PluginType = "MetricsV1";
            pluginMap.Description = "Official Metrics Plugin";
            pluginMap.FileName = resource.FileName;
            pluginMap.ClassFullName = "HP.TS.Devops.CentralConnect.Plugin.General.Metrics.MetricsV1";
            result = resourceAction.AddPluginMap(pluginMap);
        }