/// <summary> /// 保存枚举 /// </summary> /// <param name="enumcoderequest"></param> /// <returns></returns> public BasicResponse <EnumcodeInfo> SaveEnumCode(EnumcodeAddRequest enumcoderequest) { EnumcodeInfo dto = null; BasicResponse <EnumcodeInfo> Result = new BasicResponse <EnumcodeInfo>(); dto = enumcoderequest.EnumcodeInfo; if (dto == null) { //throw new Exception("枚举类型对象为空,请检查是否已赋值!"); ThrowException("SaveEnumCode", new Exception("枚举类型对象为空,请检查是否已赋值!")); } if (dto.LngEnumValue == null) { //throw new Exception("枚举DTO中LngEnumValue属性未赋值!"); ThrowException("SaveEnumCode", new Exception("枚举DTO中LngEnumValue属性未赋值!")); } if (dto.StrEnumDisplay.Trim() == "") { //throw new Exception("枚举DTO中strEnumDisplay属性未赋值!"); ThrowException("SaveEnumCode", new Exception("枚举DTO中strEnumDisplay属性未赋值!")); } if (dto.InfoState == InfoState.NoChange) { //throw new Exception("DTO对象未设置状态,请先设置!"); ThrowException("SaveEnumCode", new Exception("DTO对象未设置状态,请先设置!")); } if (dto.EnumTypeID == "0") { //throw new Exception("枚举类型必须设置值,属性名EnumTypeID!"); ThrowException("SaveEnumCode", new Exception("枚举类型必须设置值,属性名EnumTypeID!")); } try { int ID = 0; if (dto.InfoState == InfoState.AddNew) { Result = AddEnumcode(enumcoderequest); } else { EnumcodeUpdateRequest updaterequest = new EnumcodeUpdateRequest(); updaterequest.EnumcodeInfo = enumcoderequest.EnumcodeInfo; Result = UpdateEnumcode(updaterequest); } } catch (System.Exception ex) { ThrowException("SaveEnumCode", ex); } return(Result); }
public static List <EnumcodeInfo> GetListEnum() { List <EnumcodeInfo> list = new List <EnumcodeInfo>(); try { EnumcodeInfo dto = new EnumcodeInfo(); list = ClientAlarmModle.GetListEnumProperty(); list.AddRange(ClientAlarmModle.GetListEnumClass()); return(list); } catch (Exception ex) { LogHelper.Error("ClientAlarmServer-GetListEnum-发生异常 " + ex.Message); } return(list); }