int m = int.Parse(Enum.Format(typeof(MaterialForms), cr.MaterialType, "d")); string codem = Enum.Format(typeof(MaterialFormCode), m, "g");