public FieldTemplate(Field field, Template template, int orderlist, int orderedit)
 {
     _field = field;
     _template = template;
     _orderlist = orderlist;
     _orderedit = orderedit;
 }
    public void SaveField([ARFetch("Id")]Field field , string name, 
                          string description, [ARFetch("TypeId")] Type type)
    {
        Commons.CheckSuperUser(Session);
        if (field == null)
            field = new Field();

        field.Name = name;
        field.Description = description;
        field.Type = type;
        field.Save();
        RedirectToAction("fields");
    }
    private static string ReadContent(XmlNode node, Category c)
    {
        string  keys = NodeGetString(node, "keys");
        string  vals = NodeGetString(node, "vals");

        string[] colname = keys.Split(',');
        string[] namedescr = vals.Split(',');

        int l = colname.Length;

        Field [] f = new Field[l];
        for (int i=0; i<l; i++)
            f[i] = Field.GetByName(colname[i]);

        Content r = new Content(c);
        r.Save();

        for (int i=0; i<l; i++)
        {
            DataModel d = new DataModel(r, f[i], namedescr[i]);
            d.Save();
        }

        return null;

    }
    private static string ReadField(XmlNode node)
    {
        if (node.Name == "Field")
        {
            string nombre = NodeGetString(node, "nombrecorto");
            string description = NodeGetString(node, "nombrelargo");
            string code = NodeGetString(node, "code");
            Type type = (Type) NodeGetObject(node, "type", types);

            System.Console.WriteLine ("Field: "+ nombre);
            Field f = new Field(nombre, description, code, type);
            f.Save();
            fields[nombre] = f;
            fields[code] = f;
        }
        return null;
    }