⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 framewhere.cs

📁 结构很好的三层数据访问组件。开放源码。是微软企业库数据访问的替代产品之一。
💻 CS
📖 第 1 页 / 共 2 页
字号:
                }
                index++;
            Label_06D4:
                if (index < this.count)
                {
                    goto Label_067E;
                }
                if (index > 0)
                {
                    str2 = str2.Substring(1, str2.Length - 1);
                    str2 = "(" + str2 + ")";
                }
                returnSQL = str2;
                goto Label_0A74;
            Label_0718:
                if (this.pList[num5].Value != null)
                {
                    if (this.pList[num5].Operator != "in")
                    {
                        str2 = str2 + " and " + this.pList[num5].Col + " " + this.pList[num5].Operator + " " + this.frameCity.GetValueData(this.pList[num5].Value, this.DBType, this.pList[num5].DataType);
                    }
                    else if (this.pList[num5].Operator == "in")
                    {
                        str2 = str2 + " and " + this.pList[num5].Col + " " + this.pList[num5].Operator + " (" + this.pList[num5].Value + ")";
                    }
                }
                num5++;
            Label_0889:
                if (num5 < this.count)
                {
                    goto Label_0718;
                }
                returnSQL = str2;
                goto Label_0A74;
            Label_08AC:
                if (this.pList[num6].Value != null)
                {
                    if (this.pList[num6].Operator != "in")
                    {
                        str2 = str2 + " and " + this.pList[num6].Col + " " + this.pList[num6].Operator + " " + this.frameCity.GetValueData(this.pList[num6].Value, this.DBType, this.pList[num6].DataType);
                    }
                    else if (this.pList[num6].Operator == "in")
                    {
                        str2 = str2 + " and " + this.pList[num6].Col + " " + this.pList[num6].Operator + " (" + this.pList[num6].Value + ")";
                    }
                }
                num6++;
            Label_0A1D:
                if (num6 < this.count)
                {
                    goto Label_08AC;
                }
                returnSQL = str2;
            }
            catch (Exception exception)
            {
                ErrorInfo = "处理Where时出错:\n\r" + exception.Message;
                return false;
            }
        Label_0A74:
            return true;
        }

        public int Count
        {
            get
            {
                return this.count;
            }
        }

        public string this[string index, string Operator]
        {
            get
            {
                string functionAlias = "09";
                int num = -1;
                for (int i = 0; i < this.count; i++)
                {
                    if ((this.pList[i].Name == index) && (this.pList[i].Operator == Operator))
                    {
                        num = i;
                    }
                }
                if (-1 == num)
                {
                    throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, " Where属性:" + index + " 项或操作符: " + Operator + " 不存在!"));
                }
                return this.pList[num].Value;
            }
            set
            {
                string functionAlias = "09";
                int num = -1;
                int num2 = -1;
                for (int i = 0; i < this.count; i++)
                {
                    if (this.pList[i].Name == index)
                    {
                        num = i;
                    }
                }
                if (-1 == num)
                {
                    throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, " Where属性:" + index + " 项不存在!"));
                }
                if (Operator == "")
                {
                    this.pList[num].Value = value;
                }
                else
                {
                    for (int j = 0; j < this.count; j++)
                    {
                        if ((this.pList[j].Name == index) && (this.pList[j].Operator == Operator))
                        {
                            num2 = j;
                        }
                    }
                    if (-1 != num2)
                    {
                        this.pList[num2].Value = value;
                    }
                    else
                    {
                        this.AddWhereList(this.pList[num].Name, this.pList[num].Depiction, this.pList[num].DataType, Operator, this.pList[num].Col, value);
                    }
                }
            }
        }

        public string this[string index]
        {
            get
            {
                string functionAlias = "06";
                int num = -1;
                for (int i = 0; i < this.count; i++)
                {
                    if (this.pList[i].Name == index)
                    {
                        num = i;
                    }
                }
                if (-1 == num)
                {
                    throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, " Where属性:" + index + " 项不存在!"));
                }
                return this.pList[num].Value;
            }
            set
            {
                string functionAlias = "06";
                int num = -1;
                for (int i = 0; i < this.count; i++)
                {
                    if (this.pList[i].Name == index)
                    {
                        num = i;
                    }
                }
                if (-1 == num)
                {
                    throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, " Where属性:" + index + " 项不存在!"));
                }
                this.pList[num].Value = value;
            }
        }

        public string this[int index]
        {
            get
            {
                string functionAlias = "05";
                if ((index < 0) || (index > (this.count - 1)))
                {
                    throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, " Where属性:共存在 " + this.count.ToString() + " 项,索引 " + index.ToString() + " 越界!"));
                }
                return this.pList[index].Value;
            }
            set
            {
                string functionAlias = "05";
                if ((index < 0) || (index > (this.count - 1)))
                {
                    throw new Exception(this.frameCity.DealErrorInfo(this.ClassAlias, functionAlias, " Where属性:共存在 " + this.count.ToString() + " 项,索引 " + index.ToString() + " 越界!"));
                }
                this.pList[index].Value = value;
            }
        }

        [StructLayout(LayoutKind.Sequential)]
        private struct WhereList
        {
            public string Name;
            public string Depiction;
            public string DataType;
            public string Operator;
            public string Col;
            public string Value;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -