public override DataTable List(DataObjects_Framework.Objects.QueryCondition Condition, string Sort = "", int Top = 0, int Page = 0)
 {
     Interface_DataAccess Da = this.CreateDataAccess();
     try
     { return base.List(Da, Condition, Sort, Top, Page); }
     catch (Exception Ex) { throw Ex; }
     finally { Da.Close(); }
 }
Example #2
0
        public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
        {
            bool Rv = base.Save(Da);

            Int64 ItemID = (Int64)Do_Methods.IsNull(this.pDr["ItemID"], 0);
            double Price = 0;
            DataTable Dt = Do_Methods_Query.ExecuteQuery("Select Top 1 Price From Item_PriceHistory Where ItemID = " + ItemID + " Order By DatePosted").Tables[0];
            if (Dt.Rows.Count > 0) Price = Convert.ToDouble(Do_Methods.IsNull(Dt.Rows[0]["Price"], 0));
            if (Price != Convert.ToDouble(Do_Methods.IsNull(this.pDr["Price"], 0))) this.UpdatePriceHistory(ItemID);

            return Rv;
        }
Example #3
0
        public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
        {
            DateTime ServerDate = Layer02_Common.GetServerDate();
            if (Convert.ToInt64(Do_Methods.IsNull(this.mHeader_Dr[this.mHeader_TableName + "ID"], 0)) == 0)
            {
                //this.mHeader_Dr["EmployeeID_CreatedBy"] = this.mCurrentUser.pDrUser["EmployeeID"];
                this.mHeader_Dr["DateCreated"] = ServerDate;
            }

            //this.mHeader_Dr["EmployeeID_UpdatedBy"] = this.mCurrentUser.pDrUser["EmployeeID"];
            this.mHeader_Dr["DateUpdated"] = ServerDate;

            return base.Save(Da);
        }
Example #4
0
        public override void Load(DataObjects_Framework.Objects.Keys Keys = null)
        {
            Interface_DataAccess Da = Do_Methods.CreateDataAccess();

            try
            {
                if (this.mIsCache)
                { Da.Connect(Do_Methods.Convert_String(Do_Globals.gSettings.pCollection[Layer01_Constants.CnsConnectionString_Cache])); }
                else
                { Da.Connect(); }

                base.Load(Da, Keys);
            }
            catch (Exception Ex) { throw Ex; }
            finally { Da.Close(); }
        }
Example #5
0
 public virtual void LoadForm(DataObjects_Framework.Objects.Keys Keys = null)
 {
     this.mIsNew = (Keys == null);
     this.mBase.Load(Keys);
     this.SetupForm_Bindings();
 }
Example #6
0
 protected virtual void Setup(
     DataObjects_Framework.BaseObjects.Base Base
     , Int64 System_ModulesID
     , Boolean IsReadOnly = false)
 {
     this.mBase = Base;
     this.mSystem_ModulesID = System_ModulesID;
     this.mIsReadOnly = IsReadOnly;
 }
Example #7
0
        public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
        {
            this.mObj_ContactPerson.Save(Da);
            this.pDr["ContactPersonID"] = this.mObj_ContactPerson.pDr["ContactPersonID"];

            //foreach (ClsBaseObjs.Str_Obj Obj in this.mBO_ShippingAddress_Address.pList_Obj)
            //{
            //    Obj.Obj.Save();
            //    DataRow[] Inner_ArrDr = this.pDt_ShippingAddress.Select("TmpKey = " + Obj.Name);
            //    if (Inner_ArrDr.Length > 0)
            //    { Inner_ArrDr[0]["AddressID"] = Obj.Obj.pDr["AddressID"]; }
            //}

            base.Save(Da);

            //this.mObj_ShippingAddress.Save(Da);

            return true;
        }
Example #8
0
 public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
 {
     this.mObj_Person.Save();
     this.pDr["PersonID"] = this.mObj_Person.pID;
     return base.Save(Da);
 }
 public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
 {
     this.mObj_RowProperty.Save();
     this.pDr["RowPropertyID"] = this.mObj_RowProperty.pID;
     return base.Save(Da);
 }
        public DataSet ExecuteQuery(string ProcedureName, DataObjects_Framework.Common.Do_Constants.Str_Parameters[] ProcedureParameters)
        {
            bool IsConnection = false;

                if (this.mConnection != null)
                {
                    if (this.mConnection.State == ConnectionState.Open)
                    { IsConnection = true; }
                }

                if (!IsConnection)
                { this.Connect(); }

                //[-]

                SqlCommand Cmd = new SqlCommand();
                SqlDataAdapter Adp = new SqlDataAdapter();
                DataSet Ds = new DataSet();
                try
                {
                    Cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    Cmd.CommandText = ProcedureName;
                    Cmd.CommandTimeout = CnsQueryTimeout;

                    if (!Information.IsNothing(ProcedureParameters))
                    {
                        foreach (DataObjects_Framework.Common.Do_Constants.Str_Parameters Inner_Obj in ProcedureParameters)
                        { Cmd.Parameters.AddWithValue(Inner_Obj.Name, Inner_Obj.Value); }
                    }

                    Cmd.Transaction = this.mTransaction;
                    Cmd.Connection = this.mConnection;
                    Adp.SelectCommand = Cmd;
                    Adp.Fill(Ds);
                }
                catch (Exception Ex)
                { throw Ex; }
                finally
                {
                    Cmd.Dispose();
                    Cmd = null;
                    Adp.Dispose();
                    Adp = null;

                    if (!IsConnection)
                    { this.Close(); }
                }

                return Ds;
        }
 /// <summary>
 /// (Overridable) Loads the List with the supplied QueryCondition object
 /// </summary>
 /// <param name="Condition">
 /// QueryCondition object to use
 /// </param>
 public virtual void Load(DataObjects_Framework.Objects.ClsQueryCondition Condition)
 {
     this.mDt_List = this.mDa.List(this.mHeader_ViewName, Condition);
     this.AddRequired(this.mDt_List);
 }
        public int ExecuteNonQuery(string ProcedureName, DataObjects_Framework.Common.Do_Constants.Str_Parameters[] ProcedureParameters)
        {
            bool IsConnection = false;

                if (this.mConnection != null)
                {
                    if (this.mConnection.State == ConnectionState.Open)
                    { IsConnection = true; }
                }

                if (!IsConnection)
                { this.Connect(); }

                //[-]

                SqlCommand Cmd = new SqlCommand();
                int ReturnValue = 0;
                try
                {
                    Cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    Cmd.CommandText = ProcedureName;
                    Cmd.CommandTimeout = CnsQueryTimeout;

                    if (!Information.IsNothing(ProcedureParameters))
                    {
                        foreach (DataObjects_Framework.Common.Do_Constants.Str_Parameters Inner_Obj in ProcedureParameters)
                        { Cmd.Parameters.AddWithValue(Inner_Obj.Name, Inner_Obj.Value); }
                    }

                    Cmd.Transaction = this.mTransaction;
                    Cmd.Connection = this.mConnection;
                    ReturnValue = Cmd.ExecuteNonQuery();
                }
                catch { }
                finally
                {
                    Cmd.Dispose();
                    Cmd = null;

                    if (!IsConnection)
                    { this.Close(); }
                }
                return ReturnValue;
        }
 public override void Load(DataObjects_Framework.Objects.ClsKeys Keys = null)
 {
     base.Load(Keys);
 }
Example #14
0
 //[-]
 public override void LoadForm(DataObjects_Framework.Objects.Keys Keys = null)
 {
     throw new NotImplementedException();
 }
 public override bool Save(DataObjects_Framework.DataAccess.Interface_DataAccess Da = null)
 {
     this.pDr["System_LookupID_PartyType"] = this.mPartyType;
     return base.Save(Da);
 }
Example #16
0
        void FrmDetail_Ev_FormSaved(DataObjects_Framework.Objects.Keys Keys)
        {
            ClsBase Obj_Base = (ClsBase)Activator.CreateInstance(this.mBase.GetType(), new Object[] { null });
            Obj_Base.Load(Keys);

            DataRow Dr_Obj = Obj_Base.pDr;

            DataTable Dt_List = (DataTable)this.Grid_List.pGrid.DataSource;

            StringBuilder Sb_Keys = new StringBuilder();
            Sb_Keys.Append(@"1 = 1");
            foreach (var Key in Keys.pName)
            { Sb_Keys.Append(@" And " + Key + @" = " + Do_Methods.Convert_Int64(Dr_Obj[Key])); }

            DataRow[] Arr_Dr = Dt_List.Select(Sb_Keys.ToString());
            if (Arr_Dr.Length > 0)
            {
                foreach (DataColumn Dc in Arr_Dr[0].Table.Columns)
                {
                    if (Keys.pName.Any(O => O == Dc.ColumnName)) { continue; }
                    Arr_Dr[0][Dc.ColumnName] = Dr_Obj[Dc.ColumnName];
                }
            }
            else
            { Dt_List.Rows.Add(Dr_Obj.ItemArray); }
        }