public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            m_DataSource.Update(TableName, updateMessage).Execute();
        }
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            using (var connection = CreateConnection(true))
            {
                connection.Update(ClassMappedNameCache.Get <EmployeeClassification>(), updateMessage);
            }
        }
Пример #3
0
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            const string sql = @"UPDATE HR.EmployeeClassification
                        SET EmployeeClassificationName = @EmployeeClassificationName
                        WHERE EmployeeClassificationKey = @EmployeeClassificationKey;";

            DbConnector.NonQuery(sql, updateMessage).Execute();
        }
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            var sql = @"UPDATE HR.EmployeeClassification
                        SET EmployeeClassificationName = @EmployeeClassificationName
                        WHERE EmployeeClassificationKey = @EmployeeClassificationKey;";

            using (var con = OpenConnection())
                con.Execute(sql, updateMessage);
        }
Пример #5
0
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            using (var db = _dbConnectionFactory.OpenDbConnection())
            {
                db.Update <EmployeeClassificationPartial>(
                    new { updateMessage.EmployeeClassificationName },
                    r => r.Id == updateMessage.EmployeeClassificationKey);
            }
        }
Пример #6
0
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            using (var db = new OrmCookbook())
            {
                db.EmployeeClassification
                .Where(ec => ec.EmployeeClassificationKey == updateMessage.EmployeeClassificationKey)
                .Set(ec => ec.EmployeeClassificationName, updateMessage.EmployeeClassificationName)
                .Update();
            }
        }
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            //Get a fresh copy of the row from the database
            var temp = Session.DefaultSession.GetObjectByKey <EmployeeClassification>(updateMessage.EmployeeClassificationKey);

            if (temp != null)
            {
                //Copy the changed fields
                temp.EmployeeClassificationName = updateMessage.EmployeeClassificationName;
                temp.Save();
            }
        }
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            using (var session = m_SessionFactory.OpenSession())
            {
                var temp = session.Get <EmployeeClassification>(updateMessage.EmployeeClassificationKey);
                if (temp != null)
                {
                    temp.EmployeeClassificationName = updateMessage.EmployeeClassificationName;
                    session.Update(temp);
                    session.Flush();
                }
            }
        }
Пример #9
0
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            const string sql = @"UPDATE HR.EmployeeClassification
                        SET EmployeeClassificationName = @EmployeeClassificationName
                        WHERE EmployeeClassificationKey = @EmployeeClassificationKey;";

            using (var con = OpenConnection())
                using (var cmd = new SqlCommand(sql, con))
                {
                    cmd.Parameters.AddWithValue("@EmployeeClassificationKey", updateMessage.EmployeeClassificationKey);
                    cmd.Parameters.AddWithValue("@EmployeeClassificationName", updateMessage.EmployeeClassificationName);
                    cmd.ExecuteNonQuery();
                }
        }
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            using (var context = CreateDbContext())
            {
                //Get a fresh copy of the row from the database
                var temp = context.EmployeeClassification.Find(updateMessage.EmployeeClassificationKey);
                if (temp != null)
                {
                    //Copy the changed fields
                    temp.EmployeeClassificationName = updateMessage.EmployeeClassificationName;
                    context.SaveChanges();
                }
            }
        }
Пример #11
0
        public void UpdateWithObject(EmployeeClassificationNameUpdater updateMessage)
        {
            if (updateMessage == null)
            {
                throw new ArgumentNullException(nameof(updateMessage), $"{nameof(updateMessage)} is null.");
            }

            using (var adapter = new DataAccessAdapter())
            {
                // use an entity
                var temp = adapter.FetchFirst(new QueryFactory().EmployeeClassification
                                              .Where(EmployeeClassificationFields.EmployeeClassificationKey
                                                     .Equal(updateMessage.EmployeeClassificationKey)));
                if (temp != null)
                {
                    temp.EmployeeClassificationName = updateMessage.EmployeeClassificationName;
                    adapter.SaveEntity(temp);
                }
            }
        }