示例#1
0
    public string addRef(string type, string desc)
    {
        if (!CurrentContext.Valid)
        {
            return("FAILED");
        }
        if (!CurrentContext.Admin)
        {
            return("FAILED - not admin.");
        }
        RefType rtype;

        if (!Enum.TryParse(type, out rtype))
        {
            return("Invalid argument.");
        }
        switch (rtype)
        {
        case RefType.disposition:
            return(DefectDispo.New(desc).ToString());

        case RefType.severity:
            return(DefectSeverity.New(desc).ToString());

        case RefType.component:
            return(DefectComp.New(desc).ToString());
        }
        return("Unsupported");
    }