Esempio n. 1
0
        public static DataRow ShowMultiLookup(string strLookupColumn, string strLookupValue, bool bLookupRequire, string strLookupKeyFilter, string strLookupKeyValid)
        {
            strLookupValue = (strLookupValue == null) ? string.Empty : strLookupValue;
            strLookupValue = strLookupValue.ToUpper();
            DataRow        row    = DataTool.SQLGetDataRowByID("SYSLookup", "ColumnID", strLookupColumn);
            frmQuickLookup lookup = new frmQuickLookup();

            lookup.bMuiltiLookup      = true;
            lookup.isLookup           = true;
            lookup.strLookupColumn    = row["ColumnID_Lookup"].ToString();
            lookup.strLookupValue     = strLookupValue;
            lookup.strLookupKeyFilter = strLookupKeyFilter;
            lookup.strLookupKeyValid  = strLookupKeyValid;
            lookup.LoadLookup();
            return(lookup.drLookup);
        }
Esempio n. 2
0
        public static DataRow ShowQuickLookup(string strLookupColumn, string strLookupValue, bool bLookupRequire, string strLookupKeyFilter, string strLookupKeyValid)
        {
            strLookupValue = (strLookupValue == null) ? string.Empty : strLookupValue;
            strLookupValue = strLookupValue.ToUpper();
            DataRow row = DataTool.SQLGetDataRowByID("SYSLookup", "ColumnID", strLookupColumn);

            if (row == null)
            {
                EpointMessage.MsgCancel("Chưa khai báo Lookup cho [" + strLookupColumn + "]");
                return(null);
            }
            if (!(bLookupRequire || !(strLookupValue == string.Empty)))
            {
                return(null);
            }
            string strKey = string.Concat(new object[] { "( ", row["ColumnID_Lookup"], " = N'", strLookupValue, "' )" });

            if ((strLookupKeyFilter != null) && (strLookupKeyFilter != string.Empty))
            {
                strKey = strKey + " AND (" + strLookupKeyFilter + ")";
            }
            if ((strLookupKeyValid != null) && (strLookupKeyValid != string.Empty))
            {
                strKey = strKey + " AND (" + strLookupKeyValid + ")";
            }
            DataTable table = DataTool.SQLGetDataTable(row["Table_Lookup"].ToString(), null, strKey, null);

            if (table.Rows.Count == 1)
            {
                return(table.Rows[0]);
            }
            frmQuickLookup lookup = new frmQuickLookup();

            lookup.bMuiltiLookup      = false;
            lookup.isLookup           = true;
            lookup.strLookupColumn    = row["ColumnID_Lookup"].ToString();
            lookup.strLookupValue     = strLookupValue;
            lookup.strLookupKeyFilter = strLookupKeyFilter;
            lookup.strLookupKeyValid  = strLookupKeyValid;
            lookup.LoadLookup();
            return(lookup.drLookup);
        }