Beispiel #1
0
        //-------------------------------------------------------------------------------------------
        private Accounting_OFXSettings GetOFXSampleObj()
        {
            using (WeavverEntityContainer data = new WeavverEntityContainer())
               {
                    Guid testObjectId = new Guid(Helper.GetAppSetting("accounting_ofxsettings_testobjectid"));
                    var ofxSettings = (from x in data.Accounting_OFXSettings
                                        where x.Id == testObjectId
                                        select x).FirstOrDefault();

                    data.Entry(ofxSettings).State = System.Data.Entity.EntityState.Detached;

                    Assert.IsNotNull(ofxSettings, "could not get the ofx testing object");

                    return ofxSettings;
               }
        }
Beispiel #2
0
        //-------------------------------------------------------------------------------------------
        private Accounting_Accounts GetAccount()
        {
            using (WeavverEntityContainer data = new WeavverEntityContainer())
               {
                    var query = (from x in data.Accounting_Accounts
                                                where x.Id == AccountId.Value
                                                select x);
                    Accounting_Accounts acct = query.FirstOrDefault();

                    if (acct != null)
                    {
                         data.Entry(acct).State = System.Data.Entity.EntityState.Detached;
                    }
                    return acct;
               }
        }
        //-------------------------------------------------------------------------------------------
        /// <summary>
        /// Grabs the user from the database and loads it into Weavver.Sys.User;
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public System_Users GetUser(string username)
        {
            using (WeavverEntityContainer data = new WeavverEntityContainer())
               {
                    var user = (from x in data.System_Users
                                where x.Username == username
                                select x).FirstOrDefault();

                    if (user != null)
                    {
                         data.Entry(user).State = System.Data.Entity.EntityState.Detached;
                    }
                    return user;
               }
        }