Beispiel #1
0
        public bool Init()
        {
            string text = string.Empty;

            try
            {
                CodeList codeList;
                var      list       = GetData();
                var      codevalues = new List <CodeValue>();
                foreach (var item in list.Select(x => new { CodeType = x.CodeType, Description = x.Description }).Distinct()
                         )
                {
                    text = item.CodeType;

                    foreach (var data in list.Where(x => x.CodeType == item.CodeType).OrderBy(x => x.Code))
                    {
                        codevalues.Add(new CodeValue()
                        {
                            code = data.Code, value = data.Text
                        });
                    }
                    codeList = new CodeList(text, this, codevalues);
                    this.codeLists.Add(text, codeList);
                }
            }
            catch (Exception e)
            {
                return(false);
            }



            return(true);
        }
Beispiel #2
0
        //public string Code2Value(CodeLists codeList, string code)
        //{
        //    CodeList list1 = this[codeList];
        //    if (list1 == null)
        //    {
        //        return string.Empty;
        //    }
        //    return list1.Code2Value(code);
        //}

        public string Code2Value(string codeList, string code)
        {
            CodeList list1 = this[codeList];

            if (list1 == null)
            {
                return(string.Empty);
            }
            return(list1.Code2Value(code));
        }
Beispiel #3
0
        //public string Value2Code(CodeLists codeList, string value)
        //{
        //    CodeList list1 = this[codeList];
        //    if (list1 == null)
        //    {
        //        return string.Empty;
        //    }
        //    return list1.Value2Code(value);
        //}

        public string Value2Code(string codeList, string value)
        {
            CodeList list1 = this[codeList];

            if (list1 == null)
            {
                return(string.Empty);
            }
            return(list1.Value2Code(value));
        }
Beispiel #4
0
        //public bool Code2Value(CodeLists codeList, string code, out string value)
        //{
        //    CodeList list1 = this[codeList];
        //    if (list1 == null)
        //    {
        //        value = string.Empty;
        //        return false;
        //    }
        //    return list1.Code2Value(code, out value);
        //}

        public bool Code2Value(string codeList, string code, out string value)
        {
            CodeList list1 = this[codeList];

            if (list1 == null)
            {
                value = string.Empty;
                return(false);
            }
            return(list1.Code2Value(code, out value));
        }
Beispiel #5
0
        //public bool Value2Code(CodeLists codeList, string value, out string code)
        //{
        //    CodeList list1 = this[codeList];
        //    if (list1 == null)
        //    {
        //        code = string.Empty;
        //        return false;
        //    }
        //    return list1.Value2Code(value, out code);
        //}

        public bool Value2Code(string codeList, string value, out string code)
        {
            CodeList list1 = this[codeList];

            if (list1 == null)
            {
                code = string.Empty;
                return(false);
            }
            return(list1.Value2Code(value, out code));
        }