Esempio n. 1
0
    public static string updateRow(string id, string columnName, string newValue)
    {
        // Check rules
        var rules = new RulesEngine(newValue, columnName);

        rules.checkColumn("grpsiz") // Qty
        .number()
        .negativeOneOrGreaterThanZero();
        rules.checkColumn("ot") // Overtime %
        .number()
        .greaterThan(-100);
        rules.checkColumn("mtf")
        .number()
        .greaterThan(0);
        rules.checkColumn("mtr")
        .number()
        .greaterThanOrEqual(0);
        rules.checkColumn("varbility")
        .number()
        .greaterThanOrEqual(0);

        if (rules.HasError)
        {
            return(MpxTableUtil.CreateError(rules.Error));
        }

        return(MpxTableUtil.UpdateRow(getSource(), TableName, IdColumn, id, columnName, newValue));
    }
    public static string updateRow(string id, string columnName, string newValue)
    {
        // Check rules
        var rules = new RulesEngine(newValue, columnName);

        rules.checkColumn("labordesc")
        .required();
        rules.checkColumn("grpsiz") // Qty
        .required()
        .number()
        .negativeOneOrGreaterThanZero();
        rules.checkColumn("ot") // Overtime %
        .required()
        .number()
        .greaterThan(-100);
        rules.checkColumn("abst") // Inefficiency
        .required()
        .number()
        .inRange(0, 99.99);

        if (rules.HasError)
        {
            return(MpxTableUtil.CreateError(rules.Error));
        }

        return(MpxTableUtil.UpdateRow(getSource(), TableName, IdColumn, id, columnName, newValue));
    }
    public static string updateRow(string id, string columnName, string newValue)
    {
        // Check rules
        var rules = new RulesEngine(newValue, columnName);

        rules.checkColumn("upa")
        .required()
        .number();

        if (columnName == "compname")
        {
            // TODO: need to do additonal query, probably before running model
            // Check compname's ibom settings, make sure it isn't set to this compname

            //Selected Product cannot nest an upper level
            //This would make infinite loop
            //A needs 2xB
            //B cannot nest A
            //A needs 2xC and 2xB, C needs 4xB, this is OK
        }

        if (rules.HasError)
        {
            return(MpxTableUtil.CreateError(rules.Error));
        }

        return(MpxTableUtil.UpdateRow(getSource(), TableName, IdColumn, id, columnName, newValue));
    }
Esempio n. 4
0
    public static string updateRow(string id, string columnName, string newValue)
    {
        // Check rules
        var rules = new RulesEngine(newValue, columnName);

        rules.checkColumn("enddemd")
        .number()
        .greaterThanOrEqual(0);
        rules.checkColumn("lotsiz")
        .number()
        .greaterThan(0);
        rules.checkColumn("varbility")
        .number()
        .greaterThanOrEqual(0);

        if (rules.HasError)
        {
            return(MpxTableUtil.CreateError(rules.Error));
        }

        return(MpxTableUtil.UpdateRow(getSource(), TableName, IdColumn, id, columnName, newValue));
    }
    public static string updateRow(string id, string columnName, string newValue)
    {
        // Check rules
        var rules = new RulesEngine(newValue, columnName);

        rules.checkColumn("opnam")
        .exclude("DOCK")
        .exclude("SCRAP")
        .exclude("STOCK");

        rules.checkColumn("opnum")
        .exclude("0")
        .exclude("10000")
        .exclude("9999")
        .integer()
        .greaterThan(0);

        rules.checkColumn("percentassign")
        .integer()
        .inRange(1, 100);

        rules.checkColumn("eqsetuptime")
        .isSpecialMpxMath();
        rules.checkColumn("eqruntime")
        .isSpecialMpxMath();
        rules.checkColumn("labsetuptime")
        .isSpecialMpxMath();
        rules.checkColumn("labruntime")
        .isSpecialMpxMath();

        if (rules.HasError)
        {
            return(MpxTableUtil.CreateError(rules.Error));
        }

        //newValue = newValue.Trim();
        //columnName = columnName.ToLower();
        //if (columnName == "opnam")
        //{
        //    newValue.ToUpper();
        //    if (newValue == "DOCK" || newValue == "SCRAP" || newValue == "STOCK")
        //    {
        //        return MpxTableUtil.CreateError("Name cannot be DOCK, SCRAP, or STOCK");
        //    }
        //}
        //if (columnName == "opnum")
        //{
        //    if (newValue == "0" || newValue == "10000" || newValue == "9999")
        //    {
        //        return MpxTableUtil.CreateError("Number cannot be 0, 10000, or 9999");
        //    }
        //    int newValueInt = 0;
        //    if (!int.TryParse(newValue, out newValueInt))
        //    {
        //        return MpxTableUtil.CreateError("Must be an integer");
        //    }
        //    if (!(newValueInt > 0))
        //    {
        //        return MpxTableUtil.CreateError("Must be greater than 0");
        //    }
        //}
        //if (columnName == "percentassign")
        //{
        //    int newValueInt = 0;
        //    if (!int.TryParse(newValue, out newValueInt))
        //    {
        //        return MpxTableUtil.CreateError("Must be an integer");
        //    }
        //    if (!(newValueInt >= 1 && newValueInt <= 100))
        //    {
        //        return MpxTableUtil.CreateError("Must be between 1 and 100");
        //    }
        //}
        //if (columnName == "eqsetuptime")
        //{
        //    // TODO: other mathy columns
        //    // TODO: allow mathy ops
        //    int newValueInt = 0;
        //    if (!int.TryParse(newValue, out newValueInt))
        //    {
        //        return MpxTableUtil.CreateError("Must be an integer");
        //    }
        //    if (!(newValueInt >= 0))
        //    {
        //        return MpxTableUtil.CreateError("Must be 0 or more");
        //    }
        //}

        return(MpxTableUtil.UpdateRow(getSource(), TableName, IdColumn, id, columnName, newValue));
    }
Esempio n. 6
0
 public static string updateRow(string id, string columnName, string newValue)
 {
     return(MpxTableUtil.UpdateRow(getSource(), TableName, IdColumn, id, columnName, newValue));
 }