没有引入外部类数据

时间:2019-07-19 00:07:52

标签: c# class

我正在测试的网站文件。包括“使用JobTrack;” C:\ Users \ me \ Documents \ pcs \ App_Code \ JobTracker.cs

我已经更新的项目文件。两者都在名称空间JobTrack中定义。 C:\ Users \ me \ Documents \ pcs_console_apps \ JobTrackSLA \ CyclicJobFactory.cs C:\ Users \ me \ Documents \ pcs_console_apps \ JobTrackSLA \ CyclicJob.cs

调用类的地方。

CyclicJobFactory cycleFactory = CyclicJobFactory.getInstance();

CyclicJob job = cycleFactory.findJobByPattern(jobpattern);

这是调用它们的功能。

public static string createQueryForJob(string jobpattern, int cycle, int yearOfCycle, string prefix)

这是使用该功能的示例。

string cxxQuery = createQueryForJob("$CXXccP", cycle, yearOfCycle, "DJ.");

相关代码。

private CyclicJobFactory()
{

    jobList = new List<CyclicJob>();

    /*
    jobList.Add(new CyclicJob("$CXXcc", "^[$]CXX[0-3c][0-9c]$", "00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30", 2, 2, "TDC"));
    */
    jobList.Add(new CyclicJob("$CXXccP", "^[$]CXX[0-3c][0-9c]P$", "00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30",2, 2, "TDC"));
}

public static CyclicJobFactory getInstance()
{
    if(cyclicJobFactory == null)
    {
        cyclicJobFactory = new CyclicJobFactory();
    }
    return cyclicJobFactory;
}
public CyclicJob findJobByPattern(string job)
{
    foreach (CyclicJob cjob in jobList)
    {
        if (cjob.isJobMatch(job))
            return cjob;
    }
    return null;
}

当我运行JobTracker代码时,它将带入我已更改的旧的作业名值$ CXXcc。我可以将两个类复制到JobTracker文件中,并且网站运行正常。只是想知道我在想什么。

0 个答案:

没有答案