public void Load(string Condition = "") { ClsDataAccess Da = new ClsDataAccess(); try { Da.Connect(); this.Load(Da, Condition); } catch (Exception ex) { throw ex; } finally { Da.Close(); } }
public virtual bool Save() { bool IsSave = false; ClsDataAccess Da = new ClsDataAccess(); try { Da.Connect(); Da.BeginTransaction(); Da.SaveDataRow(this.mHeader_Dr, this.mHeader_TableName); //[-] if (this.mBase_TableDetail != null) { foreach (ClsBaseTableDetail Inner_Obj in this.mBase_TableDetail) { Inner_Obj.Save(Da); } } //[-] if (this.mBase_RowDetail != null) { foreach (ClsBaseRowDetail Inner_Obj in this.mBase_RowDetail) { Inner_Obj.Save(Da); } } //[-] Da.CommitTransaction(); IsSave = true; } catch (Exception ex) { Da.RollbackTransaction(); throw ex; } finally { Da.Close(); } return(IsSave); }
public static DataTable GetQuery(string ViewObject, string Fields, string Condition, string Sort) { ClsDataAccess Da = new ClsDataAccess(); try { Da.Connect(); return(GetQuery(Da, ViewObject, Fields, Condition, Sort)); } catch (Exception ex) { throw ex; } finally { Da.Close(); } }
public static DataSet ExecuteQuery(string Query) { ClsDataAccess Da = new ClsDataAccess(); try { Da.Connect(); return(Da.ExecuteQuery(Query)); } catch (Exception ex) { throw ex; } finally { Da.Close(); } }
public static DataSet ExecuteQuery(string ProcedureName, ClsDataAccess.Struct_Parameters[] ProcedureParameters) { ClsDataAccess Da = new ClsDataAccess(); try { Da.Connect(); return(Da.ExecuteQuery(ProcedureName, ProcedureParameters)); } catch (Exception ex) { throw ex; } finally { Da.Close(); } }
public static DataTable GetQuery(string ViewObject, string Fields, ClsQueryCondition Condition, string Sort = "", Int64 Top = 0, Int32 Page = 0) { ClsDataAccess Da = new ClsDataAccess(); try { Da.Connect(); return(GetQuery(Da, ViewObject, Fields, Condition, Sort, Top, Page)); } catch (Exception ex) { throw ex; } finally { Da.Close(); } }
//[-] 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 { } }