Ejemplo n.º 1
0
    private DataTable GetDataFromCollection(CodingInfoCollection colt)
    {
        DataTable dataTable = new DataTable();

        dataTable.Columns.Add(new DataColumn("CodeID", typeof(int)));
        dataTable.Columns.Add(new DataColumn("TypeID", typeof(int)));
        dataTable.Columns.Add(new DataColumn("ParentCodeID", typeof(int)));
        dataTable.Columns.Add(new DataColumn("ParentCodeList", typeof(string)));
        dataTable.Columns.Add(new DataColumn("CodeName", typeof(string)));
        dataTable.Columns.Add(new DataColumn("ChildNumber", typeof(int)));
        dataTable.Columns.Add(new DataColumn("IsDefault", typeof(bool)));
        dataTable.Columns.Add(new DataColumn("IsFixed", typeof(bool)));
        dataTable.Columns.Add(new DataColumn("Owner", typeof(string)));
        int count = colt.Count;

        for (int i = 0; i < count; i++)
        {
            DataRow dataRow = dataTable.NewRow();
            dataRow["CodeID"]         = colt[i].CodeID.ToString();
            dataRow["TypeID"]         = colt[i].TypeID.ToString();
            dataRow["ParentCodeID"]   = colt[i].ParentCodeID.ToString();
            dataRow["ParentCodeList"] = colt[i].ParentCodeList.ToString();
            dataRow["CodeName"]       = colt[i].CodeName;
            dataRow["ChildNumber"]    = colt[i].ChildNumber;
            dataRow["IsDefault"]      = colt[i].IsDefault;
            dataRow["IsFixed"]        = colt[i].IsFixed;
            dataRow["Owner"]          = colt[i].Owner.ToString();
            dataTable.Rows.Add(dataRow);
        }
        return(dataTable);
    }
Ejemplo n.º 2
0
        public CodingInfoCollection QueryCodeInfoList(int typeID, int noteID, ValidState vState)
        {
            CodingInfoCollection infos = new CodingInfoCollection();
            string sqlString           = "";
            string str2 = sqlString;

            sqlString = str2 + " select * from XPM_Basic_CodeList where (TypeID=" + typeID.ToString() + ") and ParentCodeList like '%," + noteID.ToString() + ",%' and (IsVisible=1)";
            switch (vState)
            {
            case ValidState.InValid:
                sqlString = sqlString + "and(IsValid=0) ";
                break;

            case ValidState.Valid:
                sqlString = sqlString + "and(IsValid=1) ";
                break;
            }
            using (DataTable table = publicDbOpClass.DataTableQuary(sqlString))
            {
                int count = table.Rows.Count;
                if (count <= 0)
                {
                    return(infos);
                }
                for (int i = 0; i < count; i++)
                {
                    infos.Add(this.GetCodingInfoFromDataRow(table.Rows[i]));
                }
            }
            return(infos);
        }
Ejemplo n.º 3
0
        public CodingInfoCollection QueryCodeInfoList(int typeID, ValidState vState)
        {
            CodingInfoCollection infos = new CodingInfoCollection();
            string str = "";

            str = str + " select * from XPM_Basic_CodeList where (TypeID=" + typeID.ToString() + ") and (IsVisible=1)";
            switch (vState)
            {
            case ValidState.InValid:
                str = str + "and(IsValid=0) ";
                break;

            case ValidState.Valid:
                str = str + "and(IsValid=1) ";
                break;
            }
            using (DataTable table = publicDbOpClass.DataTableQuary(str + " ORDER BY IsDefault DESC,I_xh asc"))
            {
                int count = table.Rows.Count;
                if (count <= 0)
                {
                    return(infos);
                }
                for (int i = 0; i < count; i++)
                {
                    infos.Add(this.GetCodingInfoFromDataRow(table.Rows[i]));
                }
            }
            return(infos);
        }
Ejemplo n.º 4
0
        public CodingInfoCollection QueryCodeInfoList(int typeID, ValidState vState, string CodeID)
        {
            CodingInfoCollection infos = new CodingInfoCollection();
            string sqlString           = "";
            string str2 = "";

            if (CodeID.ToString() == "-3")
            {
                str2 = "-3,-2";
            }
            else if (CodeID.ToString() == "-2")
            {
                str2 = "-3,-2,-1";
            }
            else if (CodeID.ToString() == "-1")
            {
                str2 = "4,6,7,8,9";
            }
            string str3 = sqlString;

            sqlString = str3 + " select * from XPM_Basic_CodeList where (TypeID=" + typeID.ToString() + ") and (CodeID in (" + str2 + ")) and (IsVisible=1)";
            switch (vState)
            {
            case ValidState.InValid:
                sqlString = sqlString + "and(IsValid=0) ";
                break;

            case ValidState.Valid:
                sqlString = sqlString + "and(IsValid=1) ";
                break;
            }
            using (DataTable table = publicDbOpClass.DataTableQuary(sqlString))
            {
                int count = table.Rows.Count;
                if (count <= 0)
                {
                    return(infos);
                }
                for (int i = 0; i < count; i++)
                {
                    infos.Add(this.GetCodingInfoFromDataRow(table.Rows[i]));
                }
            }
            return(infos);
        }
Ejemplo n.º 5
0
        public CodingInfoCollection QueryCorpTypeList(string codeTerm)
        {
            CodingInfoCollection infos = new CodingInfoCollection();

            using (DataTable table = publicDbOpClass.DataTableQuary("select * from XPM_Basic_CodeList a join (select rtrim(Convert(varchar(10),CodeID)) as CodeS from XPM_Basic_CodeList where (CodeID in (" + codeTerm + ")) and (TypeID=4) and (IsVisible=1)) b on substring(a.ParentCodelist,2,charindex('','',a.ParentCodeList,2)-2) = b.CodeS and (a.typeID = 4) and (IsVisible=1)"))
            {
                int count = table.Rows.Count;
                if (count <= 0)
                {
                    return(infos);
                }
                for (int i = 0; i < count; i++)
                {
                    infos.Add(this.GetCodingInfoFromDataRow(table.Rows[i]));
                }
            }
            return(infos);
        }
Ejemplo n.º 6
0
        public CodingInfoCollection QueryCodeInfoList(int typeID, string userCode)
        {
            CodingInfoCollection infos   = new CodingInfoCollection();
            StringBuilder        builder = new StringBuilder();

            if (userCode != "00000000")
            {
                builder.AppendFormat("\r\nWITH cteallprivate \r\n     AS (SELECT T1.*\r\n         FROM   XPM_Basic_CodeList AS T1 \r\n                LEFT JOIN Basic_Privilege AS T2 \r\n                  ON T1.NoteId = T2.RelationsKey \r\n         WHERE  TypeId = '{0}' \r\n                AND IsVisible = 1 \r\n                AND IsValid = 1\r\n                AND UserCode = '{1}'\r\n                AND RelationsTable = 'XPM_Basic_CodeList'\r\n                 ), \r\n     ctechildrend \r\n     AS (SELECT * \r\n         FROM   cteallprivate \r\n         UNION ALL \r\n         SELECT T2.*\r\n         FROM   XPM_Basic_CodeList AS T2 \r\n                INNER JOIN ctechildrend \r\n                  ON cteChildrend.CodeID = T2.ParentCodeID \r\n         WHERE  T2.TypeId = '{0}' \r\n                AND T2.IsVisible = 1 \r\n                AND T2.IsValid = 1) \r\nSELECT * \r\nFROM   ctechildrend \r\nORDER  BY IsDefault, \r\n          CodeID ASC ", typeID, userCode);
                using (DataTable table = publicDbOpClass.DataTableQuary(builder.ToString()))
                {
                    int count = table.Rows.Count;
                    if (count > 0)
                    {
                        for (int i = 0; i < count; i++)
                        {
                            infos.Add(this.GetCodingInfoFromDataRow(table.Rows[i]));
                        }
                    }
                    return(infos);
                }
            }
            return(this.QueryCodeInfoList(typeID, ValidState.Valid));
        }