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; }
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); }
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"]); } }
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"]); } }
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; }
//[-] 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 { } }
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); }
//[-] public virtual DataTable List(string Condition, string Sort = "") { DataTable Dt = Methods_Query.GetQuery(this.mHeader_ViewName, "*", Condition, Sort); return(Dt); }