コード例 #1
0
        public void Load(ClsDataAccess Da, string Condition = "")
        {
            string OtherCondition = "";

            if (this.mOtherLoadCondition != "")
            {
                OtherCondition = " And " + this.mOtherLoadCondition;
            }

            DataTable Dt;
            DataRow   Dr;

            if (Condition == "")
            {
                Dt = Methods_Query.GetQuery(Da, this.mViewName, "*", "1 = 0");
                Dr = Dt.NewRow();
            }
            else
            {
                Dt = Methods_Query.GetQuery(Da, this.mViewName, "*", Condition + OtherCondition);
                if (Dt.Rows.Count > 0)
                {
                    Dr = Dt.Rows[0];
                }
                else
                {
                    Dr = Dt.NewRow();
                }
            }

            this.mDr = Dr;
        }
コード例 #2
0
        public Int64 List_Count(ClsQueryCondition Condition = null)
        {
            DataTable Dt          = Methods_Query.GetQuery(this.mHeader_ViewName, "Count(1) As [Ct]", Condition);
            Int64     ReturnValue = 0;

            try
            { ReturnValue = (Int64)Methods.IsNull(Dt.Rows[0]["Ct"], 0); }
            catch { }
            return(ReturnValue);
        }
コード例 #3
0
        protected virtual void Setup(ClsSysCurrentUser pCurrentUser, string pTableName = "", string pViewName = "")
        {
            this.mCurrentUser      = pCurrentUser;
            this.mHeader_TableName = pTableName;
            this.mHeader_TableKey  = this.mHeader_TableName + "ID";
            if (pViewName == "")
            {
                pViewName = pTableName;
            }
            this.mHeader_ViewName = pViewName;

            DataTable Dt_Def = Methods_Query.GetTableDef(this.mHeader_TableName);

            DataRow[] ArrDr = Dt_Def.Select("IsPk = 1");
            foreach (DataRow Dr in ArrDr)
            {
                this.mHeader_Key.Add((string)Dr["ColumnName"]);
            }
        }
コード例 #4
0
        public ClsBaseRowDetail(ClsBase pObj_Base, string pHeaderName, string pTableName, string pViewName = "", string pOtherLoadCondition = "")
        {
            if (pViewName == "")
            {
                pViewName = pTableName;
            }

            this.mHeaderName         = pHeaderName;
            this.mTableName          = pTableName;
            this.mViewName           = pViewName;
            this.mOtherLoadCondition = pOtherLoadCondition;
            this.mObj_Base           = pObj_Base;

            DataTable Dt_Def = Methods_Query.GetTableDef(this.mTableName);

            DataRow[] ArrDr = Dt_Def.Select("IsPk = 1");
            foreach (DataRow Dr in ArrDr)
            {
                this.mList_Key.Add((string)Dr["ColumnName"]);
            }
        }
コード例 #5
0
        public void Load(ClsDataAccess Da, string Condition = "")
        {
            string OtherCondition = "";

            if (this.mOtherLoadCondition != "")
            {
                OtherCondition = " And " + this.mOtherLoadCondition;
            }

            DataTable Dt;

            if (Condition == "")
            {
                Dt = Methods_Query.GetQuery(Da, this.mViewName, "*", "1 = 0");
            }
            else
            {
                Dt = Methods_Query.GetQuery(Da, this.mViewName, "*", Condition + OtherCondition);
            }

            this.mDt = Dt;
        }
コード例 #6
0
        //[-]

        public virtual void Load(ClsKeys Keys = null)
        {
            ClsDataAccess Da           = new ClsDataAccess();
            StringBuilder Sb_Condition = new StringBuilder();
            string        Condition    = "";

            try
            {
                if (Keys != null)
                {
                    if (Keys.Count() != this.mHeader_Key.Count)
                    {
                        throw new Exception("Keys not equal to required keys.");
                    }

                    string Inner_Condition_And = "";
                    bool   IsStart             = false;
                    foreach (string Inner_Key in this.mHeader_Key)
                    {
                        Sb_Condition.Append(Inner_Condition_And + " " + Inner_Key + " = " + Keys[Inner_Key]);
                        if (!IsStart)
                        {
                            Inner_Condition_And = " And ";
                        }
                        IsStart = true;
                    }
                }

                Condition = Sb_Condition.ToString();

                Da.Connect();

                DataTable Dt;
                DataRow   Dr;

                if (Keys == null)
                {
                    Dt = Methods_Query.GetQuery(Da, this.mHeader_ViewName, "*", "1 = 0");
                    Dr = Dt.NewRow();
                }
                else
                {
                    Dt = Methods_Query.GetQuery(Da, this.mHeader_ViewName, "*", Condition);
                    Dr = Dt.Rows[0];
                }

                this.mHeader_Dr = Dr;

                //[-]

                if (this.mBase_TableDetail != null)
                {
                    foreach (ClsBaseTableDetail Inner_Obj in this.mBase_TableDetail)
                    {
                        Inner_Obj.Load(Da, Condition);
                    }
                }

                //[-]

                if (this.mBase_RowDetail != null)
                {
                    foreach (ClsBaseRowDetail Inner_Obj in this.mBase_RowDetail)
                    {
                        Inner_Obj.Load(Da, Condition);
                    }
                }

                //[-]

                this.AddRequired();
            }
            catch { }
        }
コード例 #7
0
        public virtual DataTable List(ClsQueryCondition Condition = null, string Sort = "", Int32 Top = 0, Int32 Page = 0)
        {
            DataTable Dt = Methods_Query.GetQuery(this.mHeader_ViewName, "*", Condition, Sort, Top, Page);

            return(Dt);
        }
コード例 #8
0
        //[-]

        public virtual DataTable List(string Condition, string Sort = "")
        {
            DataTable Dt = Methods_Query.GetQuery(this.mHeader_ViewName, "*", Condition, Sort);

            return(Dt);
        }